unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* shell-quote-argument: make it behave as if on Unix?
@ 2002-04-10 13:46 Kai Großjohann
  2002-04-10 16:56 ` Eli Zaretskii
  2002-04-11 14:53 ` Richard Stallman
  0 siblings, 2 replies; 26+ messages in thread
From: Kai Großjohann @ 2002-04-10 13:46 UTC (permalink / raw)


The Tramp package sends commands to a remote Unix host.  These
commands sometimes include filenames, so I pass those through
shell-quote-argument.

But if the local Emacs is running on Windows, then
shell-quote-argument produces filenames which are correct for
Windows, and not for Unix.  But the filenames will be used on the
remote Unix host.

Is there a designed-in facility for telling shell-quote-argument to
behave as if on Unix, even if Emacs is running on Windows?

Or is shell-quote-argument the wrong function to use, altogether?

(Right now, I'm binding system-type before invoking
shell-quote-argument, but I'm afraid that is the wrong thing to do.
Also, I have to wait for a Windows user to check whether it works.)

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-10 13:46 shell-quote-argument: make it behave as if on Unix? Kai Großjohann
@ 2002-04-10 16:56 ` Eli Zaretskii
  2002-04-10 21:10   ` Kai Großjohann
  2002-04-12 11:07   ` Kai Großjohann
  2002-04-11 14:53 ` Richard Stallman
  1 sibling, 2 replies; 26+ messages in thread
From: Eli Zaretskii @ 2002-04-10 16:56 UTC (permalink / raw)
  Cc: emacs-devel

> From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)
> Date: Wed, 10 Apr 2002 15:46:37 +0200
> 
> But if the local Emacs is running on Windows, then
> shell-quote-argument produces filenames which are correct for
> Windows, and not for Unix.  But the filenames will be used on the
> remote Unix host.
> 
> Is there a designed-in facility for telling shell-quote-argument to
> behave as if on Unix, even if Emacs is running on Windows?

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?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-10 16:56 ` Eli Zaretskii
@ 2002-04-10 21:10   ` Kai Großjohann
  2002-04-10 21:29     ` Stefan Monnier
  2002-04-12  3:11     ` Richard Stallman
  2002-04-12 11:07   ` Kai Großjohann
  1 sibling, 2 replies; 26+ messages in thread
From: Kai Großjohann @ 2002-04-10 21:10 UTC (permalink / raw)
  Cc: emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> 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.  If there is a way to check whether
this new feature is available, that'd be perfect.  (Then Tramp can
work on older Emacsen, too.)

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-10 21:10   ` Kai Großjohann
@ 2002-04-10 21:29     ` Stefan Monnier
  2002-04-12  3:11     ` Richard Stallman
  1 sibling, 0 replies; 26+ messages in thread
From: Stefan Monnier @ 2002-04-10 21:29 UTC (permalink / raw)
  Cc: Eli Zaretskii, emacs-devel

> "Eli Zaretskii" <eliz@is.elta.co.il> writes:
> 
> > 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.  If there is a way to check whether
> this new feature is available, that'd be perfect.  (Then Tramp can

Trivial: call it with the extra arg and see if it succeeds.


	Stefan

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-10 13:46 shell-quote-argument: make it behave as if on Unix? Kai Großjohann
  2002-04-10 16:56 ` Eli Zaretskii
@ 2002-04-11 14:53 ` Richard Stallman
  2002-04-11 15:57   ` Kai Großjohann
  2002-04-16  9:25   ` Kai Großjohann
  1 sibling, 2 replies; 26+ messages in thread
From: Richard Stallman @ 2002-04-11 14:53 UTC (permalink / raw)
  Cc: emacs-devel

    The Tramp package sends commands to a remote Unix host.  These
    commands sometimes include filenames, so I pass those through
    shell-quote-argument.

I think you should copy the code you want into your own source file
and give it a different function name.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-11 14:53 ` Richard Stallman
@ 2002-04-11 15:57   ` Kai Großjohann
  2002-04-12 19:49     ` Richard Stallman
  2002-04-16  9:25   ` Kai Großjohann
  1 sibling, 1 reply; 26+ messages in thread
