* lisp/subr.el (buffer-match-p): New this-command cons cell
condition to implement new this-command buffer display action
alist entry (bug#78082).
* lisp/window.el (display-buffer):
* doc/lispref/windows.texi (Buffer Display Action Alists):
* etc/NEWS: Document the new buffer display action alist entry.
(cherry picked from commit
343f0c44f35c41b93c66f67da0ddeceb98bbdb93)
@var{symbol} as the category when calling @code{display-buffer}, users
can customize how these buffers will be displayed by including such an
entry in @code{display-buffer-alist}.
+
+@vindex this-command@r{, a buffer display action alist entry}
+@item this-command
+The value is a symbol naming a command or a list of such symbols. It
+means the condition when that command, or any of those commands, are now
+being executed. You can use this in the condition part of
+@code{display-buffer-alist} entries to match buffers displayed during
+the execution of particular commands.
@end table
By convention, the entries @code{window-height}, @code{window-width}
the buffer matches if the caller of `display-buffer' provides
`(category . SYMBOL)' in its ACTION argument, and SYMBOL is `eq'
to the cons-cell's cdr.
+ * `this-command': the buffer matches if the command now being executed
+ is `eq' to or a `memq' of the cons-cell's cdr.
+ (This case is not useful when calling `buffer-match-p' directly, but
+ is needed to support the `this-command' buffer display action alist
+ entry. See `display-buffer'.)
* `not': the cadr is interpreted as a negation of a condition.
* `and': the cdr is a list of recursive conditions, that all have
to be met.
(if args nil '(nil)))))))
(`(category . ,category)
(eq (alist-get 'category (cdar args)) category))
+ (`(this-command . ,command-or-commands)
+ (if (listp command-or-commands)
+ (memq this-command command-or-commands)
+ (eq this-command command-or-commands)))
(`(major-mode . ,mode)
(eq
(buffer-local-value 'major-mode buffer)
`(category . symbol)' in its action argument, then you can match
the displayed buffer by using the same category in the condition
part of `display-buffer-alist' entries.
+ `this-command' -- A symbol naming the command now being executed, or a
+ list of such symbols to mean the condition when any of those commands
+ are now being executed.
+ You can use this in the condition part of `display-buffer-alist'
+ entries to match buffers displayed by particular commands.
The entries `window-height', `window-width', `window-size' and
`preserve-size' are applied only when the window used for