M-x view-echo-area-messages (bound to C-h e by default) is used to see the *Messages* buffer.
I would like to get the following behavior when I press C-h e:
- If the frame has just 1 window, split the frame to create a new window and show *Messages* in that new window.
- If the frame already has 2 or more windows, display *Messages* in the other window (not the current one).
- If the current window is already displaying *Messages* buffer, do NOT do anything (I tend to press
C-h eby mistake even when I am in the *Messages* buffer).
I am able to achieve points 1 and 2 above using the below:
;; Control where the *Messages* buffer opens (add-to-list 'display-buffer-alist '("\\*Messages\\*" . ((display-buffer-reuse-window display-buffer-pop-up-window) . ((inhibit-same-window . t))))) But with the above elisp snippet, if I am already in a window with *Messages* and if I do C-h e, it pops up another window displaying the same buffer.
I basically need emacs to ignore (inhibit-same-window . t) if the current buffer matches "\\*Messages\\*". How do I do it?