branch: externals/shell-command+
commit 794242809672be8e78182e1d4164abc114f158c8
Author: Philip Kaludercic <phil...@posteo.net>
Commit: Philip Kaludercic <phil...@posteo.net>

    Insert expected flags into grep command
---
 shell-command+.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/shell-command+.el b/shell-command+.el
index aaad41d..79fff81 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -156,7 +156,13 @@ If EXPAND is non-nil, expand wildcards."
 
 (defun shell-command+-cmd-grep (command)
   "Convert COMMAND into a `grep' call."
-  (grep (mapconcat #'identity (shell-command+-tokenize command t) " ")))
+  (grep-compute-defaults)
+  (pcase-let ((`(,cmd . ,args) (shell-command+-tokenize command t)))
+    (grep (mapconcat #'identity
+                     (cons (replace-regexp-in-string
+                            (concat "\\`" grep-program) cmd grep-command)
+                           args)
+                     " "))))
 
 (defun shell-command+-cmd-find (command)
   "Convert COMMAND into a `find-dired' call."

Reply via email to