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: Mon, 20 Jul 2020 14:07:54 +0200

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 18.07.2020 15:48, Philip K. wrote:
>> I like this idea a lot, the patch below should implement this +
>> backwards compatibility code. Thought this might be getting too
>> complicated, I also went ahead and added "and" and "or".
>
> All right. That's a bit further than I expected, but the result is still 
> fast in the default scenario, so why not. ;-)
>
> I take it this approach behaved well enough in your testing?
>
> Should we replace
>
>    (derived-mode . special-mode)
>
> with
>
>    (and (derived-mode . special-mode)
>         (not (major-mode . help-mode)))
>
> ?

Sounds good.

>> +- a symbol, denoting a buffer local variable, where the buffer
>> +  is killed if it's value is non-nil. If the symbol also has a
>> +  function slot, it will be interpreted as a function first.
>
> This also introduces an ambiguity which I'd like to avoid. Let's just 
> make it if a symbol is there, it must be a function (and we should 
> silence its errors).

Whoops, I forgot that "buffer-file-name" was a function too. Will remove
it then.

>> +  (catch (if (eq project-kill-buffer-conditions conds)
>> +             'kill 'other)
>
> Do we really need this condition?

No, my intention was to avoid throw-catch'ing up the call-stack, step by
step, but considering the complexity of an average condition, this will
probably not even make any difference -- I'll remove it.

>> +             ((eq (car-safe c) 'major-mode)
>> +              (eq (buffer-local-value 'major-mode buf)
>> +                  (cdr c)))
>> +             ((eq (car-safe c) 'derived-mode)
>> +              (provided-mode-derived-p
>> +               (buffer-local-value 'major-mode buf)
>> +               (cdr c)))
>> +             ((eq (car-safe c) 'not)
>> +              (not (project--kill-buffer-check buf (cdr c))))
>> +             ((eq (car-safe c) 'and)
>> +              (seq-every-p
>> +               (apply-partially #'project--kill-buffer-check
>> +                                buf)
>> +               (cdr c)))
>> +             ((eq (car-safe c) 'or)
>> +              (seq-some
>> +               (apply-partially #'project--kill-buffer-check
>> +                                buf)
>
> I think we can simply recurse in this case.

I feel stupid for asking, but what do you mean? Am I not recursively
calling project--kill-buffer-check?

-- 
        Philip K.





reply via email to

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