diff options
author | Eli Zaretskii <eliz@gnu.org> | 2001-01-27 12:43:56 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2001-01-27 12:43:56 +0000 |
commit | f5058b9653e1aa98001902d18a0586d36c46f1d2 (patch) | |
tree | ce1b51c796df219b5a92ee00e6c27287619046dd /lisp/shell.el | |
parent | 4dcd74e647a3843982238edfe19f8f390d9e47b7 (diff) | |
download | emacs-f5058b9653e1aa98001902d18a0586d36c46f1d2.tar.gz |
(shell-unquote-argument): If the shell is one of the
mentioned in shell-dumb-shell-regexp, don't treat a backslash as a
quote character.
(shell-dumb-shell-regexp): Document that the shells which match
this regexp are supposed to not treat a backslash as a quote
character.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r-- | lisp/shell.el | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index d3ec4ee8a9f..e0052e57c8a 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -122,9 +122,11 @@ ;;;###autoload (defcustom shell-dumb-shell-regexp "cmd\\(proxy\\)?\\.exe" - "Regexp to match shells that don't save their command history. -For shells that match this regexp, Emacs will write out the -command history when the shell finishes." + "Regexp to match shells that don't save their command history, and +don't handle the backslash as a quote character. For shells that +match this regexp, Emacs will write out the command history when the +shell finishes, and won't remove backslashes when it unquotes shell +arguments." :type 'regexp :group 'shell) @@ -597,9 +599,15 @@ Environment variables are expanded, see function `substitute-in-file-name'." (defun shell-unquote-argument (string) "Remove all kinds of shell quoting from STRING." (save-match-data - (let ((idx 0) next inside) + (let ((idx 0) next inside + (quote-chars + (if (string-match shell-dumb-shell-regexp + (file-name-nondirectory + (car (process-command (get-buffer-process (current-buffer)))))) + "['`\"]" + "[\\'`\"]"))) (while (and (< idx (length string)) - (setq next (string-match "[\\'`\"]" string next))) + (setq next (string-match quote-chars string next))) (cond ((= (aref string next) ?\\) (setq string (replace-match "" nil nil string)) (setq next (1+ next))) |