From: Kai Großjohann @ 2002-04-11 15:57 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     The Tramp package sends commands to a remote Unix host.  These
>     commands sometimes include filenames, so I pass those through
>     shell-quote-argument.
>
> I think you should copy the code you want into your own source file
> and give it a different function name.

Sure, I can do that.  I was trying to avoid the duplication of code,
since calling shell-quote-argument allows me to profit from its
improvements.

(It was you who suggested to me to use shell-quote-argument instead of
my home-grown function in the first place.  This was many months ago.)

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-10 21:10   ` Kai Großjohann
  2002-04-10 21:29     ` Stefan Monnier
@ 2002-04-12  3:11     ` Richard Stallman
  2002-04-12  4:09       ` Stefan Monnier
  1 sibling, 1 reply; 26+ messages in thread
From: Richard Stallman @ 2002-04-12  3:11 UTC (permalink / raw)
  Cc: eliz, emacs-devel

    > 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.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12  3:11     ` Richard Stallman
@ 2002-04-12  4:09       ` Stefan Monnier
  2002-04-12 10:16         ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: Stefan Monnier @ 2002-04-12  4:09 UTC (permalink / raw)
  Cc: Kai.Grossjohann, eliz, emacs-devel

>     > 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)))))
 \f
-(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 "")
 	  "''"

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12  4:09       ` Stefan Monnier
@ 2002-04-12 10:16         ` Eli Zaretskii
  2002-04-12 11:43           ` Kim F. Storm
  2002-04-12 18:46           ` Stefan Monnier
  0 siblings, 2 replies; 26+ messages in thread
From: Eli Zaretskii @ 2002-04-12 10:16 UTC (permalink / raw)
  Cc: rms, Kai.Grossjohann, emacs-devel

> From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
> Date: Fri, 12 Apr 2002 00:09:43 -0400
> 
> -(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)

