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: Fri, 17 Jul 2020 10:16:59 +0200

Eli Zaretskii <eliz@gnu.org> writes:

>> +                   (lambda (c)
>> +                     (cond ((stringp c)
>> +                            (string-match-p c (buffer-name buf)))
>> +                           ((and (not (memq c project-kill-buffers-ignores))
>> +                                 (functionp c))
>
> Once again, I don't think I understand why you need the memq part.

The issue is that a major mode symbol is interpreted as a function, and
that triggers an error. So if I want to keep shell-mode buffers, and I'm
checking an emacs-lisp-mode buffer, the major mode isn't part of
project-kill-buffers-ignores (-> first memq), so the seq-some is
evaluated, and because shell-mode is a function, the code would try to
evaluate it as a predicate, but that fails.

I realise just now how stupid the memq is, because instead of stopping
major-mode symbols from being evaluated, I just stop everything, as
every member of the list is tautologically part of the list.

I don't see any way around this, except for trying to analyse the
symbols string representation or checking the arity if the
function. Neither seem like a particularly clean approach.

-- 
        Philip K.





reply via email to

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