em-unix.el: only pass -H option to grep

* lisp/eshell/em-unix.el (eshell-grep): Don't add -H, because that
breaks agrep/glimpse etc (bug#57247).
(eshell/grep, eshell/egrep, eshell/fgrep): Instead add it here.
This commit is contained in:
Brendan O'Dea 2022-08-17 13:20:15 +02:00 committed by Lars Ingebrigtsen
parent 4915ca5dd4
commit deddd56e35

View file

@ -755,26 +755,21 @@ external command."
(eshell-stringify-list
(flatten-tree args)))
" "))
(cmd (format "%s -nH %s"
(pcase command
("egrep" "grep -E")
("fgrep" "grep -F")
(x x))
args))
(cmd (format "%s -n %s" command args))
compilation-scroll-output)
(grep cmd)))))
(defun eshell/grep (&rest args)
"Use Emacs grep facility instead of calling external grep."
(eshell-grep "grep" args t))
(eshell-grep "grep" (append '("-H") args) t))
(defun eshell/egrep (&rest args)
"Use Emacs grep facility instead of calling external grep -E."
(eshell-grep "egrep" args t))
(eshell-grep "grep" (append '("-EH") args) t))
(defun eshell/fgrep (&rest args)
"Use Emacs grep facility instead of calling external grep -F."
(eshell-grep "fgrep" args t))
(eshell-grep "grep" (append '("-FH") args) t))
(defun eshell/agrep (&rest args)
"Use Emacs grep facility instead of calling external agrep."