From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.devel Subject: Re: Occur stack Date: Fri, 17 Jan 2014 09:24:43 +0100 Message-ID: <52D8E8CB.5080600@online.de> References: <52D6D907.4030702@online.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389946870 3116 80.91.229.3 (17 Jan 2014 08:21:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2014 08:21:10 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 17 09:21:17 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 1W44fz-0003Dr-PY for ged-emacs-devel@m.gmane.org; Fri, 17 Jan 2014 09:21:15 +0100 Original-Received: from localhost ([::1]:36790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44fz-0006iB-A2 for ged-emacs-devel@m.gmane.org; Fri, 17 Jan 2014 03:21:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44fp-0006i1-JL for emacs-devel@gnu.org; Fri, 17 Jan 2014 03:21:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W44fi-00058G-9K for emacs-devel@gnu.org; Fri, 17 Jan 2014 03:21:05 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.171]:59152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44fh-00058C-Uc for emacs-devel@gnu.org; Fri, 17 Jan 2014 03:20:58 -0500 Original-Received: from purzel.sitgens (brln-4d0c7e78.pool.mediaWays.net [77.12.126.120]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0LzDcL-1VHj8g3AOH-014WC6; Fri, 17 Jan 2014 09:20:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-Provags-ID: V02:K0:J1h3E4aJ8pnkaFdp7xdA2EFeM+p5eFeqkfHzAszR5r6 s0mrWhKvVpZNLUeCgFo/fVbKEc8/NBV4owmimBOVU7jczxMpMP 6gqFNEhz66GGRYh2iPfU3QjHUPyrQK3NM/ospcOLlsitGfgShR hX+oKljfmcbSKRt8A5u5JAsKRJrlyE/zob7DQ3eiE2HMaQrYjH NsHly8zm0xtgIphSkQ2VESkC85FM6urFruPIeRHlWguFb/nBcB MPHXe3HsP3oAYyxdbLMnnY52AinKIkh4dpEt1jZrYGF+hLRnDT 90iIJvelbNXY/CW9vuUIOZOryoiboV+rq/FojoJ0FPPn7bVOcB mSQWiaritNT57sYUY0Z8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.126.171 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:168596 Archived-At: Am 16.01.2014 18:19, schrieb Tom: > Tom 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. > > > Hi Tom, works for me, great, thanks! BTW needed a (require 'cl) still. In cases where a plenty of occur-calls is done, maybe the discussion WRT to memory pertains? Andreas