emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Should (buffer-list) ever return killed buffers?


From: Sergey Organov
Subject: Re: [PATCH] Should (buffer-list) ever return killed buffers?
Date: Mon, 24 May 2021 21:31:13 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Philipp <p.stephani2@gmail.com> writes:

>> Am 24.05.2021 um 17:32 schrieb Sergey Organov <sorganov@gmail.com>:
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>>>> Cc: cpitclaudel@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org
>>>> From: martin rudalics <rudalics@gmx.at>
>>>> Date: Mon, 24 May 2021 16:50:48 +0200
>>>> 
>>>>>> +        (unless (or (nill bufname)
>>>>>> +                    (eq (aref bufname 0) ?\s) ;; Don't kill internal 
>>>>>> buffers
>>>>>>                      (string-match-p preserve-regexp bufname))
>>>>>>            (kill-buffer buffer)))))
>>>>>>    (delete-other-windows)
>>>>> 
>>>>> AFAICT, kill-buffer already is a no-op when the buffer is dead.  So
>>>>> what exactly does this fix?  (Apologies if I'm missing something: I
>>>>> cannot say that I've read all the discussions in this thread to the
>>>>> last detail.)
>>>> 
>>>> Sergey never told us but it's likely `aref' choking on nil.
>>> 
>>> Then why not use buffer-live-p?
>> 
>> Cause aref is choking on bufname being nil, I think. What if
>> representation of killed buffers change?
>
> That won't happen. The ELisp manual guarantees that "[t]he
> ‘buffer-name’ of a buffer is ‘nil’ if, and only if, the buffer is
> killed."

Provide (null bufname) and (buffer-live-p buf) are synonyms, as the
manual claims,the former looks both more convenient and more logical in
this particular instance, as we already have bufname anyway, and the
problem is exactly because it's nil, not because the buffer is killed.

OTOH, killing of zombie buffer is not a problem by itself, so I don't
see why it should be explicitly checked and avoided.

Thanks,
-- Sergey Organov




reply via email to

[Prev in Thread] Current Thread [Next in Thread]