This is what I had in mind, but I think `shell-type' is not a good
name for that argument, since without reading the source of the
function, I'd be tempted to use something like 'bash or 'command.com
there instead of ms-dos or windows-nt.  I think system-type or os-type
is better.  I also suggest to say in the doc string that the possible
values are those used in the system-type variable.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-10 16:56 ` Eli Zaretskii
  2002-04-10 21:10   ` Kai Großjohann
@ 2002-04-12 11:07   ` Kai Großjohann
  2002-04-12 14:07     ` Kim F. Storm
  1 sibling, 1 reply; 26+ messages in thread
From: Kai Großjohann @ 2002-04-12 11:07 UTC (permalink / raw)
  Cc: emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> 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.

Another possibility is to keep the current behavior and just document
it:

    This function uses the variable `system-type' to see what kind of
    quoting is to take place.  You can bind that variable before
    calling this function to effect a different kind of quoting.  For
    example, the following gives you Unix-style quoting even when
    Emacs is running on Windows-like systems:
        (let ((system-type 'not-windows)) (shell-quote-argument "..."))

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 10:16         ` Eli Zaretskii
@ 2002-04-12 11:43           ` Kim F. Storm
  2002-04-12 15:18             ` Eli Zaretskii
  2002-04-12 18:46           ` Stefan Monnier
  1 sibling, 1 reply; 26+ messages in thread
From: Kim F. Storm @ 2002-04-12 11:43 UTC (permalink / raw)


"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> > From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
> > Date: Fri, 12 Apr 2002 00:09:43 -0400
> > 
> > -(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)
> 
> This is what I had in mind, but I think `shell-type' is not a good
> name for that argument, since without reading the source of the
> function, I'd be tempted to use something like 'bash or 'command.com
> there instead of ms-dos or windows-nt.  I think system-type or os-type
> is better.  I also suggest to say in the doc string that the possible
> values are those used in the system-type variable.

Maybe `target-system-type' would be a sensible name for the parameter?
The doc string could the state:

TARGET-SYSTEM-TYPE is the `system-type' of the system where the quoted
argument will be interpreted.  It defaults to the value of `system-type'.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 14:07     ` Kim F. Storm
@ 2002-04-12 13:38       ` Kai Großjohann
  2002-04-12 15:20         ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: Kai Großjohann @ 2002-04-12 13:38 UTC (permalink / raw)
  Cc: Eli Zaretskii, emacs-devel

storm@cua.dk (Kim F. Storm) writes:

> But I agree that this would suffice, and maybe a shorter doc string
> would be sufficient [Don't give an example -- this is for lisp
> experts anyway]...  Maybe this is enough:
>
>      The variable `system-type' determines the kind of quoting performed.

Yes.  But maybe people would like to know which values are useful
values.  So it could say that there are three cases: ms-dos,
windows-nt, and everything else.

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 11:07   ` Kai Großjohann
@ 2002-04-12 14:07     ` Kim F. Storm
  2002-04-12 13:38       ` Kai Großjohann
  0 siblings, 1 reply; 26+ messages in thread
From: Kim F. Storm @ 2002-04-12 14:07 UTC (permalink / raw)
  Cc: Eli Zaretskii, emacs-devel

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Another possibility is to keep the current behavior and just document
> it:
> 
>     This function uses the variable `system-type' to see what kind of
>     quoting is to take place.  You can bind that variable before
>     calling this function to effect a different kind of quoting.  For
>     example, the following gives you Unix-style quoting even when
>     Emacs is running on Windows-like systems:
>         (let ((system-type 'not-windows)) (shell-quote-argument "..."))
> 

Excecpt that this addition to the doc string is larger (and more
complex) than the changes needed to add and document an optional
target-system-type parameter :-)

But I agree that this would suffice, and maybe a shorter doc string
would be sufficient [Don't give an example -- this is for lisp
experts anyway]...  Maybe this is enough:

     The variable `system-type' determines the kind of quoting performed.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 11:43           ` Kim F. Storm
@ 2002-04-12 15:18             ` Eli Zaretskii
  0 siblings, 0 replies; 26+ messages in thread
From: Eli Zaretskii @ 2002-04-12 15:18 UTC (permalink / raw)
  Cc: emacs-devel

> From: storm@cua.dk (Kim F. Storm)
> Date: 12 Apr 2002 13:43:20 +0200
> 
> Maybe `target-system-type' would be a sensible name for the parameter?

`target-system-type' is good IMO.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 13:38       ` Kai Großjohann
@ 2002-04-12 15:20         ` Eli Zaretskii
  2002-04-12 16:55           ` Kai Großjohann
  0 siblings, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2002-04-12 15:20 UTC (permalink / raw)
  Cc: storm, emacs-devel

> From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)
> Date: Fri, 12 Apr 2002 15:38:50 +0200
> 
> >      The variable `system-type' determines the kind of quoting performed.
> 
> Yes.  But maybe people would like to know which values are useful
> values.  So it could say that there are three cases: ms-dos,
> windows-nt, and everything else.

There are more values that just these two.  We should document all of
the possible values, but I think we should do that in the doc string
of system-type.  Then shell-quote-argument could simply refer to that.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 15:20         ` Eli Zaretskii
@ 2002-04-12 16:55           ` Kai Großjohann
  2002-04-12 18:51             ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: Kai Großjohann @ 2002-04-12 16:55 UTC (permalink / raw)
  Cc: storm, emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

>> From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)
>> Date: Fri, 12 Apr 2002 15:38:50 +0200
>> 
>> >      The variable `system-type' determines the kind of quoting performed.
>> 
>> Yes.  But maybe people would like to know which values are useful
>> values.  So it could say that there are three cases: ms-dos,
>> windows-nt, and everything else.
>
> There are more values that just these two.

shell-quote-argument has only three kinds of behaviors.  If we
document all possible values, then people might worry whether to use
gnu/linux or usg-unix-v, say.

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 10:16         ` Eli Zaretskii
  2002-04-12 11:43           ` Kim F. Storm
@ 2002-04-12 18:46           ` Stefan Monnier
  1 sibling, 0 replies; 26+ messages in thread
From: Stefan Monnier @ 2002-04-12 18:46 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, rms, Kai.Grossjohann, emacs-devel

> > From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
> > Date: Fri, 12 Apr 2002 00:09:43 -0400
> > 
> > -(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)
> 
> This is what I had in mind, but I think `shell-type' is not a good
> name for that argument, since without reading the source of the
> function, I'd be tempted to use something like 'bash or 'command.com
> there instead of ms-dos or windows-nt.  I think system-type or os-type
> is better.  I also suggest to say in the doc string that the possible
> values are those used in the system-type variable.

I think what matters is the type of shell, so `shell-type' sounds
better to me.  But you're right that the docstring should list
the known values, so as to remove any ambiguity.

In any case, I even prefer Kim's solution of just documenting that it
relies on `system-type' to decide what to do.


	Stefan

PS: A `system-type' argument would not be a good idea, since I do not
    like using `defvar'd variables for arguments (it doesn't interact
    well with lexical scoping).

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 16:55           ` Kai Großjohann
@ 2002-04-12 18:51             ` Eli Zaretskii
  2002-04-13 19:07               ` Richard Stallman
  0 siblings, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2002-04-12 18:51 UTC (permalink / raw)
  Cc: storm, emacs-devel

> From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)
> Date: Fri, 12 Apr 2002 18:55:13 +0200
> 
> shell-quote-argument has only three kinds of behaviors.

For now, yes.  But it might change in the future.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-11 15:57   ` Kai Großjohann
@ 2002-04-12 19:49     ` Richard Stallman
  0 siblings, 0 replies; 26+ messages in thread
From: Richard Stallman @ 2002-04-12 19:49 UTC (permalink / raw)
  Cc: emacs-devel

      I was trying to avoid the duplication of code,
    since calling shell-quote-argument allows me to profit from its
    improvements.

Using that code unchanged instead of copying it is a simplification;
when you have to add special features to it for this use, then it
is not a simplification.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-12 18:51             ` Eli Zaretskii
@ 2002-04-13 19:07               ` Richard Stallman
  2002-04-13 19:18                 ` Kai Großjohann
  2002-04-15 12:16                 ` Stefan Monnier
  0 siblings, 2 replies; 26+ messages in thread
From: Richard Stallman @ 2002-04-13 19:07 UTC (permalink / raw)
  Cc: Kai.Grossjohann, storm, emacs-devel

It seems that shell-quote-argument is taking up a lot of people's
time.  Given that there are so many other useful things to do, that
seems like a bad allocation of your time.

Making a change in Tramp would not require any discussion.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-13 19:07               ` Richard Stallman
@ 2002-04-13 19:18                 ` Kai Großjohann
  2002-04-15 21:54                   ` Richard Stallman
  2002-04-15 12:16                 ` Stefan Monnier
  1 sibling, 1 reply; 26+ messages in thread
From: Kai Großjohann @ 2002-04-13 19:18 UTC (permalink / raw)
  Cc: eliz, storm, emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Making a change in Tramp would not require any discussion.

Okay.  Tramp is working now.  I'll think about using the code from
shell-quote-argument instead of 

    (let ((system-type 'not-windows))
      (shell-quote-argument X))

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-13 19:07               ` Richard Stallman
  2002-04-13 19:18                 ` Kai Großjohann
@ 2002-04-15 12:16                 ` Stefan Monnier
  2002-04-16 20:17                   ` Richard Stallman
  1 sibling, 1 reply; 26+ messages in thread
From: Stefan Monnier @ 2002-04-15 12:16 UTC (permalink / raw)
  Cc: eliz, Kai.Grossjohann, storm, emacs-devel

> It seems that shell-quote-argument is taking up a lot of people's time.

Only because you opposed the original trivial suggestion.


	Stefan

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-13 19:18                 ` Kai Großjohann
@ 2002-04-15 21:54                   ` Richard Stallman
  0 siblings, 0 replies; 26+ messages in thread
From: Richard Stallman @ 2002-04-15 21:54 UTC (permalink / raw)
  Cc: eliz, storm, emacs-devel

    Okay.  Tramp is working now.  I'll think about using the code from
    shell-quote-argument instead of 

	(let ((system-type 'not-windows))
	  (shell-quote-argument X))

That code is reasonable.  Since it doesn't require changing
shell-quote-argument, it is something you can do on your own without a
discussion.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-11 14:53 ` Richard Stallman
  2002-04-11 15:57   ` Kai Großjohann
@ 2002-04-16  9:25   ` Kai Großjohann
  2002-04-16  9:35     ` Kai Großjohann
  1 sibling, 1 reply; 26+ messages in thread
From: Kai Großjohann @ 2002-04-16  9:25 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     The Tramp package sends commands to a remote Unix host.  These
>     commands sometimes include filenames, so I pass those through
>     shell-quote-argument.
>
> I think you should copy the code you want into your own source file
> and give it a different function name.

I've been thinking about this for a long time now, and I would like
to thank Richard for his very useful advice.  All things considered,
I think he is right.

OT1H it would be nice to reuse code.

But OTOH, there are a number of issues with shell-quote-argument as
it currently stands, and Tramp can only use it after these have been
decided.

(1) [This issue has been discussed in the current thread.]
    shell-quote-argument always quotes for the system that Emacs is
    running on, but some applications (such as Tramp) might wish to
    use the strings on a different system.

(2) shell-quote-argument does not deal well with newlines in strings.
    For instance, it converts "a\nb" into "a\\\nb" which the (Bourne)
    shell then reads as "ab".  There is no method (that I know of)
    which works for both Bourne-ish and c-ish shells on Unix.

So I will (maybe not today) change tramp-shell-quote-argument in such
a way that it does the work itself.  After that, it is not urgent to
change the behavior of shell-quote-argument.

Are people interested in me working on changing shell-quote-argument
to deal with the above two issues?  I'll look through the Lisp code
in Emacs to see that the change is upwardly¹ compatible.

kai

¹ Or is it "upwards-compatible"?
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-16  9:25   ` Kai Großjohann
@ 2002-04-16  9:35     ` Kai Großjohann
  0 siblings, 0 replies; 26+ messages in thread
From: Kai Großjohann @ 2002-04-16  9:35 UTC (permalink / raw)


Kai.Grossjohann@cs.uni-dortmund.de (Kai Großjohann) writes:

> I've been thinking about this for a long time now, and I would like
> to thank Richard for his very useful advice.  All things considered,
> I think he is right.

Of course I also thank the others for their equally useful advice!
Sorry.

kai
-- 
Silence is foo!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: shell-quote-argument: make it behave as if on Unix?
  2002-04-15 12:16                 ` Stefan Monnier
@ 2002-04-16 20:17                   ` Richard Stallman
  0 siblings, 0 replies; 26+ messages in thread
From: Richard Stallman @ 2002-04-16 20:17 UTC (permalink / raw)
  Cc: eliz, Kai.Grossjohann, storm, emacs-devel

    > It seems that shell-quote-argument is taking up a lot of people's time.

    Only because you opposed the original trivial suggestion.

People responded to my easy suggestion in a way that wasn't useful.

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2002-04-16 20:17 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-10 13:46 shell-quote-argument: make it behave as if on Unix? Kai Großjohann
2002-04-10 16:56 ` Eli Zaretskii
2002-04-10 21:10   ` Kai Großjohann
2002-04-10 21:29     ` Stefan Monnier
2002-04-12  3:11     ` Richard Stallman
2002-04-12  4:09       ` Stefan Monnier
2002-04-12 10:16         ` Eli Zaretskii
2002-04-12 11:43           ` Kim F. Storm
2002-04-12 15:18             ` Eli Zaretskii
2002-04-12 18:46           ` Stefan Monnier
2002-04-12 11:07   ` Kai Großjohann
2002-04-12 14:07     ` Kim F. Storm
2002-04-12 13:38       ` Kai Großjohann
2002-04-12 15:20         ` Eli Zaretskii
2002-04-12 16:55           ` Kai Großjohann
2002-04-12 18:51             ` Eli Zaretskii
2002-04-13 19:07               ` Richard Stallman
2002-04-13 19:18                 ` Kai Großjohann
2002-04-15 21:54                   ` Richard Stallman
2002-04-15 12:16                 ` Stefan Monnier
2002-04-16 20:17                   ` Richard Stallman
2002-04-11 14:53 ` Richard Stallman
2002-04-11 15:57   ` Kai Großjohann
2002-04-12 19:49     ` Richard Stallman
2002-04-16  9:25   ` Kai Großjohann
2002-04-16  9:35     ` Kai Großjohann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).