aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-05-23 11:54:44 -0400
committerStefan Monnier2014-05-23 11:54:44 -0400
commite4829cb8d789abc8ac72080ba412f90328e44990 (patch)
tree989ceeff8a2f5b47fa00090a26e5ec6849e9f710
parentaad65192332dfc4a1df0cd2953554c21da243b51 (diff)
downloademacs-e4829cb8d789abc8ac72080ba412f90328e44990.tar.gz
emacs-e4829cb8d789abc8ac72080ba412f90328e44990.zip
* lisp/minibuffer.el (completion--sreverse): Remove.
(completion--common-suffix): Use `reverse' instead. * lisp/emacs-lisp/regexp-opt.el (regexp-opt-group): Use `reverse' on strings.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/regexp-opt.el7
-rw-r--r--lisp/minibuffer.el10
3 files changed, 10 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index aaf7cb232c8..7c2b1ec5ad6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-05-23 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * minibuffer.el (completion--sreverse): Remove.
4 (completion--common-suffix): Use `reverse' instead.
5 * emacs-lisp/regexp-opt.el (regexp-opt-group): Use `reverse' on strings.
6
12014-05-22 Glenn Morris <rgm@gnu.org> 72014-05-22 Glenn Morris <rgm@gnu.org>
2 8
3 * shell.el (shell-mode) <shell-dirstack-query>: Bypass bash aliases. 9 * shell.el (shell-mode) <shell-dirstack-query>: Bypass bash aliases.
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index b2d4f2b71dd..ff9388171a6 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -205,9 +205,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
205 (regexp-opt-group suffixes t t) 205 (regexp-opt-group suffixes t t)
206 close-group)) 206 close-group))
207 207
208 (let* ((sgnirts (mapcar (lambda (s) 208 (let* ((sgnirts (mapcar #'reverse strings))
209 (concat (nreverse (string-to-list s))))
210 strings))
211 (xiffus (try-completion "" sgnirts))) 209 (xiffus (try-completion "" sgnirts)))
212 (if (> (length xiffus) 0) 210 (if (> (length xiffus) 0)
213 ;; common suffix: take it and recurse on the prefixes. 211 ;; common suffix: take it and recurse on the prefixes.
@@ -218,8 +216,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
218 'string-lessp))) 216 'string-lessp)))
219 (concat open-group 217 (concat open-group
220 (regexp-opt-group prefixes t t) 218 (regexp-opt-group prefixes t t)
221 (regexp-quote 219 (regexp-quote (nreverse xiffus))
222 (concat (nreverse (string-to-list xiffus))))
223 close-group)) 220 close-group))
224 221
225 ;; Otherwise, divide the list into those that start with a 222 ;; Otherwise, divide the list into those that start with a
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index f8e39dc1529..2f898fa1ba5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -873,6 +873,7 @@ completing buffer and file names, respectively."
873 ;; part of the string (e.g. substitute-in-file-name). 873 ;; part of the string (e.g. substitute-in-file-name).
874 (let ((requote 874 (let ((requote
875 (when (completion-metadata-get metadata 'completion--unquote-requote) 875 (when (completion-metadata-get metadata 'completion--unquote-requote)
876 (cl-assert (functionp table))
876 (let ((new (funcall table string point 'completion--unquote))) 877 (let ((new (funcall table string point 'completion--unquote)))
877 (setq string (pop new)) 878 (setq string (pop new))
878 (setq table (pop new)) 879 (setq table (pop new))
@@ -3057,16 +3058,9 @@ filter out additional entries (because TABLE might not obey PRED)."
3057 (nconc (completion-pcm--hilit-commonality pattern all) 3058 (nconc (completion-pcm--hilit-commonality pattern all)
3058 (length prefix))))) 3059 (length prefix)))))
3059 3060
3060(defun completion--sreverse (str)
3061 "Like `reverse' but for a string STR rather than a list."
3062 (apply #'string (nreverse (mapcar 'identity str))))
3063
3064(defun completion--common-suffix (strs) 3061(defun completion--common-suffix (strs)
3065 "Return the common suffix of the strings STRS." 3062 "Return the common suffix of the strings STRS."
3066 (completion--sreverse 3063 (nreverse (try-completion "" (mapcar #'reverse strs))))
3067 (try-completion
3068 ""
3069 (mapcar #'completion--sreverse strs))))
3070 3064
3071(defun completion-pcm--merge-completions (strs pattern) 3065(defun completion-pcm--merge-completions (strs pattern)
3072 "Extract the commonality in STRS, with the help of PATTERN. 3066 "Extract the commonality in STRS, with the help of PATTERN.