emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/comint.el


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/comint.el
Date: Thu, 04 Jul 2002 02:44:34 -0400

Index: emacs/lisp/comint.el
diff -c emacs/lisp/comint.el:1.279 emacs/lisp/comint.el:1.280
*** emacs/lisp/comint.el:1.279  Thu Jun 20 03:30:04 2002
--- emacs/lisp/comint.el        Thu Jul  4 02:44:34 2002
***************
*** 2798,2810 ****
         (mapcar 'comint-quote-filename completions)))))
  
  
  (defun comint-dynamic-list-completions (completions)
    "List in help buffer sorted COMPLETIONS.
  Typing SPC flushes the help buffer."
    (let ((window (get-buffer-window "*Completions*")))
      (if (and (eq last-command this-command)
             window (window-live-p window) (window-buffer window)
!            (buffer-name (window-buffer window)))
        ;; If this command was repeated, and
        ;; there's a fresh completion window with a live buffer,
        ;; and this command is repeated, scroll that window.
--- 2798,2826 ----
         (mapcar 'comint-quote-filename completions)))))
  
  
+ ;; This is bound locally in a *Completions* buffer to the list of
+ ;; completions displayed, and is used to detect the case where the same
+ ;; command is repeatedly used without the set of completions changing.
+ (defvar comint-displayed-dynamic-completions nil)
+ 
  (defun comint-dynamic-list-completions (completions)
    "List in help buffer sorted COMPLETIONS.
  Typing SPC flushes the help buffer."
    (let ((window (get-buffer-window "*Completions*")))
      (if (and (eq last-command this-command)
             window (window-live-p window) (window-buffer window)
!            (buffer-name (window-buffer window))
!            ;; The above tests are not sufficient to detect the case where we
!            ;; should scroll, because the top-level interactive command may
!            ;; not have displayed a completions window the last time it was
!            ;; invoked, and there may be such a window left over from a
!            ;; previous completion command with a different set of
!            ;; completions.  To detect that case, we also test that the set
!            ;; of displayed completions is in fact the same as the previously
!            ;; displayed set.
!            (equal completions
!                   (buffer-local-value 'comint-displayed-dynamic-completions
!                                       (window-buffer window))))
        ;; If this command was repeated, and
        ;; there's a fresh completion window with a live buffer,
        ;; and this command is repeated, scroll that window.
***************
*** 2822,2827 ****
--- 2838,2846 ----
        (let (key first)
          (if (save-excursion
                (set-buffer (get-buffer "*Completions*"))
+               (set (make-local-variable
+                     'comint-displayed-dynamic-completions)
+                    completions)
                (setq key (read-key-sequence nil)
                      first (aref key 0))
                (and (consp first) (consp (event-start first))



reply via email to

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