emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112160: * lisp/minibuffer.el (comple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112160: * lisp/minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
Date: Wed, 27 Mar 2013 10:41:06 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112160
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14061
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-03-27 10:41:06 -0400
message:
  * lisp/minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
  and suffixes don't overlap.
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-27 14:33:03 +0000
+++ b/lisp/ChangeLog    2013-03-27 14:41:06 +0000
@@ -1,12 +1,12 @@
 2013-03-27  Stefan Monnier  <address@hidden>
 
+       * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
+       and suffixes don't overlap (bug#14061).
+
        * case-table.el: Use lexical-binding.
        (case-table-get-table): New function.
        (get-upcase-table): Use it.  Mark as obsolete.  Adjust callers.
 
-       * minibuffer.el (completion-pcm--merge-completions): Make sure prefixes
-       and suffixes don't overlap
-
 2013-03-27  Teodor Zlatanov  <address@hidden>
 
        * progmodes/subword.el: Add `superword-mode' to do word motion

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2013-03-05 07:38:16 +0000
+++ b/lisp/minibuffer.el        2013-03-27 14:41:06 +0000
@@ -2997,12 +2997,21 @@
                 ;; here any more.
                 (unless unique
                   (push elem res)
-                  (when (memq elem '(star point prefix))
-                    ;; Extract common suffix additionally to common prefix.
-                    ;; Only do it for `point', `star', and `prefix' since for
-                    ;; `any' it could lead to a merged completion that
-                    ;; doesn't itself match the candidates.
-                    (let ((suffix (completion--common-suffix comps)))
+                  ;; Extract common suffix additionally to common prefix.
+                  ;; Don't do it for `any' since it could lead to a merged
+                  ;; completion that doesn't itself match the candidates.
+                  (when (and (memq elem '(star point prefix))
+                             ;; If prefix is one of the completions, there's no
+                             ;; suffix left to find.
+                             (not (assoc-string prefix comps t)))
+                    (let ((suffix
+                           (completion--common-suffix
+                            (if (zerop (length prefix)) comps
+                              ;; Ignore the chars in the common prefix, so we
+                              ;; don't merge '("abc" "abbc") as "ab*bc".
+                              (let ((skip (length prefix)))
+                                (mapcar (lambda (str) (substring str skip))
+                                        comps))))))
                       (cl-assert (stringp suffix))
                       (unless (equal suffix "")
                         (push suffix res)))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]