bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54296: Add buffer-matching functionality


From: Dmitry Gutov
Subject: bug#54296: Add buffer-matching functionality
Date: Fri, 17 Jun 2022 16:39:27 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 17.06.2022 08:48, Eli Zaretskii wrote:
Date: Fri, 17 Jun 2022 04:21:04 +0300
Cc: 54296@debbugs.gnu.org, philipk@posteo.net, larsi@gnus.org
From: Dmitry Gutov <dgutov@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)





reply via email to

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