summaryrefslogtreecommitdiff
path: root/lisp/icomplete.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-12-14 09:24:36 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-12-14 09:24:36 -0500
commitaa2bddd73d8359ad944fde7c424d2d89c0ccf0d9 (patch)
treeea48729c3004ca89943f882efdb5c8e652efb5a5 /lisp/icomplete.el
parent660efa1a1442306aa34378a5b0392075e9415d35 (diff)
downloademacs-aa2bddd73d8359ad944fde7c424d2d89c0ccf0d9.tar.gz
* lisp/icomplete.el (icomplete-completions): Make sure the prefix is already
displayed elsewhere before hiding it.
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r--lisp/icomplete.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 7620adb3c9c..fccb2644ccb 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -416,18 +416,22 @@ are exhibited within the square braces.)"
;; one line, increase the allowable space accordingly.
(/ prospects-len (window-width)))
(window-width)))
+ ;; Find the common prefix among `comps'.
+ ;; We can't use the optimization below because its assumptions
+ ;; aren't always true, e.g. when completion-cycling (bug#10850):
+ ;; (if (eq t (compare-strings (car comps) nil (length most)
+ ;; most nil nil completion-ignore-case))
+ ;; ;; Common case.
+ ;; (length most)
+ ;; Else, use try-completion.
(prefix (when icomplete-hide-common-prefix
(try-completion "" comps)))
(prefix-len
- ;; Find the common prefix among `comps'.
- ;; We can't use the optimization below because its assumptions
- ;; aren't always true, e.g. when completion-cycling (bug#10850):
- ;; (if (eq t (compare-strings (car comps) nil (length most)
- ;; most nil nil completion-ignore-case))
- ;; ;; Common case.
- ;; (length most)
- ;; Else, use try-completion.
- (and (stringp prefix) (length prefix))) ;;)
+ (and (stringp prefix)
+ ;; Only hide the prefix if the corresponding info
+ ;; is already displayed via `most'.
+ (string-prefix-p prefix most t)
+ (length prefix))) ;;)
prospects comp limit)
(if (or (eq most-try t) (not (consp (cdr comps))))
(setq prospects nil)