如何将 ack 与 Mx find-grep 一起使用?
在此留下问题供参考。只有主知道为什么,但从前这对我不起作用,促使我问这个问题,但今天却起作用了。典型的该死的emacs。通常情况下,一旦你与它进行了一些斗争,它就会变得非常快乐。 YMMV。
这两个命令:
find ~/myco -type f -print0 | xargs -0 -e grep -nH -e "setjmp"
在
ack --no-heading --no-color "setjmp" ~/myco
我看来,在终端上产生非常相似的结果。
然而,当我尝试在 emacs 中使用第二个命令作为 Mx find-grep
的命令时,它只是打印结果,而不是像第一个命令那样超链接并突出显示结果。
有人知道发生了什么事吗?在命令行上使用 ack 进行的初步实验表明,它比 find 和 grep 更胜一筹,因此如果能够在 emacs 中使用它就好了。
Leaving question here for reference. The Lord alone knows why, but whereas once upon a time this didn't work for me, prompting me to ask this question, today it does. Typical bloody emacs. Also typically, it is an utter joy once you've wrestled with it a bit. YMMV.
These two commands:
find ~/myco -type f -print0 | xargs -0 -e grep -nH -e "setjmp"
and
ack --no-heading --no-color "setjmp" ~/myco
Seem to me to produce very similar results at the terminal.
And yet when I try to use the second as the command with M-x find-grep
in emacs, it just prints the results, rather than hyperlinking and highlighting them as it would with the first.
Anyone know what is happening? Initial experiments with ack at the command line indicate that it blows find and grep out of the water, so it would be nice to be able to use it from emacs too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Windows 上,我从 find-grep 调用 ack,例如这样:
并且它工作正常。结果在 grep 缓冲区中进行链接和着色。我不知道为什么它对你不起作用,但我可以说它在这里起作用。
emacs 版本:GNU Emacs 23.2.1
ack 版本:1.94
On windows I call ack from find-grep e.g. like this:
and it's working perfectly. The results are linked and colored in the grep buffer. I don't know why it doesn't work for you, but I can say it does work here.
emacs version: GNU Emacs 23.2.1
ack version: 1.94
Emacs 尝试在
grep-mode
的缓冲区中显示find-grep
的输出。显然grep-mode
(惊讶,惊讶)不理解ack
的输出格式。使用专用的ack-mode。Emacs tries to show the output of
find-grep
in a buffer ingrep-mode
. Apparentlygrep-mode
(surprise, surprise) doesn't understand the output format ofack
. Use a dedicated ack-mode.我发现这种确认模式工作得更好,而且开箱即用。如果有更多的颜色就更好了,但至少它是可读的:
https://github.com/sudish /ack-mode.el
I found this ack-mode to work better, and out of the box. Some more coloring would have been nice, but at least it's readable:
https://github.com/sudish/ack-mode.el