all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: jasonsewall@gmail.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Completion window location
Date: Thu, 01 Nov 2012 18:59:08 +0100	[thread overview]
Message-ID: <5092B86C.6060905@gmx.at> (raw)

 > 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	other threads:[~2012-11-01 17:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-01 17:59 martin rudalics [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-10-30 17:11 Completion window location Jason Sewall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5092B86C.6060905@gmx.at \
    --to=rudalics@gmx.at \
    --cc=help-gnu-emacs@gnu.org \
    --cc=jasonsewall@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.