Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Emacs, how do I change the minibuffer completion list window?

Tags:

emacs

elisp

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.

like image 967
Nick Bolton Avatar asked May 22 '09 23:05

Nick Bolton


People also ask

How do I access Minibuffer Emacs?

The simplest way to enter a minibuffer argument is to type the text you want, terminated by RET which exits the minibuffer. You can cancel the command that wants the argument, and get out of the minibuffer, by typing C-g .

What is Emacs minibuffer?

The minibuffer is where Emacs commands read complicated arguments, such as file names, buffer names, Emacs command names, or Lisp expressions. We call it the “minibuffer” because it's a special-purpose buffer with a small amount of screen space.


1 Answers

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*.

like image 86
Trey Jackson Avatar answered Sep 22 '22 12:09

Trey Jackson