]> git.eshelyaron.com Git - emacs.git/commitdiff
(shell-unquote-argument): If the shell is one of the
authorEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2001 12:43:56 +0000 (12:43 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2001 12:43:56 +0000 (12:43 +0000)
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.

lisp/ChangeLog
lisp/shell.el

index f5ef149f12f26e2260d91f7fe18d19fec32c201b..31da8a33a6bd3fddee197271695dd71e8cc0c74b 100644 (file)
@@ -1,5 +1,12 @@
 2001-01-27  Eli Zaretskii  <eliz@is.elta.co.il>
 
+       * shell.el (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.
+
        * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Undo the change
        from 2001-01-12.  It is not needed, since backspace is mapped into
        DEL.
index d3ec4ee8a9fce015da6fa45dd8fa0d325c544a17..e0052e57c8a7f955f64247530b69e5bd3d5a09a6 100644 (file)
 
 ;;;###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)))