GNU bug report logs - #54296
Add buffer-matching functionality

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Mon, 7 Mar 2022 22:34:02 UTC

Severity: normal

Tags: patch

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54296 <at> debbugs.gnu.org, philipk <at> posteo.net, larsi <at> gnus.org
Subject: bug#54296: Add buffer-matching functionality
Date: Fri, 17 Jun 2022 16:39:27 +0300
On 17.06.2022 08:48, Eli Zaretskii wrote:
>> Date: Fri, 17 Jun 2022 04:21:04 +0300
>> Cc: 54296 <at> debbugs.gnu.org, philipk <at> posteo.net, larsi <at> gnus.org
>> From: Dmitry Gutov <dgutov <at> yandex.ru>
>>
>>> In any case, if we will keep both major-mode and derived-mode
>>> conditions in subr.el, let's at least document that derived-mode
>>> should be preferred where it can do the job, and major-mode used only
>>> where derived-mode will not DTRT.
>>
>> Sure. Here you go.
> 
> Fine with me, with one nit:
> 
>> +Satisfied if the buffer's major mode is eq to @var{expr}.  Prefer
> 
> Using "eq" as a word in the manual is not a good idea.  We use "is
> equal" elsewhere in the manual.

Thanks, done. Backward compatibility and capability are restored.

Now, if we wanted to downplay the option of doing equality comparison 
for major-mode, we could perhaps introduce a more general condition like 
'value-equal'.

That would change the definition of project-kill-buffer-conditions very 
slightly, still keeping it readable. And a gradual deprecation of the 
'major-mode' matcher could be done.

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 30f51704dc..dea11d4231 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1223,10 +1223,10 @@ project-display-buffer-other-frame
 (defcustom project-kill-buffer-conditions
   '(buffer-file-name    ; All file-visiting buffers are included.
     ;; Most of the temp buffers in the background:
-    (major-mode . fundamental-mode)
+    (value-equal major-mode . fundamental-mode)
     ;; non-text buffer such as xref, occur, vc, log, ...
     (and (derived-mode . special-mode)
-         (not (major-mode . help-mode)))
+         (not (value-equal major-mode . help-mode)))
     (derived-mode . compilation-mode)
     (derived-mode . dired-mode)
     (derived-mode . diff-mode)




This bug report was last modified 2 years and 338 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.