diff options
Diffstat (limited to 'lisp/window.el')
-rw-r--r-- | lisp/window.el | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/lisp/window.el b/lisp/window.el index 24d95f367e4..c0e8781aab0 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4465,6 +4465,14 @@ BUFFER-OR-NAME and return that buffer." :value-type (sexp :tag "Value"))) "Custom type for `display-buffer' actions.") +(defvar display-buffer-overriding-action '(nil . nil) + "Overriding action to perform to display a buffer. +It should be a cons cell (FUNCTION . ALIST), where FUNCTION is a +function or a list of functions. Each function should accept 2 +arguments: a buffer to display and an alist similar to ALIST. +See `display-buffer' for details.") +(put 'display-buffer-overriding-action 'risky-local-variable t) + (defcustom display-buffer-alist nil "Alist of conditional actions for `display-buffer'. This is a list of elements (CONDITION . ACTION), where: @@ -4485,15 +4493,8 @@ This is a list of elements (CONDITION . ACTION), where: :version "24.1" :group 'windows) -(defcustom display-buffer-default-action - '((display-buffer--maybe-same-window - display-buffer-reuse-window - display-buffer--special - display-buffer--maybe-pop-up-frame-or-window - display-buffer-use-some-window - ;; If all else fails, pop up a new frame. - display-buffer-pop-up-frame)) - "List of default actions for `display-buffer'. +(defcustom display-buffer-base-action '(nil . nil) + "User-specified default action for `display-buffer'. It should be a cons cell (FUNCTION . ALIST), where FUNCTION is a function or a list of functions. Each function should accept 2 arguments: a buffer to display and an alist similar to ALIST. @@ -4503,16 +4504,19 @@ See `display-buffer' for details." :version "24.1" :group 'windows) -(defcustom display-buffer-overriding-action '(nil . nil) - "Overriding action to perform to display a buffer. -It should be a cons cell (FUNCTION . ALIST), where FUNCTION is a -function or a list of functions. Each function should accept 2 -arguments: a buffer to display and an alist similar to ALIST. -See `display-buffer' for details." - :type display-buffer--action-custom-type - :risky t - :version "24.1" - :group 'windows) +(defconst display-buffer-fallback-action + '((display-buffer--maybe-same-window + display-buffer-reuse-window + display-buffer--special + display-buffer--maybe-pop-up-frame-or-window + display-buffer-use-some-window + ;; If all else fails, pop up a new frame. + display-buffer-pop-up-frame)) + "Default fallback action for `display-buffer'. +This is the action used by `display-buffer' if no other actions +specified, e.g. by the user options `display-buffer-alist' or +`display-buffer-base-action'. See `display-buffer'.") +(put 'display-buffer-fallback-action 'risky-local-variable t) (defun display-buffer-assq-regexp (buffer-name alist) "Retrieve ALIST entry corresponding to BUFFER-NAME." @@ -4553,12 +4557,13 @@ function is called with 2 arguments: the buffer to display and an alist. It should either display the buffer and return the window, or return nil if unable to display the buffer. -`display-buffer' builds a function list and an alist from -`display-buffer-overriding-action', `display-buffer-alist', -ACTION, and `display-buffer-default-action' (in that order). -Then it calls each function in the combined function list in -turn, passing the buffer as the first argument and the combined -alist as the second argument, until a function returns non-nil. +The `display-buffer' function builds a function list and an alist +from `display-buffer-overriding-action', `display-buffer-alist', +the ACTION argument, `display-buffer-base-action', and +`display-buffer-fallback-action' (in that order). Then it calls +each function in the combined function list in turn, passing the +buffer as the first argument and the combined alist as the second +argument, until one of the functions returns non-nil. Available action functions include: `display-buffer-same-window' @@ -4608,7 +4613,8 @@ search for a window that is already displaying the buffer. See ;; Construct action function list and action alist. (actions (list display-buffer-overriding-action user-action action extra-action - display-buffer-default-action)) + display-buffer-base-action + display-buffer-fallback-action)) (functions (apply 'append (mapcar (lambda (x) (setq x (car x)) |