diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-10-17 09:43:40 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-10-17 09:43:40 -0400 |
commit | 8b79f3e0ed805d86dcb0e74572e61da2cd2d8ffc (patch) | |
tree | c41715088099ab1db86e0f45c2dd6d933395125e /lisp/comint.el | |
parent | 4e5c3d2bf143a9925a2f52e9ec8613977fd0bc8a (diff) | |
download | emacs-8b79f3e0ed805d86dcb0e74572e61da2cd2d8ffc.tar.gz |
* lisp/comint.el (comint--table-subvert): Quote the all-completions output.
Fixes: debbugs:9160
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 52580db6186..c3ec17b02f4 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3079,9 +3079,9 @@ SS1 = (unquote SS2)." (defun comint--table-subvert (table s1 s2 &optional quote-fun unquote-fun) "Completion table that replaces the prefix S1 with S2 in STRING. -When TABLE, S1 and S2 are provided by `apply-partially', the result -is a completion table which completes strings of the form (concat S1 S) -in the same way as TABLE completes strings of the form (concat S2 S)." +The result is a completion table which completes strings of the +form (concat S1 S) in the same way as TABLE completes strings of +the form (concat S2 S)." (lambda (string pred action) (let* ((str (if (eq t (compare-strings string 0 (length s1) s1 nil nil completion-ignore-case)) @@ -3106,13 +3106,15 @@ in the same way as TABLE completes strings of the form (concat S2 S)." ((eq action t) (let ((bounds (completion-boundaries str table pred ""))) (if (>= (car bounds) (length s2)) - res + (if quote-fun (mapcar quote-fun res) res) (let ((re (concat "\\`" (regexp-quote (substring s2 (car bounds)))))) (delq nil (mapcar (lambda (c) (if (string-match re c) - (substring c (match-end 0)))) + (let ((str (substring c (match-end 0)))) + (if quote-fun + (funcall quote-fun str) str)))) res)))))) ;; E.g. action=nil and it's the only completion. (res)))))) |