unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: emacs-devel@gnu.org, Philip Kaludercic <philipk@posteo.net>
Subject: Re: master 1a3bad431d 3/3: Update project-kill-buffer-conditions to match buffer-match-p
Date: Mon, 13 Jun 2022 03:20:52 +0300	[thread overview]
Message-ID: <6b93f00c-21a9-b881-15da-fb22c457195a@yandex.ru> (raw)
In-Reply-To: <20220415080727.DDE95C01683@vcs2.savannah.gnu.org>

Philip, Eli,

On 15.04.2022 11:07, Philip Kaludercic wrote:
> branch: master
> commit 1a3bad431d841e52a61e5f1f09b4ebe7fbbd70da
> Author: Philip Kaludercic<philipk@posteo.net>
> Commit: Philip Kaludercic<philipk@posteo.net>
> 
>      Update project-kill-buffer-conditions to match buffer-match-p
>      
>      * project.el (project-kill-buffer-conditions): Document the
>      deprecation of the use of derived-mode
>      (project--buffer-check): Have `major-mode' behave like `derived-mode'
>      did previously, and issue a warning of `derived-mode' is used.
> ---
>   lisp/progmodes/project.el | 40 ++++++++++++++++++++++++----------------
>   1 file changed, 24 insertions(+), 16 deletions(-)
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index daaf86f327..ac6aa0ced2 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -1201,18 +1201,22 @@ displayed."
>     (display-buffer-other-frame buffer-or-name))
>   
>   (defcustom project-kill-buffer-conditions
> -  '(buffer-file-name    ; All file-visiting buffers are included.
> +  `(buffer-file-name    ; All file-visiting buffers are included.
>       ;; Most of the temp buffers in the background:
> -    (major-mode . fundamental-mode)
> +    ,(lambda (buf)
> +       (not (eq (buffer-local-value 'major-mode buf)
> +                'fundamental-mode)))
>       ;; non-text buffer such as xref, occur, vc, log, ...
> -    (and (derived-mode . special-mode)
> -         (not (major-mode . help-mode)))
> -    (derived-mode . compilation-mode)
> -    (derived-mode . dired-mode)
> -    (derived-mode . diff-mode)
> -    (derived-mode . comint-mode)
> -    (derived-mode . eshell-mode)
> -    (derived-mode . change-log-mode))
> +    (and (major-mode . special-mode)

Apparently I missed the whole buffer-match-p discussion.

But whatever made you think it's okay to change the meaning of 
'major-mode' inside project-kill-buffer-conditions defcustom now?

Asking my opinion first would have been nice.

Putting aside the obvious incompleteness of the resulting DSL if the 
user is forced to use lambdas, the previous meaning of 'major-mode' in 
this user option has been nailed down in an Emacs release (28.1). So 
there can be (and probably are) users who have customized this var and 
who will see the resulting behavior change unexpectedly as soon as they 
update to a recent enough snapshot of Emacs 29. No warning is (or can 
be) issued in this case either.

That goes against our usual promise of backward compatibility.

And BTW, this 'not' changes the previous meaning too:

 > +    ,(lambda (buf)
 > +       (not (eq (buffer-local-value 'major-mode buf)
 > +                'fundamental-mode)))

(the established definition had the 'eq' semantics and not 'not eq')

...which would have been more a problem if project--buffer-check 
supported lambdas at all -- it doesn't, so the condition is skipped. The 
relevant check is (symbolp c), which didn't account for lambdas (which 
aren't a great fit for a Custom-editable variable anyway).

So the result of this (apparently untested) change is that "Most of the 
temp buffers in the background" are never killed by project-kill-buffers 
anymore, rather than having *all* buffers inside project root killed. 
Could have been worse, I guess.



           reply	other threads:[~2022-06-13  0:20 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20220415080727.DDE95C01683@vcs2.savannah.gnu.org>]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=6b93f00c-21a9-b881-15da-fb22c457195a@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).