Re: New package `outline-occur'
martin rudalics <[email protected]> Wed, 29 Jul 2026 10:44:24 +0200
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
>> Agreed, let's add app-action and test it on outline-occur
>> after it's implemented in the new feature request on the bug list.
>
> I've just created Bug#81512.
I attach a copy of what I think we could do with the sole purpose of
understanding how to process and document it.
The idea is that any buffer name or category present in what I'd call
'display-buffer-bound-alist' should match the buffer name or the
category of the ACTION argument of 'display-buffer'. Is that right?
How would this be used when popping up the *Occur* buffer? Like
(let* ((display-buffer-bound-alist
'(("\\*Occur\\*" (display-buffer-at-bottom)
(window-height . fit-window-to-buffer))))
((occur-hook (lambda () (pop-to-buffer "*Occur*")))))
...
martin
display-buffer-bound-action.diff
(text/x-patch, 2.9 KB)
diff --git a/lisp/window.el b/lisp/window.el
index 06128cf0483..2f2686a97c6 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8084,9 +8084,9 @@ display-buffer-overriding-action
(defcustom display-buffer-alist nil
"Alist of user-defined conditional actions for `display-buffer'.
-Its value takes effect before processing the ACTION argument of
-`display-buffer' and before `display-buffer-base-action' and
-`display-buffer-fallback-action', but after
+Its value takes effect before processing `display-buffer-bound-alist',
+the ACTION argument of `display-buffer', `display-buffer-base-action'
+and `display-buffer-fallback-action', but after
`display-buffer-overriding-action', which see.
If non-nil, this is an alist of elements (CONDITION . ACTION),
@@ -8110,6 +8110,25 @@ display-buffer-alist
:version "24.1"
:group 'windows)
+(defcustom display-buffer-bound-alist nil
+ "Alist of bound conditional actions for `display-buffer'.
+Its value takes effect before processing the ACTION argument of
+`display-buffer' and before `display-buffer-base-action' and
+`display-buffer-fallback-action', but after
+`display-buffer-overriding-action' and `display-buffer-alist', which
+see.
+
+Elips code may let-bind this around nested `display-buffer' calls but
+should never assign it buffer-locally or globally.
+
+If non-nil, this is an alist of elements (CONDITION . ACTION) like
+`display-buffer-alist'."
+ :type `(alist :key-type (buffer-predicate :tag "Condition")
+ :value-type ,display-buffer--action-custom-type)
+ :risky t
+ :version "32.1"
+ :group 'windows)
+
(defcustom display-buffer-base-action '(nil . nil)
"User-specified default action for `display-buffer'.
This is the default action used by `display-buffer' if no other
@@ -8398,6 +8417,9 @@ display-buffer
(display-buffer-assq-regexp
buf-name display-buffer-alist action))
(special-action (display-buffer--special-action buffer))
+ (bound-action
+ (display-buffer-assq-regexp
+ buf-name display-buffer-bound-alist action))
;; Extra actions from the arguments to this function:
(extra-action
(cons nil (append (if inhibit-same-window
@@ -8405,9 +8427,9 @@ display-buffer
(if frame
`((reusable-frames . ,frame))))))
;; Construct action function list and action alist.
- (actions (list display-buffer-overriding-action
- user-action special-action action extra-action
- display-buffer-base-action
+ (actions (list display-buffer-overriding-action user-action
+ special-action bound-action action
+ extra-action display-buffer-base-action
display-buffer-fallback-action))
(functions (apply #'append
(mapcar (lambda (x)