branch: externals/shell-command+
commit c190d6c6be78d001d8aec4ec295c8c47b81a3fdc
Author: Philip K <[email protected]>
Commit: Philip K <[email protected]>
Add shell-command+-flip-redirection option
---
shell-command+.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/shell-command+.el b/shell-command+.el
index 2251720..1bf54b1 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -82,6 +82,10 @@ handlers if the symbol (eg. `man') is contained in the list."
"Prompt to use when invoking `shell-command+'."
:type 'string)
+(defcustom shell-command+-flip-redirection nil
+ "Flip the meaning of < and > at the beginning of a command."
+ :type 'boolean)
+
(defconst shell-command+--command-regexp
(rx bos
;; ignore all preceding whitespace
@@ -123,9 +127,11 @@ proper upwards directory pointers. This means that '....'
becomes
(error "Invalid command"))
(list (match-string-no-properties 1 command)
(cond ((string= (match-string-no-properties 2 command) "<")
- 'input)
+ (if shell-command+-flip-redirection
+ 'output 'input))
((string= (match-string-no-properties 2 command) ">")
- 'output)
+ (if shell-command+-flip-redirection
+ 'input 'output))
((string= (match-string-no-properties 2 command) "|")
'pipe))
(match-string-no-properties 4 command)