emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 edc460e3b6c: Fix accidental backward-incompatible change (bug#6


From: João Távora
Subject: emacs-29 edc460e3b6c: Fix accidental backward-incompatible change (bug#62417)
Date: Mon, 27 Mar 2023 07:59:12 -0400 (EDT)

branch: emacs-29
commit edc460e3b6c38eee97dde847987b2c29dd134653
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix accidental backward-incompatible change (bug#62417)
    
    This code used to work, but with the change of 59ecf25fc860 it stopped
    working:
    
       (defun foop (buffer-name _alist) (string-match "foop" buffer-name))
       (add-to-list 'display-buffer-alist '(foop . display-buffer-other-frame))
    
    This change makes it work again, restoring compatibility.
    
    * lisp/subr.el (buffer-match-p): Fix and adjust docstring.
    * lisp/window.el (display-buffer-alist): Adjust docstring.
    (display-buffer-assq-regexp): Make good on promise of display-buffer-alist.
---
 lisp/subr.el   |  6 +++---
 lisp/window.el | 16 ++++++++++------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index c73643f6d2b..8d27c831c96 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7069,7 +7069,7 @@ CONDITION is either:
 - the symbol t, to always match,
 - the symbol nil, which never matches,
 - a regular expression, to match a buffer name,
-- a predicate function that takes a buffer object and ARG as
+- a predicate function that takes BUFFER-OR-NAME and ARG as
   arguments, and returns non-nil if the buffer matches,
 - a cons-cell, where the car describes how to interpret the cdr.
   The car can be one of the following:
@@ -7095,8 +7095,8 @@ CONDITION is either:
                        (string-match-p condition (buffer-name buffer)))
                       ((pred functionp)
                        (if (eq 1 (cdr (func-arity condition)))
-                           (funcall condition buffer)
-                         (funcall condition buffer arg)))
+                           (funcall condition buffer-or-name)
+                         (funcall condition buffer-or-name arg)))
                       (`(major-mode . ,mode)
                        (eq
                         (buffer-local-value 'major-mode buffer)
diff --git a/lisp/window.el b/lisp/window.el
index f6ddae854ad..4bdc26571f5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7501,8 +7501,8 @@ Its value takes effect before processing the ACTION 
argument of
 If non-nil, this is an alist of elements (CONDITION . ACTION),
 where:
 
- CONDITION is passed to `buffer-match-p', along with the buffer
-  that is to be displayed and the ACTION argument of
+ CONDITION is passed to `buffer-match-p', along with the name of
+  the buffer that is to be displayed and the ACTION argument of
   `display-buffer', to check if ACTION should be used.
 
  ACTION is a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is an
@@ -7559,12 +7559,16 @@ all fail.  It should never be set by programs or users. 
 See
 (defun display-buffer-assq-regexp (buffer-or-name alist action)
   "Retrieve ALIST entry corresponding to buffer specified by BUFFER-OR-NAME.
 This returns the cdr of the alist entry ALIST if the entry's
-key (its car) and BUFFER-OR-NAME satisfy `buffer-match-p', using
-the key as CONDITION argument of `buffer-match-p'.  ACTION should
-have the form of the action argument passed to `display-buffer'."
+key (its car) and the name of the buffer designated by
+BUFFER-OR-NAME satisfy `buffer-match-p', using the key as
+CONDITION argument of `buffer-match-p'.  ACTION should have the
+form of the action argument passed to `display-buffer'."
   (catch 'match
     (dolist (entry alist)
-      (when (buffer-match-p (car entry) buffer-or-name action)
+      (when (buffer-match-p (car entry) (if (stringp buffer-or-name)
+                                            buffer-or-name
+                                          (buffer-name buffer-or-name))
+                                          action)
         (throw 'match (cdr entry))))))
 
 (defvar display-buffer--same-window-action



reply via email to

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