emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't stop find-grep-dired when using Cygwin for the inferior proces


From: Jason Rumney
Subject: Re: Can't stop find-grep-dired when using Cygwin for the inferior process - bug in shell-quote-argument?
Date: Mon, 28 Aug 2006 15:37:02 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.4) Gecko/20060516 Thunderbird/1.5.0.4 Mnenhy/0.7.4.666

Jason Rumney wrote:
We already have w32-system-shells, which is the inverse of the variable you propose (except it is missing "cmdproxy.exe", I am not sure if there is a good reason for that).
In fact we have a function w32-shell-dos-semantics for precisely this purpose. So a suitable patch might be as below. The only thing left is to silence the compiler warning about w32-shell-dos-semantics not being defined on other platforms. Is (defun w32-shell-dos-semantics) the right way to do that?



*** subr.el    04 Aug 2006 21:48:36 +0100    1.523
--- subr.el 28 Aug 2006 15:33:36 +0100 ***************
*** 2039,2045 ****

 (defun shell-quote-argument (argument)
   "Quote an argument for passing as argument to an inferior shell."
!   (if (eq system-type 'ms-dos)
       ;; Quote using double quotes, but escape any existing quotes in
       ;; the argument with backslashes.
       (let ((result "")
--- 2039,2046 ----

 (defun shell-quote-argument (argument)
   "Quote an argument for passing as argument to an inferior shell."
!   (if (or (eq system-type 'ms-dos)
!           (and (eq system-type 'windows-nt) (w32-shell-dos-semantics)))
       ;; Quote using double quotes, but escape any existing quotes in
       ;; the argument with backslashes.
       (let ((result "")
***************
*** 2053,2071 ****
                    "\\" (substring argument end (1+ end)))
             start (1+ end))))
     (concat "\"" result (substring argument start) "\""))
!     (if (eq system-type 'windows-nt)
!     (concat "\"" argument "\"")
!       (if (equal argument "")
!       "''"
!     ;; Quote everything except POSIX filename characters.
!     ;; This should be safe enough even for really weird shells.
!     (let ((result "") (start 0) end)
!       (while (string-match "[^-0-9a-zA-Z_./]" argument start)
!         (setq end (match-beginning 0)
!           result (concat result (substring argument start end)
!                  "\\" (substring argument end (1+ end)))
!           start (1+ end)))
!       (concat result (substring argument start)))))))

 (defun string-or-null-p (object)
   "Return t if OBJECT is a string or nil.
--- 2054,2070 ----
                    "\\" (substring argument end (1+ end)))
             start (1+ end))))
     (concat "\"" result (substring argument start) "\""))
!     (if (equal argument "")
!         "''"
!       ;; Quote everything except POSIX filename characters.
!       ;; This should be safe enough even for really weird shells.
!       (let ((result "") (start 0) end)
!         (while (string-match "[^-0-9a-zA-Z_./]" argument start)
!           (setq end (match-beginning 0)
!                 result (concat result (substring argument start end)
!                                "\\" (substring argument end (1+ end)))
!                 start (1+ end)))
!         (concat result (substring argument start))))))

 (defun string-or-null-p (object)
   "Return t if OBJECT is a string or nil.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]