aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-03-27 10:41:06 -0400
committerStefan Monnier2013-03-27 10:41:06 -0400
commitb1da29572e811d18ee5f200a28192ea2f58ff9bf (patch)
tree2dce39700f324490ddcfb2bd2a11167bc10f82d7
parentf557c1b1a9b24212728bf27027f0d0cc1d9bbecb (diff)
downloademacs-b1da29572e811d18ee5f200a28192ea2f58ff9bf.tar.gz
emacs-b1da29572e811d18ee5f200a28192ea2f58ff9bf.zip
* lisp/minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
and suffixes don't overlap. Fixes: debbugs:14061
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/minibuffer.el21
2 files changed, 18 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 40b7cb011ae..fecad470900 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,12 +1,12 @@
12013-03-27 Stefan Monnier <monnier@iro.umontreal.ca> 12013-03-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
4 and suffixes don't overlap (bug#14061).
5
3 * case-table.el: Use lexical-binding. 6 * case-table.el: Use lexical-binding.
4 (case-table-get-table): New function. 7 (case-table-get-table): New function.
5 (get-upcase-table): Use it. Mark as obsolete. Adjust callers. 8 (get-upcase-table): Use it. Mark as obsolete. Adjust callers.
6 9
7 * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
8 and suffixes don't overlap
9
102013-03-27 Teodor Zlatanov <tzz@lifelogs.com> 102013-03-27 Teodor Zlatanov <tzz@lifelogs.com>
11 11
12 * progmodes/subword.el: Add `superword-mode' to do word motion 12 * progmodes/subword.el: Add `superword-mode' to do word motion
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ec237f0f664..016b16d0740 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2997,12 +2997,21 @@ the same set of elements."
2997 ;; here any more. 2997 ;; here any more.
2998 (unless unique 2998 (unless unique
2999 (push elem res) 2999 (push elem res)
3000 (when (memq elem '(star point prefix)) 3000 ;; Extract common suffix additionally to common prefix.
3001 ;; Extract common suffix additionally to common prefix. 3001 ;; Don't do it for `any' since it could lead to a merged
3002 ;; Only do it for `point', `star', and `prefix' since for 3002 ;; completion that doesn't itself match the candidates.
3003 ;; `any' it could lead to a merged completion that 3003 (when (and (memq elem '(star point prefix))
3004 ;; doesn't itself match the candidates. 3004 ;; If prefix is one of the completions, there's no
3005 (let ((suffix (completion--common-suffix comps))) 3005 ;; suffix left to find.
3006 (not (assoc-string prefix comps t)))
3007 (let ((suffix
3008 (completion--common-suffix
3009 (if (zerop (length prefix)) comps
3010 ;; Ignore the chars in the common prefix, so we
3011 ;; don't merge '("abc" "abbc") as "ab*bc".
3012 (let ((skip (length prefix)))
3013 (mapcar (lambda (str) (substring str skip))
3014 comps))))))
3006 (cl-assert (stringp suffix)) 3015 (cl-assert (stringp suffix))
3007 (unless (equal suffix "") 3016 (unless (equal suffix "")
3008 (push suffix res))))) 3017 (push suffix res)))))