From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Newsgroups: gmane.emacs.devel Subject: Re: Occur stack Date: Sat, 18 Jan 2014 17:01:25 +0000 (UTC) Message-ID: References: <52D6D907.4030702@online.de> <52D8E8CB.5080600@online.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1390064527 21917 80.91.229.3 (18 Jan 2014 17:02:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Jan 2014 17:02:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 18 18:02:14 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W4ZHg-0007wv-G4 for ged-emacs-devel@m.gmane.org; Sat, 18 Jan 2014 18:02:12 +0100 Original-Received: from localhost ([::1]:43719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4ZHg-0001tl-4S for ged-emacs-devel@m.gmane.org; Sat, 18 Jan 2014 12:02:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4ZHV-0001jW-O7 for emacs-devel@gnu.org; Sat, 18 Jan 2014 12:02:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4ZHO-00062E-B6 for emacs-devel@gnu.org; Sat, 18 Jan 2014 12:02:01 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:38088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4ZHO-000626-4a for emacs-devel@gnu.org; Sat, 18 Jan 2014 12:01:54 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W4ZHL-0007iq-2m for emacs-devel@gnu.org; Sat, 18 Jan 2014 18:01:51 +0100 Original-Received: from 217-197-183-37.pool.digikabel.hu ([217.197.183.37]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 18 Jan 2014 18:01:51 +0100 Original-Received: from adatgyujto by 217-197-183-37.pool.digikabel.hu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 18 Jan 2014 18:01:51 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 217.197.183.37 (Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168694 Archived-At: Tom 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) (buffer-history-save (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)))) t)))) (add-hook 'grep-mode-hook 'buffer-history-save-grep-find)