Closed grtcdr closed 1 year ago
borg--build-interactive
calls pop-to-buffer-same-window
, which just calls pop-to-buffer
while specifying an ACTION. That calls display-buffer
, passing ACTION along, and if, and only if, that returns a window, it additionally selects that.
The docstring of display-buffer
contains (emphasis mine):
display-buffer
builds a list of action functions and an action alist by combining any action functions and alists specified bydisplay-buffer-overriding-action
,display-buffer-alist
, the ACTION argument,display-buffer-base-action
, anddisplay-buffer-fallback-action
(in order).
So display-buffer-alist
overrides the ACTION argument, rendering your request moot. Your goal can be accomplished without requiring any changes to Borg.
Your second approach won't work in this case because the mode is set after displaying the buffer. (That may be something I should change.)
The problem with your first approach is that specifying the "do nothing" action is not enough. Additionally you have to specify that it is okay for an action to do nothing: :stuck_out_tongue_winking_eye:, i.e.:
(setq display-buffer-alist
'(("\\`\\*Borg Build\\*\\'"
display-buffer-no-window
(allow-no-window . t))))
Thanks for that eye-opening explanation and for the solution. It worked for me :)
That may be something I should change
That would be a very welcome change, actually, since cons cells are much more readable (to me at least).
The major-mode is now set before the buffer is displayed.
Thanks for that.
You're welcome!
Hi Jonas,
Many of us use
display-buffer-alist
to modify the placement of our windows. I expected I'd be able to hide*Borg Build*
buffers [^1], but that doesn't work with either of the following configurations:I expect this is happening because
borg--build-interactive
isn't directly usingdisplay-buffer
but other buffer display functions that hardcode its window placement. Would you be open to relying ondisplay-buffer
instead?Thank you for your time and work,
[^1]: It's unlikely that I'd shutdown Emacs while the process is still running, and even then, Emacs will warn me in the presence of a running process or an unsaved buffer because I've configured the user service to shutdown via
(save-buffers-kill-emacs)
.