[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Occur stack

From: Tom
Subject: Re: Occur stack
Date: Sat, 18 Jan 2014 17:01:25 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Tom <adatgyujto <at> gmail.com> writes:
> Here's an other experimental code which does it the other way:
> it does not store buffer contents, it reruns the command
> instead.
> This way memory is not an issue, because it only stores
> a short description and a restore function, but in this case
> it requires explicit support from the involved commands,
> they need to supply the function for restoring the results.

I added grep-find support too as a test and it was pretty
straightforward. The same method should work for grep too,
only the called function name has to be changed:

(defun buffer-history-save-grep-find ()
  (when (eq this-command 'grep-find)
     (format "in directory '%s': %s"
             default-directory command-args)
     (eval `(let ((dir default-directory)
                  (args command-args))
              (lambda ()
                (let ((default-directory dir))
                  (grep-find args))))

(add-hook 'grep-mode-hook 'buffer-history-save-grep-find)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]