emacs-devel
[Top][All Lists]
Advanced

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

Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special charact


From: ian martins
Subject: Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands
Date: Sat, 30 Jan 2021 06:17:56 -0500

> > +path to the executable, like \"/usr/local/bin/neko\".  This is
> > +run in a shell."
>
> I think it's not clear what "This is run in a shell" means here.
>
> Typically it either means that the usual "shell preprocessing" will take
> place, so you can use $ spaces and quotes to construct a "chunk" of
> a command, or it is just an implementation detail (in which case
> there's no particular reason to mention it in such docstrings).

It is the latter case.  I wrote that before adding code to escape the
string.  It isn't useful anymore.  I've removed it.

> > @@ -126,11 +126,13 @@ replaced in this string.")
> >            (or (cdr (assq :haxe params))
> >                org-babel-haxe-compiler))
> >           (org-babel-neko-command
> > -          (or (cdr (assq :neko params))
> > -              org-babel-neko-command))
> > +          (replace-regexp-in-string "\\([ \"]\\)" "\\\\\\1" ; escape 
> > double quotes or spaces
> > +                                    (or (cdr (assq :neko params))
> > +                                        org-babel-neko-command)))
>
> You might want to use `shell-quote-argument` instead, so it also escapes
> backslashes, pipes, semi colons and whatnot and generally tries to
> ensure that the strings is passed through "as is", so the user doesn't
> need to know that the string is used as part of a shell command.

Good suggestion. done.

I've read a lot of the elisp docs but am unfamiliar with most of the
builtin functions in emacs core.  I should probably start from the
assumption that whatever I want to do is in there somewhere and search
before writing anything new.



reply via email to

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