]> git.eshelyaron.com Git - emacs.git/commitdiff
(pcomplete-show-completions): Improve last change, so
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 Mar 2007 19:57:10 +0000 (19:57 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 Mar 2007 19:57:10 +0000 (19:57 +0000)
as not to use an invisible window and to create a window if none exist.

lisp/pcomplete.el

index 6caffddaa01c67a14227cb6e66f2a71fdab34656..c4840059f64dc8d3c58d0d1d33a766188bda7358 100644 (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))
-                 (if (pos-visible-in-window-p (point-max))
-                     (goto-char (point-min))
-                   (scroll-up)))
+                (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))))
                (message ""))
               (t
                (setq unread-command-events (list event))