Citation of my comment:
Did you really try M-x
(display-buffer "*Messages*")?? It works for me with your entry in
"*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
There are also occasions when
In that case your entries in
display-buffer-alist become relevant.
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
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.
(rx "SomeBufferName<" (one-or-more digit) ">") should do the job.
SomeBufferName with the name of the first buffer of this special kind.