aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-08-15 00:10:03 +0000
committerChong Yidong2008-08-15 00:10:03 +0000
commit7bc7f64d75bf3835a048c0bdec2957691b7bb2ad (patch)
treea7c479ff227f8b2d4f03837cb4622c98c0acc795
parentb6bb817d396008f697a19e44c92b80fa8f0e445c (diff)
downloademacs-7bc7f64d75bf3835a048c0bdec2957691b7bb2ad.tar.gz
emacs-7bc7f64d75bf3835a048c0bdec2957691b7bb2ad.zip
(display-completion-list): Revert last change. Only default base-size
to zero if completing in the minibuffer.
-rw-r--r--lisp/minibuffer.el35
1 files changed, 16 insertions, 19 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 4b2b99de5e5..6d7c331db87 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -814,7 +814,7 @@ of the differing parts is, by contrast, slightly highlighted."
814 completions) 814 completions)
815 base-size)))) 815 base-size))))
816 816
817(defun display-completion-list (completions &optional common-substring base-size) 817(defun display-completion-list (completions &optional common-substring)
818 "Display the list of completions, COMPLETIONS, using `standard-output'. 818 "Display the list of completions, COMPLETIONS, using `standard-output'.
819Each element may be just a symbol or string 819Each element may be just a symbol or string
820or may be a list of two strings to be printed as if concatenated. 820or may be a list of two strings to be printed as if concatenated.
@@ -829,11 +829,7 @@ It can find the completion buffer in `standard-output'.
829The optional arg COMMON-SUBSTRING, if non-nil, should be a string 829The optional arg COMMON-SUBSTRING, if non-nil, should be a string
830specifying a common substring for adding the faces 830specifying a common substring for adding the faces
831`completions-first-difference' and `completions-common-part' to 831`completions-first-difference' and `completions-common-part' to
832the completions buffer. 832the completions buffer."
833
834The optional arg BASE-SIZE, if non-nil, which should be an
835integer that specifies the value of `completion-base-size' for
836the completion buffer."
837 (if common-substring 833 (if common-substring
838 (setq completions (completion-hilit-commonality 834 (setq completions (completion-hilit-commonality
839 completions (length common-substring)))) 835 completions (length common-substring))))
@@ -842,21 +838,22 @@ the completion buffer."
842 (with-temp-buffer 838 (with-temp-buffer
843 (let ((standard-output (current-buffer)) 839 (let ((standard-output (current-buffer))
844 (completion-setup-hook nil)) 840 (completion-setup-hook nil))
845 (display-completion-list completions common-substring base-size)) 841 (display-completion-list completions common-substring))
846 (princ (buffer-string))) 842 (princ (buffer-string)))
847 843
848 (with-current-buffer standard-output 844 (let ((mainbuf (current-buffer)))
849 (goto-char (point-max)) 845 (with-current-buffer standard-output
850 (if (null completions) 846 (goto-char (point-max))
851 (insert "There are no possible completions of what you have typed.") 847 (if (null completions)
852 848 (insert "There are no possible completions of what you have typed.")
853 (insert "Possible completions are:\n") 849 (insert "Possible completions are:\n")
854 (let ((last (last completions))) 850 (let ((last (last completions)))
855 ;; If BASE-SIZE is unspecified, set it from the tail of the list. 851 ;; Set base-size from the tail of the list.
856 (set (make-local-variable 'completion-base-size) 852 (set (make-local-variable 'completion-base-size)
857 (or base-size (cdr last) 0)) 853 (or (cdr last)
858 (setcdr last nil)) ;Make completions a properly nil-terminated list. 854 (and (minibufferp mainbuf) 0)))
859 (completion--insert-strings completions)))) 855 (setcdr last nil)) ; Make completions a properly nil-terminated list.
856 (completion--insert-strings completions)))))
860 857
861 ;; The hilit used to be applied via completion-setup-hook, so there 858 ;; The hilit used to be applied via completion-setup-hook, so there
862 ;; may still be some code that uses completion-common-substring. 859 ;; may still be some code that uses completion-common-substring.