Emacs dedicated completion window

emacs

To prevent confusion, I only run one "window" of emacs and so I use window in the emacs sense. I'm looking to get a window split which, let's say 70 in width, contains the completions buffer on the new split when I start emacs. I think I need to have a dedicated window. What I'm basicly trying to achieve is the following.

 +-----+---+
 |     | A |
 |     |---|
 |  C  | B |
 +-----+---+

C = where I normally work.
A = the completion buffer (also I would like to have messages and everything that emacs throws at me there)
B = a shell.

I have now the following added for this purpose in my .emacs:

(split-window-horizontally)   ;; want two windows at startup 
(other-window 1)              ;; move to other window
(shell)                       ;; start a shell
(other-window 1)              ;; move back to first window 

I would like to split the right window another time vertically and I would like to be able to specify the dimensions of each window. Also, I would like to have the dedicated property of the completions, messages, … window (A) to be true so that emacs doesn't replace it.

I've heard that a lot of people use this setup but I can't seem to find it anywhere.

Best Answer

Eventually I was able to get what I wanted with the following in my .emacs file.

(progn
  (interactive)
  (split-window-horizontally)
  (other-window 1)
  (split-window)
  (other-window 1)
  (eshell)
  (other-window 1)) ;; finally change back to scratch window



;; open temporary buffers in a dedicated window split
(setq special-display-regexps
        '("^\\*Completions\\*$"
          "^\\*Help\\*$"
          "^\\*grep\\*$"
          "^\\*Apropos\\*$"
          "^\\*elisp macroexpansion\\*$"
          "^\\*local variables\\*$"
          "^\\*Compile-Log\\*$"
          "^\\*Quail Completions\\*$"
          "^\\*Occur\\*$"
          "^\\*frequencies\\*$"
          "^\\*compilation\\*$"
          "^\\*Locate\\*$"
          "^\\*Colors\\*$"
          "^\\*tumme-display-image\\*$"
          "^\\*SLIME Description\\*$"
          "^\\*.* output\\*$" ; tex compilation buffer
          "^\\*TeX Help\\*$"
          "^\\*Shell Command Output\\*$"
          "^\\*Async Shell Command\\*$"
          "^\\*Backtrace\\*$"))
(setq grb-temporary-window (nth 1 (window-list)))
(defun grb-special-display (buffer &optional data)
  (let ((window grb-temporary-window))
    (with-selected-window window
      (switch-to-buffer buffer)
      window)))
(setq special-display-function #'grb-special-display)

I found what I needed in this .emacs file on github.

https://github.com/garybernhardt/dotfiles/blob/master/.emacs

Related Question