bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffe


From: Philip K.
Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores)
Date: Thu, 16 Jul 2020 20:16:40 +0200

Eli Zaretskii <eliz@gnu.org> writes:

>> From: "Philip K." <philip@warpmail.net>
>> Date: Thu, 16 Jul 2020 10:47:43 +0200
>> 
>>  Each condition is either a regular expression matching a buffer
>> -name, or a predicate function that takes a buffer object as
>> -argument and returns non-nil if it matches.  Buffers that match
>> -any of the conditions will not be killed."
>> -  :type '(repeat (choice regexp function))
>> +name, a predicate function that takes a buffer object as argument
>> +and returns non-nil if it matches, or a symbol protecting buffers
>> +of certain major modes.
>
> The part you added to the doc string is unclear: how can a symbol
> "protect buffers of certain major modes"?  (I think I can guess what
> you mean, but readers of doc strings should be guessing.)

You're right, I'll think about rephrasing that.

>> -                       ((functionp c)
>> +                       ((and (symbolp c)
>> +                             (provided-mode-derived-p
>> +                              (buffer-local-value 'major-mode buf)
>> +                              c)))
>> +                       ((and (not (symbolp c))
>> +                             (functionp c))
>>                          (funcall c buf))))
>
> Is this logic correct and reliable?  A function is a symbol, and there
> could be symbols that have both a function cell and a variable cell --
> how does this cope with that?
>
> And why do you require a function not to be a symbol?  I'm probably
> missing something.

My idea was to only allow lambda expressions, but that would make it
hard to implement more complex predicates that should be defined in
their own defuns.

How about this: Instead of symbols, adding a cons-cell:

    (major-mode . erc-mode)

prevents erc-buffers from being killed?

> Thanks.
>

-- 
        Philip K.





reply via email to

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