diff options
| author | Miles Bader | 2002-07-04 06:44:45 +0000 |
|---|---|---|
| committer | Miles Bader | 2002-07-04 06:44:45 +0000 |
| commit | 9669f2d6d54b0e6835a01ef3b0ac462e36e09859 (patch) | |
| tree | 4a752e4ff1d4dab0bc501abc36860aca8b56b872 | |
| parent | 95b5b933937c406e283fd32600d8438705e6ba83 (diff) | |
| download | emacs-9669f2d6d54b0e6835a01ef3b0ac462e36e09859.tar.gz emacs-9669f2d6d54b0e6835a01ef3b0ac462e36e09859.zip | |
(comint-displayed-dynamic-completions): New variable.
(comint-dynamic-list-completions): Be more careful about choosing
when to scroll an existing completions window.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/comint.el | 21 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 28847f723be..b47761de024 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2002-07-04 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * comint.el (comint-displayed-dynamic-completions): New variable. | ||
| 4 | (comint-dynamic-list-completions): Be more careful about choosing | ||
| 5 | when to scroll an existing completions window. | ||
| 6 | |||
| 1 | 2002-07-03 Andreas Schwab <schwab@suse.de> | 7 | 2002-07-03 Andreas Schwab <schwab@suse.de> |
| 2 | 8 | ||
| 3 | * net/tramp.el (tramp-handle-ange-ftp): Move interactive spec | 9 | * net/tramp.el (tramp-handle-ange-ftp): Move interactive spec |
diff --git a/lisp/comint.el b/lisp/comint.el index bdbe2fdb709..3c0be25c199 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -2798,13 +2798,29 @@ See also `comint-dynamic-complete-filename'." | |||
| 2798 | (mapcar 'comint-quote-filename completions))))) | 2798 | (mapcar 'comint-quote-filename completions))))) |
| 2799 | 2799 | ||
| 2800 | 2800 | ||
| 2801 | ;; This is bound locally in a *Completions* buffer to the list of | ||
| 2802 | ;; completions displayed, and is used to detect the case where the same | ||
| 2803 | ;; command is repeatedly used without the set of completions changing. | ||
| 2804 | (defvar comint-displayed-dynamic-completions nil) | ||
| 2805 | |||
| 2801 | (defun comint-dynamic-list-completions (completions) | 2806 | (defun comint-dynamic-list-completions (completions) |
| 2802 | "List in help buffer sorted COMPLETIONS. | 2807 | "List in help buffer sorted COMPLETIONS. |
| 2803 | Typing SPC flushes the help buffer." | 2808 | Typing SPC flushes the help buffer." |
| 2804 | (let ((window (get-buffer-window "*Completions*"))) | 2809 | (let ((window (get-buffer-window "*Completions*"))) |
| 2805 | (if (and (eq last-command this-command) | 2810 | (if (and (eq last-command this-command) |
| 2806 | window (window-live-p window) (window-buffer window) | 2811 | window (window-live-p window) (window-buffer window) |
| 2807 | (buffer-name (window-buffer window))) | 2812 | (buffer-name (window-buffer window)) |
| 2813 | ;; The above tests are not sufficient to detect the case where we | ||
| 2814 | ;; should scroll, because the top-level interactive command may | ||
| 2815 | ;; not have displayed a completions window the last time it was | ||
| 2816 | ;; invoked, and there may be such a window left over from a | ||
| 2817 | ;; previous completion command with a different set of | ||
| 2818 | ;; completions. To detect that case, we also test that the set | ||
| 2819 | ;; of displayed completions is in fact the same as the previously | ||
| 2820 | ;; displayed set. | ||
| 2821 | (equal completions | ||
| 2822 | (buffer-local-value 'comint-displayed-dynamic-completions | ||
| 2823 | (window-buffer window)))) | ||
| 2808 | ;; If this command was repeated, and | 2824 | ;; If this command was repeated, and |
| 2809 | ;; there's a fresh completion window with a live buffer, | 2825 | ;; there's a fresh completion window with a live buffer, |
| 2810 | ;; and this command is repeated, scroll that window. | 2826 | ;; and this command is repeated, scroll that window. |
| @@ -2822,6 +2838,9 @@ Typing SPC flushes the help buffer." | |||
| 2822 | (let (key first) | 2838 | (let (key first) |
| 2823 | (if (save-excursion | 2839 | (if (save-excursion |
| 2824 | (set-buffer (get-buffer "*Completions*")) | 2840 | (set-buffer (get-buffer "*Completions*")) |
| 2841 | (set (make-local-variable | ||
| 2842 | 'comint-displayed-dynamic-completions) | ||
| 2843 | completions) | ||
| 2825 | (setq key (read-key-sequence nil) | 2844 | (setq key (read-key-sequence nil) |
| 2826 | first (aref key 0)) | 2845 | first (aref key 0)) |
| 2827 | (and (consp first) (consp (event-start first)) | 2846 | (and (consp first) (consp (event-start first)) |