7

I would like to set a specific window for the minibuffer completion list. Currently, I have 3 windows in this configuration:

 ______
|    | |
|____| |
|____|_|

In this case, I'd like to use the bottom left window for the minibuffer completion list.

Currently, it seems to a window at random, and most of the time it likes to use the far right window, which is too thin to show the completion list without me having to scroll horizontally, which is irritating.

Also, I'm using a lisp script called revive.el to restore my window configuration from a file (~/.revive.el) when I load Emacs.

Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
  • It appears to be the least recently used window... – Trey Jackson May 22 '09 at 23:45
  • Hmm, I'm not sure - it doesn't seem to be that predictable for me... Some times, it likes to use the bottom left, but it resizes it to half the screen height; which is annoying since I like to have lots of space for editing code in the top left. – Nick Bolton May 23 '09 at 19:03
  • Note quite what the OP wants, but completions buffer can be made to appear in a dedicated window by using Tomohiro Matsuyama's popwin.el: https://github.com/m2ym/popwin-el – Leo Alekseyev Feb 06 '14 at 06:59

3 Answers3

10

After starting down the path of trying to use minibuffer-scroll-window (which turns out to not be user customizable). I tried this approach:

(add-to-list 'special-display-buffer-names '("*Completions*" my-display-completions))

(defun my-display-completions (buf)
  "put the *completions* buffer in the right spot"
  (let ((windows (delete (minibuffer-window) (window-list))))
    (if (eq 1 (length windows))
        (progn 
          (select-window (car windows))
          (split-window-vertically)))
    (let ((target-window (window-at 0 (- (frame-height) 2)))
          (pop-up-windows t))
      (set-window-buffer target-window buf)
      target-window)))

This works by splitting the sole window in two and displaying *Completions* in the bottom window, or, if there are already 2 or more windows shown, using the bottom-left window to show the *Completions*.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
1

A slightly cheating answer that may do what you want:

Manually make the bottom left window the *Completions* buffer using

C-x b *Completions* RET

when the cursor is active in that window. Then whenever the minibuffer has to display some completions it should always use this particular window. However, this will rely on this buffer staying open and visible all the time - probably not quite what you want?

Other possibilities:

  1. See if "Icicles" helps - e.g. it mentions "There are lots of Icicles features that enhance the display and behavior of ‘*Completions*’".
  2. Minibuffer Commands That Do Completion may be useful?
luapyad
  • 3,860
  • 26
  • 20
  • I've tried both but I can't seem to get them to remember the window to be used for the *Completions* buffer. Thanks anyway! – Nick Bolton May 25 '09 at 16:33
  • Oh, also, yes, I aware that changing the buffer for a window is a way of fixing the issue - but as you probably know, it's temporary. When I press tab on the minibuffer next time, it doesn't use the window that it used last. Quite frustrating. – Nick Bolton May 25 '09 at 16:35
0

Not as robust as Trey's answer, but also seems to work in a crude manner.

; Go to the 3rd window, and make it dedicated.
(other-window 2)
(set-window-dedicated-p (selected-window) 1)

This only works if you don't mind the 3rd window being locked. Unfortunately it will still try and use the 1st window from time to time (which is less frustrating, but still undesirable).

Note: I just tried Trey's solution and it worked now, so I recommend people use that.

Nick Bolton
  • 38,276
  • 70
  • 174
  • 242