简体   繁体   English

在Emacs中,是否可以克隆* grep *或* compile *缓冲区并保留搜索/选择功能?

[英]In Emacs is it possible to clone a *grep* or *compile* buffer and retain the search/select capability?

I do a lot of searching through hostile code-bases with grep and find in emacs. 我通过grep在恶意代码库中进行了大量搜索,并在emacs中查找。

I'd like to be able to stash the results of a grep including its context (ie base directory) and the results hyperlinks into the files, such that I can fire off a bunch of other grep calls, but still return to the earlier set of results if those results turned up nothing. 我希望能够将包含其上下文(即基本目录)的grep结果和结果超链接存储到文件中,以便我可以触发一堆其他grep调用,但仍然返回到先前的设置结果如果那些结果没有结果。

A similar feature for the *compile* buffer would be helpful too. *compile*缓冲区的类似功能也很有用。

You don't need to clone the buffer. 您不需要克隆缓冲区。 Just rename the *grep* buffer with Mx rename-buffer . 只需使用Mx rename-buffer重命名*grep* Mx rename-buffer Then the next time you do a grep it will create a new *grep* buffer. 然后在下次执行grep ,它将创建一个新的*grep*缓冲区。

Ok, while trying to work out how to ask the question I accidentally found the answer. 好的,在试图弄清楚如何提出问题时,我意外地找到了答案。

M-x clone-buffer

will duplicate the *grep* buffer into *grep*<n> with all of its properties intact, and future greps will go back to the normal *grep* buffer, thus leaving your new clone intact. *grep*缓冲区复制到*grep*<n> ,其所有属性都保持不变,未来的greps将返回到正常的*grep*缓冲区,从而使新的克隆保持原样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM