diff options
| author | João Távora | 2023-03-27 12:25:16 +0100 |
|---|---|---|
| committer | João Távora | 2023-03-27 12:59:14 +0100 |
| commit | edc460e3b6c38eee97dde847987b2c29dd134653 (patch) | |
| tree | 89dce921cf45579d001f9896dd042e7600c43b57 | |
| parent | cbef1422fe3ba5d3327835f3952a0f42f7881716 (diff) | |
| download | emacs-edc460e3b6c38eee97dde847987b2c29dd134653.tar.gz emacs-edc460e3b6c38eee97dde847987b2c29dd134653.zip | |
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.
| -rw-r--r-- | lisp/subr.el | 6 | ||||
| -rw-r--r-- | 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: | |||
| 7069 | - the symbol t, to always match, | 7069 | - the symbol t, to always match, |
| 7070 | - the symbol nil, which never matches, | 7070 | - the symbol nil, which never matches, |
| 7071 | - a regular expression, to match a buffer name, | 7071 | - a regular expression, to match a buffer name, |
| 7072 | - a predicate function that takes a buffer object and ARG as | 7072 | - a predicate function that takes BUFFER-OR-NAME and ARG as |
| 7073 | arguments, and returns non-nil if the buffer matches, | 7073 | arguments, and returns non-nil if the buffer matches, |
| 7074 | - a cons-cell, where the car describes how to interpret the cdr. | 7074 | - a cons-cell, where the car describes how to interpret the cdr. |
| 7075 | The car can be one of the following: | 7075 | The car can be one of the following: |
| @@ -7095,8 +7095,8 @@ CONDITION is either: | |||
| 7095 | (string-match-p condition (buffer-name buffer))) | 7095 | (string-match-p condition (buffer-name buffer))) |
| 7096 | ((pred functionp) | 7096 | ((pred functionp) |
| 7097 | (if (eq 1 (cdr (func-arity condition))) | 7097 | (if (eq 1 (cdr (func-arity condition))) |
| 7098 | (funcall condition buffer) | 7098 | (funcall condition buffer-or-name) |
| 7099 | (funcall condition buffer arg))) | 7099 | (funcall condition buffer-or-name arg))) |
| 7100 | (`(major-mode . ,mode) | 7100 | (`(major-mode . ,mode) |
| 7101 | (eq | 7101 | (eq |
| 7102 | (buffer-local-value 'major-mode buffer) | 7102 | (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 | |||
| 7501 | If non-nil, this is an alist of elements (CONDITION . ACTION), | 7501 | If non-nil, this is an alist of elements (CONDITION . ACTION), |
| 7502 | where: | 7502 | where: |
| 7503 | 7503 | ||
| 7504 | CONDITION is passed to `buffer-match-p', along with the buffer | 7504 | CONDITION is passed to `buffer-match-p', along with the name of |
| 7505 | that is to be displayed and the ACTION argument of | 7505 | the buffer that is to be displayed and the ACTION argument of |
| 7506 | `display-buffer', to check if ACTION should be used. | 7506 | `display-buffer', to check if ACTION should be used. |
| 7507 | 7507 | ||
| 7508 | ACTION is a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is an | 7508 | 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 | |||
| 7559 | (defun display-buffer-assq-regexp (buffer-or-name alist action) | 7559 | (defun display-buffer-assq-regexp (buffer-or-name alist action) |
| 7560 | "Retrieve ALIST entry corresponding to buffer specified by BUFFER-OR-NAME. | 7560 | "Retrieve ALIST entry corresponding to buffer specified by BUFFER-OR-NAME. |
| 7561 | This returns the cdr of the alist entry ALIST if the entry's | 7561 | This returns the cdr of the alist entry ALIST if the entry's |
| 7562 | key (its car) and BUFFER-OR-NAME satisfy `buffer-match-p', using | 7562 | key (its car) and the name of the buffer designated by |
| 7563 | the key as CONDITION argument of `buffer-match-p'. ACTION should | 7563 | BUFFER-OR-NAME satisfy `buffer-match-p', using the key as |
| 7564 | have the form of the action argument passed to `display-buffer'." | 7564 | CONDITION argument of `buffer-match-p'. ACTION should have the |
| 7565 | form of the action argument passed to `display-buffer'." | ||
| 7565 | (catch 'match | 7566 | (catch 'match |
| 7566 | (dolist (entry alist) | 7567 | (dolist (entry alist) |
| 7567 | (when (buffer-match-p (car entry) buffer-or-name action) | 7568 | (when (buffer-match-p (car entry) (if (stringp buffer-or-name) |
| 7569 | buffer-or-name | ||
| 7570 | (buffer-name buffer-or-name)) | ||
| 7571 | action) | ||
| 7568 | (throw 'match (cdr entry)))))) | 7572 | (throw 'match (cdr entry)))))) |
| 7569 | 7573 | ||
| 7570 | (defvar display-buffer--same-window-action | 7574 | (defvar display-buffer--same-window-action |