2

I am using the grep.el package and was wondering if there is a way to have the regular expression I am grepping on highlighted at the top of the grep window. Something like:

grep [reg expr]   ;Where [] highlighted
....results of grep....

Or at least at the title of window at the bottom something like:

*grep* [reg exp]
4

1 回答 1

1

根据您在 help-gnu-emacs@gnu.org 上的通信,您不需要突出显示正则表达式,因为您需要能够识别它(查看它)。

为此,答案是重复命令(例如grepor grep-find),然后用于M-p查看您之前的输入,包括使用的正则表达式。

从那个通信看来,您正在使用grep-find. 在这种情况下,正则表达式是您输入的完整 shell 命令的一部分,这是 Emacs 看到的唯一内容(并记住,并通过 提供M-p)。

如果将正则表达式视为M-p显示内容的一部分对您来说还不够好,那么您将需要获取先前输入的命令与 variable 的值之间的字符串差异grep-find-command,这是输入正则表达式的模板。如果您没有将模板中的任何其他内容更改为您输入的完整命令,那么两者之间的区别就是您的正则表达式。

于 2013-09-05T03:37:01.987 回答