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

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

[elpa] externals/shell-command+ 7d39cf5 01/13: Simplify shell-command+--


From: Stefan Monnier
Subject: [elpa] externals/shell-command+ 7d39cf5 01/13: Simplify shell-command+--command-regexp
Date: Sun, 23 May 2021 13:41:25 -0400 (EDT)

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

    Simplify shell-command+--command-regexp
---
 shell-command+.el | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/shell-command+.el b/shell-command+.el
index 7d309d3..2251720 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -91,7 +91,7 @@ handlers if the symbol (eg. `man') is contained in the list."
                 (* (not space)))
          (+ space))
       ;; check for redirection indicator
-      (? (or (group ?<) (group ?>) (group ?|) ?!))
+      (? (group (or ?< ?> ?| ?!)))
       ;; allow whitespace after indicator
       (* space)
       ;; actual command (and command name)
@@ -122,22 +122,20 @@ proper upwards directory pointers.  This means that 
'....' becomes
     (unless (string-match shell-command+--command-regexp command)
       (error "Invalid command"))
     (list (match-string-no-properties 1 command)
-          (cond ((match-string-no-properties 2 command) ;<
+          (cond ((string= (match-string-no-properties 2 command) "<")
                  'input)
-                ((match-string-no-properties 3 command) ;>
+                ((string= (match-string-no-properties 2 command) ">")
                  'output)
-                ((match-string-no-properties 4 command) ;|
+                ((string= (match-string-no-properties 2 command) "|")
                  'pipe))
-          (match-string-no-properties 6 command)
+          (match-string-no-properties 4 command)
           (condition-case nil
               (replace-regexp-in-string
                (rx (* ?\\ ?\\) (or ?\\ (group "%")))
                buffer-file-name
-               (match-string-no-properties 5 command)
+               (match-string-no-properties 3 command)
                nil nil 1)
-            (error (match-string-no-properties 5 command))))))
-
-(shell-command+-parse "ls %")
+            (error (match-string-no-properties 3 command))))))
 
 ;;;###autoload
 (defun shell-command+ (command beg end)



reply via email to

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