aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-08-14 23:44:41 +0000
committerChong Yidong2008-08-14 23:44:41 +0000
commit7ce8dff29ae50c20982ffa2d15f0da9a7714229e (patch)
tree4d9a594205020842bb88e599c69cca25afebaa28
parent3c59150df6b5b930e6b3acfce66a0a2c9bcadaaf (diff)
downloademacs-7ce8dff29ae50c20982ffa2d15f0da9a7714229e.tar.gz
emacs-7ce8dff29ae50c20982ffa2d15f0da9a7714229e.zip
(completion-boundaries): Doc fix.
(display-completion-list): New arg BASE-SIZE, to specify an overriding base-size.
-rw-r--r--lisp/minibuffer.el29
1 files changed, 17 insertions, 12 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 28765b954ac..4b2b99de5e5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -73,7 +73,6 @@ SUFFIX is the string after point.
73The result is of the form (START . END) where START is the position 73The result is of the form (START . END) where START is the position
74in STRING of the beginning of the completion field and END is the position 74in STRING of the beginning of the completion field and END is the position
75in SUFFIX of the end of the completion field. 75in SUFFIX of the end of the completion field.
76I.e. START is the same as the `completion-base-size'.
77E.g. for simple completion tables, the result is always (0 . (length SUFFIX)) 76E.g. for simple completion tables, the result is always (0 . (length SUFFIX))
78and for file names the result is the positions delimited by 77and for file names the result is the positions delimited by
79the closest directory separators." 78the closest directory separators."
@@ -815,7 +814,7 @@ of the differing parts is, by contrast, slightly highlighted."
815 completions) 814 completions)
816 base-size)))) 815 base-size))))
817 816
818(defun display-completion-list (completions &optional common-substring) 817(defun display-completion-list (completions &optional common-substring base-size)
819 "Display the list of completions, COMPLETIONS, using `standard-output'. 818 "Display the list of completions, COMPLETIONS, using `standard-output'.
820Each element may be just a symbol or string 819Each element may be just a symbol or string
821or 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.
@@ -826,11 +825,15 @@ The actual completion alternatives, as inserted, are given `mouse-face'
826properties of `highlight'. 825properties of `highlight'.
827At the end, this runs the normal hook `completion-setup-hook'. 826At the end, this runs the normal hook `completion-setup-hook'.
828It can find the completion buffer in `standard-output'. 827It can find the completion buffer in `standard-output'.
829The obsolete optional second arg COMMON-SUBSTRING is a string. 828
830It is used to put faces, `completions-first-difference' and 829The optional arg COMMON-SUBSTRING, if non-nil, should be a string
831`completions-common-part' on the completion buffer. The 830specifying a common substring for adding the faces
832`completions-common-part' face is put on the common substring 831`completions-first-difference' and `completions-common-part' to
833specified by COMMON-SUBSTRING." 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."
834 (if common-substring 837 (if common-substring
835 (setq completions (completion-hilit-commonality 838 (setq completions (completion-hilit-commonality
836 completions (length common-substring)))) 839 completions (length common-substring))))
@@ -839,7 +842,7 @@ specified by COMMON-SUBSTRING."
839 (with-temp-buffer 842 (with-temp-buffer
840 (let ((standard-output (current-buffer)) 843 (let ((standard-output (current-buffer))
841 (completion-setup-hook nil)) 844 (completion-setup-hook nil))
842 (display-completion-list completions)) 845 (display-completion-list completions common-substring base-size))
843 (princ (buffer-string))) 846 (princ (buffer-string)))
844 847
845 (with-current-buffer standard-output 848 (with-current-buffer standard-output
@@ -849,15 +852,17 @@ specified by COMMON-SUBSTRING."
849 852
850 (insert "Possible completions are:\n") 853 (insert "Possible completions are:\n")
851 (let ((last (last completions))) 854 (let ((last (last completions)))
852 ;; Get the base-size from the tail of the list. 855 ;; If BASE-SIZE is unspecified, set it from the tail of the list.
853 (set (make-local-variable 'completion-base-size) (or (cdr last) 0)) 856 (set (make-local-variable 'completion-base-size)
857 (or base-size (cdr last) 0))
854 (setcdr last nil)) ;Make completions a properly nil-terminated list. 858 (setcdr last nil)) ;Make completions a properly nil-terminated list.
855 (completion--insert-strings completions)))) 859 (completion--insert-strings completions))))
856 860
857 ;; The hilit used to be applied via completion-setup-hook, so there 861 ;; The hilit used to be applied via completion-setup-hook, so there
858 ;; may still be some code that uses completion-common-substring. 862 ;; may still be some code that uses completion-common-substring.
859 (let ((completion-common-substring common-substring)) 863 (with-no-warnings
860 (run-hooks 'completion-setup-hook)) 864 (let ((completion-common-substring common-substring))
865 (run-hooks 'completion-setup-hook)))
861 nil) 866 nil)
862 867
863(defun minibuffer-completion-help () 868(defun minibuffer-completion-help ()