[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add shell-quasiquote.
From: |
Eli Zaretskii |
Subject: |
Re: [PATCH] Add shell-quasiquote. |
Date: |
Sat, 17 Oct 2015 22:44:25 +0300 |
> From: Random832 <address@hidden>
> Date: Sat, 17 Oct 2015 15:14:26 -0400
>
> Eli Zaretskii <address@hidden> writes:
> >> From: address@hidden (Taylan Ulrich Bayırlı/Kammer)
> >> +;;; Like `shell-quote-argument', but much simpler in implementation.
> >> +(defun shqq--quote-string (string)
> >> + (concat "'" (replace-regexp-in-string "'" "'\\\\''" string) "'"))
> >
> > It might be simpler, but it's wrong, because the result is only
> > correct for Posix shells.
> >
> > Please do use shell-quote-argument instead.
>
> It's also simpler than the POSIX section of shell-quote-argument.
Simpler doesn't mean correct.
> (defun shell-quote-argument (argument)
> [...] (cond [...] (t
> (if (equal argument "")
> "''"
> ;; Quote everything except POSIX filename characters.
> ;; This should be safe enough even for really weird shells.
> (replace-regexp-in-string
> "\n" "'\n'"
> (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument))))))
>
> I wonder what "really weird shells" this refers to?
The set of characters special to an arbitrary shell is not known in
advance.
> Certainly not csh, the mechanism it uses for newlines doesn't work
> there.
What did you try that didn't work with csh?
- Re: [PATCH] Add shell-quasiquote., (continued)
- Re: [PATCH] Add shell-quasiquote., Paul Eggert, 2015/10/17
- Re: [PATCH] Add shell-quasiquote., Taylan Ulrich Bayırlı/Kammer, 2015/10/17
- Re: [PATCH] Add shell-quasiquote., Paul Eggert, 2015/10/17
- Re: [PATCH] Add shell-quasiquote., Taylan Ulrich Bayırlı/Kammer, 2015/10/18
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/18
- Re: [PATCH] Add shell-quasiquote., Taylan Ulrich Bayırlı/Kammer, 2015/10/18
- Re: [PATCH] Add shell-quasiquote., John Wiegley, 2015/10/18
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/17
- Re: [PATCH] Add shell-quasiquote., Taylan Ulrich Bayırlı/Kammer, 2015/10/18
Re: [PATCH] Add shell-quasiquote., Random832, 2015/10/17
Re: [PATCH] Add shell-quasiquote., Artur Malabarba, 2015/10/17
Re: [PATCH] Add shell-quasiquote., Taylan Ulrich Bayırlı/Kammer, 2015/10/19