diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-08-28 01:15:17 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-08-28 01:15:17 -0400 |
commit | 356a3681816a68e9222dcb8c470a0a7d0620f622 (patch) | |
tree | ebfa868fbb4eb2b5f87ea530421a6030730ffb17 /lisp/shell.el | |
parent | dca4927e8bcf20b25dcdfb540c1d86c8caede458 (diff) | |
download | emacs-356a3681816a68e9222dcb8c470a0a7d0620f622.tar.gz |
* lisp/shell.el (shell-parse-pcomplete-arguments): Unquote args.
Fixes: debbugs:9160
Diffstat (limited to 'lisp/shell.el')
-rw-r--r-- | lisp/shell.el | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index 01d1a688f0e..909ebb48afc 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -393,10 +393,28 @@ to `dirtrack-mode'." (while (< (point) end) (skip-chars-forward " \t\n") (push (point) begins) - (looking-at "\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?") - (goto-char (match-end 0)) - (push (buffer-substring-no-properties (car begins) (point)) - args)) + (let ((arg ())) + (while (looking-at + (eval-when-compile + (concat + "\\(?:[^\s\t\n\\\"']+" + "\\|'\\([^']*\\)'?" + "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?" + "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)"))) + (goto-char (match-end 0)) + (cond + ((match-beginning 3) ;Backslash escape. + (push (if (= (match-beginning 3) (match-end 3)) + "\\" (match-string 3)) + arg)) + ((match-beginning 2) ;Double quote. + (push (replace-regexp-in-string + "\\\\\\(.\\)" "\\1" (match-string 2)) + arg)) + ((match-beginning 1) ;Single quote. + (push (match-string 1) arg)) + (t (push (match-string 0) arg)))) + (push (mapconcat #'identity (nreverse arg) "") args))) (cons (nreverse args) (nreverse begins))))) (defun shell-completion-vars () |