aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-08-15 12:10:39 -0400
committerStefan Monnier2011-08-15 12:10:39 -0400
commit934eacb93d0b8340a3a8b478deaa6110a3de083f (patch)
treefb972284b12cb7ee09fd7ad5b533b6ddaea09610
parentce57c2fe307e2d866ff0a3c8e3cb4dcd722c4da1 (diff)
downloademacs-934eacb93d0b8340a3a8b478deaa6110a3de083f.tar.gz
emacs-934eacb93d0b8340a3a8b478deaa6110a3de083f.zip
* lisp/minibuffer.el (completion-pcm--merge-completions): Don't merge "a1b"
and "a2b" to "ab" for `prefix'.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/minibuffer.el20
2 files changed, 22 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b9459a4cfdd..7116a152605 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-08-15 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * minibuffer.el (completion-pcm--merge-completions): Don't merge "a1b"
4 and "a2b" to "ab" for `prefix'.
5
12011-08-14 Chong Yidong <cyd@stupidchicken.com> 62011-08-14 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * ibuf-ext.el (ibuffer-filter-disable): New arg for deleting 8 * ibuf-ext.el (ibuffer-filter-disable): New arg for deleting
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0a2774de572..313298de97e 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2299,7 +2299,7 @@ the commands start with a \"-\" or a SPC."
2299(defun completion-pcm--string->pattern (string &optional point) 2299(defun completion-pcm--string->pattern (string &optional point)
2300 "Split STRING into a pattern. 2300 "Split STRING into a pattern.
2301A pattern is a list where each element is either a string 2301A pattern is a list where each element is either a string
2302or a symbol chosen among `any', `star', `point', `prefix'." 2302or a symbol, see `completion-pcm--merge-completions'."
2303 (if (and point (< point (length string))) 2303 (if (and point (< point (length string)))
2304 (let ((prefix (substring string 0 point)) 2304 (let ((prefix (substring string 0 point))
2305 (suffix (substring string point))) 2305 (suffix (substring string point)))
@@ -2515,7 +2515,19 @@ filter out additional entries (because TABLE migth not obey PRED)."
2515 (mapcar 'completion--sreverse strs)))) 2515 (mapcar 'completion--sreverse strs))))
2516 2516
2517(defun completion-pcm--merge-completions (strs pattern) 2517(defun completion-pcm--merge-completions (strs pattern)
2518 "Extract the commonality in STRS, with the help of PATTERN." 2518 "Extract the commonality in STRS, with the help of PATTERN.
2519PATTERN can contain strings and symbols chosen among `star', `any', `point',
2520and `prefix'. They all match anything (aka \".*\") but are merged differently:
2521`any' only grows from the left (when matching \"a1b\" and \"a2b\" it gets
2522 completed to just \"a\").
2523`prefix' only grows from the right (when matching \"a1b\" and \"a2b\" it gets
2524 completed to just \"b\").
2525`star' grows from both ends and is reified into a \"*\" (when matching \"a1b\"
2526 and \"a2b\" it gets completed to \"a*b\").
2527`point' is like `star' except that it gets reified as the position of point
2528 instead of being reified as a \"*\" character.
2529The underlying idea is that we should return a string which still matches
2530the same set of elements."
2519 ;; When completing while ignoring case, we want to try and avoid 2531 ;; When completing while ignoring case, we want to try and avoid
2520 ;; completing "fo" to "foO" when completing against "FOO" (bug#4219). 2532 ;; completing "fo" to "foO" when completing against "FOO" (bug#4219).
2521 ;; So we try and make sure that the string we return is all made up 2533 ;; So we try and make sure that the string we return is all made up
@@ -2568,7 +2580,9 @@ filter out additional entries (because TABLE migth not obey PRED)."
2568 (let* ((prefix (try-completion fixed comps)) 2580 (let* ((prefix (try-completion fixed comps))
2569 (unique (or (and (eq prefix t) (setq prefix fixed)) 2581 (unique (or (and (eq prefix t) (setq prefix fixed))
2570 (eq t (try-completion prefix comps))))) 2582 (eq t (try-completion prefix comps)))))
2571 (unless (equal prefix "") (push prefix res)) 2583 (unless (or (eq elem 'prefix)
2584 (equal prefix ""))
2585 (push prefix res))
2572 ;; If there's only one completion, `elem' is not useful 2586 ;; If there's only one completion, `elem' is not useful
2573 ;; any more: it can only match the empty string. 2587 ;; any more: it can only match the empty string.
2574 ;; FIXME: in some cases, it may be necessary to turn an 2588 ;; FIXME: in some cases, it may be necessary to turn an