emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/shell-command+ 6c7a95b 08/13: Fix quoted shell expansio


From: Stefan Monnier
Subject: [elpa] externals/shell-command+ 6c7a95b 08/13: Fix quoted shell expansion
Date: Sun, 23 May 2021 13:41:27 -0400 (EDT)

branch: externals/shell-command+
commit 6c7a95ba93ceef646e2623c5437390ae672600da
Author: Philip K <philipk@posteo.net>
Commit: Philip K <philipk@posteo.net>

    Fix quoted shell expansion
---
 shell-command+.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/shell-command+.el b/shell-command+.el
index 43fd286..6d9a3aa 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -143,17 +143,19 @@ If EXPAND is non-nil, expand wildcards."
                 (or (: ?\" (group (* (not ?\"))) ?\")
                     (: (group (+ (not (any ?\" space)))))))
             (substring command pos))
-      (push (if (and expand (match-data 2))
-                (let ((tok (match-string 2 (substring command pos))))
-                  (or (file-expand-wildcards tok) (list tok)))
-              (list (or (match-string 2 (substring command pos))
-                        (match-string 1 (substring command pos)))))
+      (push (let ((tok (match-string 2 (substring command pos))))
+              (if (and expand tok)
+                  (or (file-expand-wildcards tok) (list tok))
+                (list (or (match-string 2 (substring command pos))
+                          (match-string 1 (substring command pos))))))
             tokens)
       (setq pos (+ pos (match-end 0))))
     (unless (= pos (length command))
       (error "Tokenization error at %s" (substring command pos)))
     (apply #'append (nreverse tokens))))
 
+(shell-command+-tokenize "a \"*\" *.el c" t)
+
 (defun shell-command+-cmd-grep (command)
   "Convert COMMAND into a `grep' call."
   (grep (mapconcat #'identity (shell-command+-tokenize command t) " ")))



reply via email to

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