* Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands [not found] ` <20210129142002.527F320E7B@vcs0.savannah.gnu.org> @ 2021-01-29 14:29 ` Stefan Monnier 2021-01-30 11:17 ` ian martins 0 siblings, 1 reply; 3+ messages in thread From: Stefan Monnier @ 2021-01-29 14:29 UTC (permalink / raw) To: Ian Martins; +Cc: emacs-devel > May be either a command in the path, like \"neko\" or the full > -path to the executable, like \"/usr/local/bin/neko\". Double > -quotes must be escaped. This is run in a shell." > +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). > @@ -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. Stefan ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands 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 2021-01-30 14:43 ` Stefan Monnier 0 siblings, 1 reply; 3+ messages in thread From: ian martins @ 2021-01-30 11:17 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel > > +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. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands 2021-01-30 11:17 ` ian martins @ 2021-01-30 14:43 ` Stefan Monnier 0 siblings, 0 replies; 3+ messages in thread From: Stefan Monnier @ 2021-01-30 14:43 UTC (permalink / raw) To: ian martins; +Cc: emacs-devel > I've read a lot of the elisp docs but am unfamiliar with most of the > builtin functions in emacs core. That's the rule rather than the exception ;-) > I should probably start from the assumption that whatever I want to do > is in there somewhere and search before writing anything new. But that's risking not writing anything new ever, Stefan ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-30 14:43 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 2021-01-30 14:43 ` Stefan Monnier
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.