Commit e4829cb8 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* 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.
parent aad65192
2014-05-23 Stefan Monnier <monnier@iro.umontreal.ca>
* minibuffer.el (completion--sreverse): Remove.
(completion--common-suffix): Use `reverse' instead.
* emacs-lisp/regexp-opt.el (regexp-opt-group): Use `reverse' on strings.
2014-05-22 Glenn Morris <rgm@gnu.org> 2014-05-22 Glenn Morris <rgm@gnu.org>
   
* shell.el (shell-mode) <shell-dirstack-query>: Bypass bash aliases. * shell.el (shell-mode) <shell-dirstack-query>: Bypass bash aliases.
......
...@@ -205,9 +205,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher." ...@@ -205,9 +205,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
(regexp-opt-group suffixes t t) (regexp-opt-group suffixes t t)
close-group)) close-group))
(let* ((sgnirts (mapcar (lambda (s) (let* ((sgnirts (mapcar #'reverse strings))
(concat (nreverse (string-to-list s))))
strings))
(xiffus (try-completion "" sgnirts))) (xiffus (try-completion "" sgnirts)))
(if (> (length xiffus) 0) (if (> (length xiffus) 0)
;; common suffix: take it and recurse on the prefixes. ;; common suffix: take it and recurse on the prefixes.
...@@ -218,8 +216,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher." ...@@ -218,8 +216,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
'string-lessp))) 'string-lessp)))
(concat open-group (concat open-group
(regexp-opt-group prefixes t t) (regexp-opt-group prefixes t t)
(regexp-quote (regexp-quote (nreverse xiffus))
(concat (nreverse (string-to-list xiffus))))
close-group)) close-group))
;; Otherwise, divide the list into those that start with a ;; Otherwise, divide the list into those that start with a
......
...@@ -873,6 +873,7 @@ completing buffer and file names, respectively." ...@@ -873,6 +873,7 @@ completing buffer and file names, respectively."
;; part of the string (e.g. substitute-in-file-name). ;; part of the string (e.g. substitute-in-file-name).
(let ((requote (let ((requote
(when (completion-metadata-get metadata 'completion--unquote-requote) (when (completion-metadata-get metadata 'completion--unquote-requote)
(cl-assert (functionp table))
(let ((new (funcall table string point 'completion--unquote))) (let ((new (funcall table string point 'completion--unquote)))
(setq string (pop new)) (setq string (pop new))
(setq table (pop new)) (setq table (pop new))
...@@ -3057,16 +3058,9 @@ filter out additional entries (because TABLE might not obey PRED)." ...@@ -3057,16 +3058,9 @@ filter out additional entries (because TABLE might not obey PRED)."
(nconc (completion-pcm--hilit-commonality pattern all) (nconc (completion-pcm--hilit-commonality pattern all)
(length prefix))))) (length prefix)))))
(defun completion--sreverse (str)
"Like `reverse' but for a string STR rather than a list."
(apply #'string (nreverse (mapcar 'identity str))))
(defun completion--common-suffix (strs) (defun completion--common-suffix (strs)
"Return the common suffix of the strings STRS." "Return the common suffix of the strings STRS."
(completion--sreverse (nreverse (try-completion "" (mapcar #'reverse strs))))
(try-completion
""
(mapcar #'completion--sreverse strs))))
(defun completion-pcm--merge-completions (strs pattern) (defun completion-pcm--merge-completions (strs pattern)
"Extract the commonality in STRS, with the help of PATTERN. "Extract the commonality in STRS, with the help of PATTERN.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment