Citation of my comment:
Did you really try M-x (display-buffer "*Messages*")
?? It works for me with your entry in display-buffer-alist
and "*flycheck errors*"
replaced by "*Messages*"
! Could it be that you tried switch-to-buffer
instead and expected the same effects as for display-buffer
? They behave differently (at least for me).
And @bertfred's answer:
That was the problem. I have a custom function that displays the message buffer. However it works with eshell when I use
(defun switch-to-eshell () (interactive) (switch-to-buffer (eshell)))
eshell
generates the buffer and shows it with pop-to-buffer-same-window
which in turn calls pop-to-buffer
and this calls display-buffer
.
There are also occasions when switch-to-buffer
calls pop-to-buffer
.
In that case your entries in display-buffer-alist
become relevant.
But normally, switch-to-buffer
uses just the low-level routine set-buffer
where the entries in display-buffer-alist
are irrelevant.
Relevant citation from the help of switch-to-buffer
:
If the selected window cannot display the specified buffer
because it is a minibuffer window or strongly dedicated to
another buffer, call ‘pop-to-buffer’ to select the buffer in
another window. In interactive use, if the selected window is
strongly dedicated to its buffer, the value of the option
‘switch-to-buffer-in-dedicated-window’ specifies how to proceed.
You also asked:
And is it also possible to configure the display for buffers, that are opened by specific commands ? One example is shell-mode. When I open a new shell buffer, with another one already existing, my display modifications don't work because the name of the buffer is different.
The documentation of generate-new-buffer-name
describes how unique buffernames are generated:
generate-new-buffer-name is a built-in function in ‘C source code’.
(generate-new-buffer-name NAME &optional IGNORE)
Return a string that is the name of no existing buffer based on NAME.
If there is no live buffer named NAME, then return NAME.
Otherwise modify name by appending ‘<NUMBER>’
, incrementing NUMBER
(starting at 2) until an unused name is found, and then return that name.
Optional second argument IGNORE specifies a name that is okay to use (if
it is in the sequence to be tried) even if a buffer with that name exists.
If NAME begins with a space (i.e., a buffer that is not normally
visible to users), then if buffer NAME already exists a random number
is first appended to NAME, to speed up finding a non-existent buffer.
So (rx "SomeBufferName<" (one-or-more digit) ">")
should do the job.
Just replace SomeBufferName
with the name of the first buffer of this special kind.
"\\backtick\\*Flycheck errors\\*\\'"
and are you do the same thing for the*Messages*
buffer? It doesn't like like a correct regexp from my perspective, but I could be wrong? How about something simple like\\*flyckeck errors\\*
or[*]flyckeck errors[*]
re-builder
to test your regexp and it did not highlight*Flycheck errors*
, so I really have no idea how that regexp can work. In terms of why something works somewhere, but does not work elsewhere, it would help to know what it is that you expect to happen. It is possible that people looking at your code will draw a picture in their own mind, but it may help to spell it out for those of us who would like to help but would prefer not to guess -- just in case your code does always do what you expect to have occur.rx
. This is a regular expression in sexp form not a regular expression as string! The string"*Flycheck errors*"
is taken literally.rx
takes care of the escaping.M-x (display-buffer "*Messages*")
?? It works for me with your entry indisplay-buffer-alist
and"*flycheck errors*"
replaced by"*Messages*"
! Could it be that you triedswitch-to-buffer
instead and expected the same effects as fordisplay-buffer
? They behave differently (at least for me).