help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Completion window location


From: martin rudalics
Subject: Re: Completion window location
Date: Thu, 01 Nov 2012 18:59:08 +0100

> When emacs is set to fullscreen-mode (or even when it is just a little
> wider than square) or if I have the frame split horizontally, the
> completions buffer takes over one of those frames temporarily. It is
> still useful, but my eyes have to crawl all the way up to the top of
> the screen to read the first completion candidates, then back down to
> the minibuffer, ad nauseum.
>
> I usually use emacs with a fullscreen frame, split horizontally into
> two big windows. How can Emacs be persuaded to use a short, temporary
> frame just above the minibuffer to show candidates? I rarely need
> space to see 50-100 completion candidates at once, and if I did, I
> would use some search refining or some such. I have some familiarity
> with with Emacs lisp, but I haven't not much hacking and I'm not very
> familiar with Emacs internals.

I'm currently trying to write a function to do that.  The following is a
first stab.

(defun display-buffer-at-bottom-left (buffer alist)
  "Try displaying BUFFER in a window at the bottom-left corner of the selected 
frame."
  (or (display-buffer-reuse-window buffer alist)
      (let ((bottom-window
             (let ((bottom-edge (nth 3 (window-edges (frame-root-window)))))
               (catch 'window
                 (walk-window-tree
                  (lambda (window)
                    (when (= (nth 3 (window-edges window))
                             bottom-edge)
                      (throw 'window window)))))))
            window)
        (or (and (not (frame-parameter nil 'unsplittable))
                 (setq window (window--try-to-split-window bottom-window alist))
                 (window--display-buffer
                  buffer window 'window alist display-buffer-mark-dedicated))
            (and (not (frame-parameter nil 'unsplittable))
                 (setq window
                       (condition-case nil
                           (split-window (frame-root-window))
                         (error nil)))
                 (window--display-buffer
                  buffer window 'window alist display-buffer-mark-dedicated))
            (and (setq window bottom-window)
                 (not (window-dedicated-p window))
                 (window--display-buffer
                  buffer window 'reuse alist display-buffer-mark-dedicated))))))

You have to customize `display-buffer-alist' to add a rule that achieves

(customize-set-variable
 'display-buffer-alist '(("*Completions*" display-buffer-at-bottom-left)))

for this to take effect.

martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]