Change default find-grep command in emacs

When I execute the command find-grepin emacs, I got it find . -type f -exec grep -nH -e {} +, since I use the shell as the default shell, to make this command work, I have to execute find . -type f -exec grep -nH -e \{\} +.

I tried changing the source code of emacs, the following are my changes:

/usr/share/emacs/24.4/lisp/ldefs-boot.el line 12669: If `exec-plus' use `find -exec \{\} +'.

/usr/share/emacs/24.4/lisp/loaddefs.el line 12669: If `exec-plus' use `find -exec \{\} +'.

But it does not make any sense when I perform find-grepshows up find . -type f -exec grep -nH -e {} +. Can someone tell me where I am doing wrong, or how can I find out?

+5
source share
4 answers

, , . , ( , , grep-find-use-xargs). Emacs ; , , grep-find-template , , .emacs/init.el .

(setq grep-find-template
      "find <D> <X> -type f <F> -exec grep <C> -nH -e <R> \\{\\} +")

. , , (ctrl-h v grep-find-template RET).

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/grep.el#n174, . Emacs. .

+4

grep-apply-setting grep-find-command :

(grep-apply-setting 'grep-find-command "find . -type f -exec grep -nH -e  \\{\\} +")
+3
(grep-apply-setting 'grep-find-command '("find . -type f -exec grep -nH -e  \\{\\} +" . 34))

-e

+3

, - . , emacs .

(defun grep-find-newer-shallow ()
  (interactive)
  (let ((gfc grep-find-command))
    (grep-apply-setting 'grep-find-command '("find . -maxdepth 2 -type f ! -name '*#' -mtime -7 -exec grep -nH -e  \\{\\} +" . 69))
    (call-interactively 'grep-find)
    (grep-apply-setting 'grep-find-command gfc)))
+1

All Articles