[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Occur stack
From: |
Tom |
Subject: |
Re: Occur stack |
Date: |
Thu, 16 Jan 2014 17:19:11 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Tom <adatgyujto <at> gmail.com> writes:
>
> The code is generic, so in theory it can work for other
> commands too, but I only tested it with occur.
>
I tried it with grep too, specifically grep-find. You need to
add the saving function to compilation-finish-functions:
(defun buffer-history-grep-save (buf result)
(if (and (eq major-mode 'grep-mode)
(equal result "finished\n"))
(buffer-history-save)))
(add-hook 'compilation-finish-functions 'buffer-history-grep-save)
If you do some grepping and then run M-x buffer-history-list
in the *grep* buffer then you can see your previous greps
and you can restore them.
The listing is not as useful as with occur, because this
simple implementation only takes the first line of the
output, assuming it describes the contents which is true
for occur, but not really true for grep-find. It only gives
you the directory, so a proper implementation should be more
clever about that, it should have a way to retrieve the relevant
inputs from the target command.
Another thing is that unlike occur it does not work seamlessly
if you do grep-find in different directories, because the
results are displayed as relative file names, so default-directory
should be restored too.
A proper implementation should restore the buffer local variables too
in addition to the buffer contents.
- Re: Occur stack, (continued)
- Re: Occur stack, Juri Linkov, 2014/01/16
- Re: Occur stack, David Kastrup, 2014/01/16
- Re: Occur stack, Lars Ingebrigtsen, 2014/01/16
- Re: Occur stack, David Kastrup, 2014/01/16
- Re: Occur stack, Stefan Monnier, 2014/01/16
- Re: Occur stack, David Kastrup, 2014/01/16
- Re: Occur stack, Lars Ingebrigtsen, 2014/01/17
- Re: Occur stack, Tom, 2014/01/14
Re: Occur stack, Andreas Röhler, 2014/01/15
Re: Occur stack, Tom, 2014/01/17
Re: Occur stack, Tom, 2014/01/18
Re: Occur stack, Stefan Monnier, 2014/01/18
Re: Occur stack, Tom, 2014/01/19
Re: Occur stack, Daniel Colascione, 2014/01/19
Re: Occur stack, Stefan Monnier, 2014/01/19