all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Philip K." <philip@warpmail.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 42386@debbugs.gnu.org
Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores)
Date: Mon, 20 Jul 2020 14:07:54 +0200	[thread overview]
Message-ID: <87pn8q9yp1.fsf@warpmail.net> (raw)
In-Reply-To: <89ff9cf6-e85b-4c36-4fb7-763c41e41b02@yandex.ru> (message from Dmitry Gutov on Mon, 20 Jul 2020 02:10:53 +0300)


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	other threads:[~2020-07-20 12:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  8:15 bug#42386: [PATCH] Handle symbols in project-kill-buffers-ignores Philip K.
     [not found] ` <handler.42386.B.159488736413990.ack@debbugs.gnu.org>
2020-07-16  8:47   ` bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores) Philip K.
2020-07-16 15:14     ` Eli Zaretskii
2020-07-16 18:08       ` Philip K.
2020-07-16 18:16       ` Philip K.
2020-07-16 19:35         ` Eli Zaretskii
2020-07-16 22:22           ` Philip K.
2020-07-17  6:38             ` Eli Zaretskii
2020-07-17  8:16               ` Philip K.
2020-07-17 10:49                 ` Eli Zaretskii
2020-07-17 11:17                   ` Philip K.
2020-07-17 11:26                     ` Eli Zaretskii
2020-07-17 15:30                       ` Philip K.
2020-07-17 15:43                         ` Dmitry Gutov
2020-07-17 17:16                           ` Philip K.
2020-07-17 22:21                             ` Dmitry Gutov
2020-07-18 12:48                               ` Philip K.
2020-07-19 23:10                                 ` Dmitry Gutov
2020-07-20 12:07                                   ` Philip K. [this message]
2020-07-20 13:39                                     ` Dmitry Gutov
2020-07-21  9:11                                       ` Philip K.
2020-07-21 14:27                                         ` Eli Zaretskii
2020-07-21 18:35                                           ` Philip K.
2020-07-21 18:57                                             ` Eli Zaretskii
2020-07-21 20:47                                               ` Dmitry Gutov
2020-07-21 18:45                                         ` Dmitry Gutov
2020-07-21 18:51                                           ` Philip K.
2020-07-27 16:26                                             ` Dmitry Gutov
2020-07-27 18:33                                               ` Philip K.
2020-07-28 22:33                                                 ` Dmitry Gutov
2020-07-16 18:41       ` Dmitry Gutov
2020-07-16 22:46         ` Juri Linkov
2020-07-17  0:23           ` Dmitry Gutov
2020-07-16 13:43 ` bug#42386: [PATCH] Handle symbols in project-kill-buffers-ignores Dmitry Gutov
2020-07-16 18:00   ` Philip K.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pn8q9yp1.fsf@warpmail.net \
    --to=philip@warpmail.net \
    --cc=42386@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.