# HG changeset patch # User Eli Zaretskii # Date 980599319 0 # Node ID cafc43e2ccfdd52dbadae3c0b64f3e07ee9efa51 # Parent 15b0b31760c767bc19cb353b89131d7f2678fcb5 (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. diff -r 15b0b31760c7 -r cafc43e2ccfd lisp/shell.el --- a/lisp/shell.el Sat Jan 27 12:40:49 2001 +0000 +++ b/lisp/shell.el Sat Jan 27 12:41:59 2001 +0000 @@ -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 @@ (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)))