1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-17 10:06:13 +00:00

(pcomplete-show-completions): Improve last change, so

as not to use an invisible window and to create a window if none exist.
This commit is contained in:
Stefan Monnier 2007-03-05 19:57:10 +00:00
parent 86a3e45eea
commit eb69fe3e0a

View File

@ -974,18 +974,20 @@ Typing SPC flushes the help buffer."
(while (with-current-buffer (get-buffer "*Completions*")
(setq event (pcomplete-read-event)))
(cond
((event-matches-key-specifier-p event ? )
((event-matches-key-specifier-p event ?\s)
(set-window-configuration pcomplete-last-window-config)
(setq pcomplete-last-window-config nil)
(throw 'done nil))
((or (event-matches-key-specifier-p event 'tab)
;; Needed on a terminal
(event-matches-key-specifier-p event 9))
(save-selected-window
(select-window (get-buffer-window "*Completions*" t))
(let ((win (or (get-buffer-window "*Completions*" 0)
(display-buffer "*Completions*"
'not-this-window))))
(with-selected-window win
(if (pos-visible-in-window-p (point-max))
(goto-char (point-min))
(scroll-up)))
(scroll-up))))
(message ""))
(t
(setq unread-command-events (list event))