comparison lisp/comint.el @ 46250:2c383709a149

(comint-dynamic-list-completions): Sort COMPLETIONS before first use.
author Miles Bader <miles@gnu.org>
date Mon, 08 Jul 2002 08:45:00 +0000
parents c1c7a7405444
children 1241ed1e9eee
comparison
equal deleted inserted replaced
46249:54c4053e954f 46250:2c383709a149
2805 2805
2806 (defun comint-dynamic-list-completions (completions) 2806 (defun comint-dynamic-list-completions (completions)
2807 "List in help buffer sorted COMPLETIONS. 2807 "List in help buffer sorted COMPLETIONS.
2808 Typing SPC flushes the help buffer." 2808 Typing SPC flushes the help buffer."
2809 (let ((window (get-buffer-window "*Completions*"))) 2809 (let ((window (get-buffer-window "*Completions*")))
2810 (setq completions (sort completions 'string-lessp))
2810 (if (and (eq last-command this-command) 2811 (if (and (eq last-command this-command)
2811 window (window-live-p window) (window-buffer window) 2812 window (window-live-p window) (window-buffer window)
2812 (buffer-name (window-buffer window)) 2813 (buffer-name (window-buffer window))
2813 ;; The above tests are not sufficient to detect the case where we 2814 ;; The above tests are not sufficient to detect the case where we
2814 ;; should scroll, because the top-level interactive command may 2815 ;; should scroll, because the top-level interactive command may
2831 (select-window window) 2832 (select-window window)
2832 (scroll-up)))) 2833 (scroll-up))))
2833 2834
2834 (let ((conf (current-window-configuration))) 2835 (let ((conf (current-window-configuration)))
2835 (with-output-to-temp-buffer "*Completions*" 2836 (with-output-to-temp-buffer "*Completions*"
2836 (display-completion-list (sort completions 'string-lessp))) 2837 (display-completion-list completions))
2837 (message "Type space to flush; repeat completion command to scroll") 2838 (message "Type space to flush; repeat completion command to scroll")
2838 (let (key first) 2839 (let (key first)
2839 (if (save-excursion 2840 (if (save-excursion
2840 (set-buffer (get-buffer "*Completions*")) 2841 (set-buffer (get-buffer "*Completions*"))
2841 (set (make-local-variable 2842 (set (make-local-variable