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

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

[elpa] externals/shell-command+ 3810586 1/2: Allow disabling file substi


From: ELPA Syncer
Subject: [elpa] externals/shell-command+ 3810586 1/2: Allow disabling file substitution
Date: Sun, 4 Jul 2021 08:57:21 -0400 (EDT)

branch: externals/shell-command+
commit 381058699b2a0f5418998f0f9e84581c2fe9a6b6
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Allow disabling file substitution
---
 shell-command+.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/shell-command+.el b/shell-command+.el
index 79fff81..c0a4ac2 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -88,6 +88,10 @@ handlers if the symbol (eg. `man') is contained in the list."
   "Flip the meaning of < and > at the beginning of a command."
   :type 'boolean)
 
+(defcustom shell-command+-enable-file-substitution t
+  "Enable the substitution of \"%s\" with the current file name."
+  :type 'boolean)
+
 (defcustom shell-command+-substitute-alist
   (cond ((eq shell-command+-use-eshell t)
          (require 'eshell)
@@ -264,11 +268,13 @@ proper upwards directory pointers.  This means that 
'....' becomes
                  'literal))
           (match-string-no-properties 4 command)
           (condition-case nil
-              (replace-regexp-in-string
-               (rx (* ?\\ ?\\) (or ?\\ (group "%")))
-               buffer-file-name
-               (match-string-no-properties 3 command)
-               nil nil 1)
+              (if shell-command+-enable-file-substitution
+                  (replace-regexp-in-string
+                   (rx (* ?\\ ?\\) (or ?\\ (group "%")))
+                   buffer-file-name
+                   (match-string-no-properties 3 command)
+                   nil nil 1)
+                (match-string-no-properties 3 command))
             (error (match-string-no-properties 3 command))))))
 
 ;;;###autoload



reply via email to

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