在emacs中更改默认的find-grep命令 [英] Change the default find-grep command in emacs

查看:124
本文介绍了在emacs中更改默认的find-grep命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在emacs中执行 find-grep 命令时,我得到 find。 -fcexec grep -nH -e {} + ,因为我使用的是shell shell作为默认shell,为了使这个命令工作,我必须执行 find。 -fcexec grep -nH -e \ {\} +

When I execute find-grep command in emacs, I got find . -type f -exec grep -nH -e {} +, since I'm using fish shell as the default shell, to make this command work I have to execute find . -type f -exec grep -nH -e \{\} +.

我试图修改下面的emacs源代码是我的更改:

I tried to modify the emacs source code, below are my changes:

/usr/share/emacs/24.4/lisp/ldefs-boot.el line 12669 :如果`exec-plus'使用`find -exec \ {\} +'。

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

code> /usr/share/emacs/24.4/lisp/loaddefs.el line 12669:如果`exec-plus'使用`find -exec \ {\\ \\} +'。

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

但是,当我执行 find-grep 仍显示 find。 -type f -exec grep -nH -e {} + 。任何人都可以告诉我我在做错什么,我该怎么弄清楚?

But it doesn't make any sense, when I execute find-grep still shows find . -type f -exec grep -nH -e {} +. Can anyone tell me where I am doing wrong or how should I figure out this?

推荐答案

你改变的文字看起来不像可执行代码。可能你刚刚更改了一个文档字符串(实际上,有一点谷歌显示这是在 grep-find-use-xargs )。但是Emacs非常可定制;所有你需要做的是将 grep-find-template 的值设置为更适合您的个人,在您自己的 .emacs /init.el 或类似的。

The text you changed does not look like executable code. Probably you just changed a doc string (actually, a bit of googling reveals that this is in the documentation string for grep-find-use-xargs). But Emacs is eminently customizable; all you have to do is to set the value of grep-find-template to something which is more suitable for you personally, in your own .emacs/init.el or similar.

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

请参阅手册进一步的文档,当然还有内置文档( ctrl-h v grep-find-template RET )。

See the manual for further documentation and, of course, the built-in documentation (ctrl-h v grep-find-template RET).

实际的源代码在 http://git.savannah.gnu.org/cgit/ emacs.git / tree / lisp / progmodes / grep.el#n174

这篇关于在emacs中更改默认的find-grep命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