branch: externals/shell-command+ commit a2b30360a18500bc6f9fdeece80c1b7255fd7fec Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Skip environmental variables when parsing a command --- shell-command+.el | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/shell-command+.el b/shell-command+.el index 0d2394e..53aa7dd 100644 --- a/shell-command+.el +++ b/shell-command+.el @@ -237,21 +237,29 @@ If EXPAND is non-nil, expand wildcards." (defconst shell-command+--command-regexp (rx bos - ;; ignore all preceding whitespace + ;; Ignore all preceding whitespace (* space) - ;; check for working directory string + ;; Check for working directory string (? (group (or (: ?. (not (any "/"))) ?/ ?~) (* (not space))) (+ space)) - ;; check for redirection indicator + ;; Check for redirection indicator (? (group (or ?< ?> ?| ?!))) - ;; allow whitespace after indicator + ;; Allow whitespace after indicator (* space) - ;; actual command (and command name) - (group (group (+ (not space))) - (*? space) - (*? not-newline)) - ;; ignore all trailing whitespace + ;; Actual command + (group + ;; Skip environmental variables + (* (: (+ alnum) "=" (or (: ?\" (* (or (: ?\\ anychar) (not (any ?\\ ?\")))) ?\") + (: ?\'(* (or (: ?\\ anychar) (not (any ?\\ ?\')))) ?\') + (+ (not space)))) + (+ space)) + ;; Command name + (group (+ (not space))) + ;; Parse arguments + (*? space) + (*? not-newline)) + ;; Ignore all trailing whitespace (* space) eos) "Regular expression to parse `shell-command+' input.")