[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shell-quote-argument: make it behave as if on Unix?
From: |
Stefan Monnier |
Subject: |
Re: shell-quote-argument: make it behave as if on Unix? |
Date: |
Fri, 12 Apr 2002 00:09:43 -0400 |
> > It strikes me that we should add to shell-quote-argument an optional
> > argument that will cause it to quote a shell argument for specific OS.
> > If the optional argument is omitted or nil, let it default to
> > system-type.
> >
> > What do you think?
>
> This sounds like a good idea.
>
> It is more modular to keep this complexity within the Tramp module
> rather than complicate other parts of Emacs. So I'd rather you put
> the code you want into Tramp.
If the patch below is too much complexity for Emacs, than the
best bet for Tramp is probably to temporarily bind system-type.
Stefan
@@ -1621,9 +1622,12 @@
(setq matches (cons (substring string start l) matches)) ; leftover
(apply #'concat (nreverse matches)))))
-(defun shell-quote-argument (argument)
- "Quote an argument for passing as argument to an inferior shell."
- (if (eq system-type 'ms-dos)
+(defun shell-quote-argument (argument &optional shell-type)
+ "Quote an argument for passing as argument to an inferior shell.
+SHELL-TYPE is the type of shell to which this will be passed.
+It defaults to the value of `system-type'."
+ (unless shell-type (setq shell-type system-type))
+ (if (eq shell-type 'ms-dos)
;; Quote using double quotes, but escape any existing quotes in
;; the argument with backslashes.
(let ((result "")
@@ -1637,7 +1641,7 @@
"\\" (substring argument end (1+ end)))
start (1+ end))))
(concat "\"" result (substring argument start) "\""))
- (if (eq system-type 'windows-nt)
+ (if (eq shell-type 'windows-nt)
(concat "\"" argument "\"")
(if (equal argument "")
"''"
- shell-quote-argument: make it behave as if on Unix?, Kai Großjohann, 2002/04/10
- Re: shell-quote-argument: make it behave as if on Unix?, Eli Zaretskii, 2002/04/10
- Re: shell-quote-argument: make it behave as if on Unix?, Kai Großjohann, 2002/04/10
- Re: shell-quote-argument: make it behave as if on Unix?, Stefan Monnier, 2002/04/10
- Re: shell-quote-argument: make it behave as if on Unix?, Richard Stallman, 2002/04/11
- Re: shell-quote-argument: make it behave as if on Unix?,
Stefan Monnier <=
- Re: shell-quote-argument: make it behave as if on Unix?, Eli Zaretskii, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Kim F. Storm, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Eli Zaretskii, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Stefan Monnier, 2002/04/12
Re: shell-quote-argument: make it behave as if on Unix?, Kai Großjohann, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Kim F. Storm, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Kai Großjohann, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Eli Zaretskii, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Kai Großjohann, 2002/04/12
- Re: shell-quote-argument: make it behave as if on Unix?, Eli Zaretskii, 2002/04/12