[Top][All Lists]

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

[elpa] externals/shell-command+ e965dd4 1/5: fix and improve eshell comm

From: Stefan Monnier
Subject: [elpa] externals/shell-command+ e965dd4 1/5: fix and improve eshell command handling
Date: Sun, 27 Sep 2020 12:03:08 -0400 (EDT)

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

    fix and improve eshell command handling
 shell-command+.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/shell-command+.el b/shell-command+.el
index 32b4fa2..9a51630 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -56,8 +56,11 @@
   :prefix "shell-command+-")
 (defcustom shell-command+-use-eshell t
-  "Check if there is an eshell-handler for each command."
-  :type 'boolean)
+  "Check for eshell handlers.
+If t, always invoke eshell handlers.  If a list, only invoke
+handlers if the symbol (eg. `man') is contained in the list."
+  :type '(choice (boolean :tag "Always active?")
+                 (repeat :tag "Selected commands" symbol)))
 (defconst shell-command+--command-regexp
   (rx bos
@@ -72,8 +75,8 @@
       ;; allow whitespace after indicator
       (* space)
       ;; actual command (and command name)
-      (group (: (group (*? not-newline))
-                (? space))
+      (group (? (group (+ not-newline))
+                (+ space))
              (+ not-newline))
   "Regular expression to parse `shell-command+' input.")
@@ -142,7 +145,8 @@ between BEG and END.  Otherwise the whole buffer is 
                 beg end rest t t
                 shell-command-default-error-buffer t))
-              ((and shell-command+-use-eshell
+              ((and (or (eq shell-command+-use-eshell t)
+                        (memq (intern cmd) shell-command+-use-eshell))
                     (intern-soft (concat "eshell/" cmd)))
                (eshell-command rest (and current-prefix-arg t)))
               (t (shell-command rest (and current-prefix-arg t)

reply via email to

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