all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ian martins <ianxm@jhu.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <CAC=rjb7HLs8zVtD0JGDbTWrpX3-xvsnh7-30Ck9M_URT75HPxg@mail.gmail.com> (raw)
In-Reply-To: <jwvy2gbstwk.fsf-monnier+emacs@gnu.org>

> > +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	other threads:[~2021-01-30 11:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210129142001.29154.12046@vcs0.savannah.gnu.org>
     [not found] ` <20210129142002.527F320E7B@vcs0.savannah.gnu.org>
2021-01-29 14:29   ` [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands Stefan Monnier
2021-01-30 11:17     ` ian martins [this message]
2021-01-30 14:43       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAC=rjb7HLs8zVtD0JGDbTWrpX3-xvsnh7-30Ck9M_URT75HPxg@mail.gmail.com' \
    --to=ianxm@jhu.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.