From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Add M-x occur to the menu-bar Date: 05 Feb 2004 00:20:20 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <3F69E6FF.9050702@yahoo.com> <4n8yjto16h.fsf@collins.bwh.harvard.edu> <4nisixjibl.fsf@collins.bwh.harvard.edu> <20040127230323.GB5407@fencepost> <4n7jzc919v.fsf@collins.bwh.harvard.edu> <4nn085i7nl.fsf@collins.bwh.harvard.edu> <4noese37h0.fsf@collins.bwh.harvard.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1075933496 7273 80.91.224.253 (4 Feb 2004 22:24:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Feb 2004 22:24:56 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Feb 04 23:24:50 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AoVRy-0000oe-00 for ; Wed, 04 Feb 2004 23:24:50 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AoVRx-00046n-00 for ; Wed, 04 Feb 2004 23:24:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AoVQP-0000CS-EY for emacs-devel@quimby.gnus.org; Wed, 04 Feb 2004 17:23:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AoVP2-0007aX-V1 for emacs-devel@gnu.org; Wed, 04 Feb 2004 17:21:48 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AoVO2-00060I-5j for emacs-devel@gnu.org; Wed, 04 Feb 2004 17:21:19 -0500 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AoVNn-0005cF-5f for emacs-devel@gnu.org; Wed, 04 Feb 2004 17:20:31 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepc.post.tele.dk (Postfix) with SMTP id 9971D262B53; Wed, 4 Feb 2004 23:20:23 +0100 (CET) Original-To: Ted Zlatanov In-Reply-To: <4noese37h0.fsf@collins.bwh.harvard.edu> Original-Lines: 48 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19718 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19718 Ted Zlatanov writes: > On Fri, 30 Jan 2004, tzz@lifelogs.com wrote: > > I'm sure the code needs corrections, so feel free to critique. The > diff should have been done at the same, level too... It should be > enough to get the idea across. Maybe a more generic approach could be used: Let compile.el define a buffer-local compilation-next-error-function variable (default value nil) which can be bound in the *occur* buffer to #'occur-next (or whatever). Then (the original) next-error function is modified to do this: (setq compilation-last-buffer (compilation-find-buffer)) (if (buffer-local-value 'compilation-next-error-function compilation-last-buffer) (funcall compilation-next-error-function argp) ... do what next-error used to do ... ) With this approach, compile.el doesn't need to know anything about occur mode, and future similar modes can hook themselves into next-error without modifying compile.el any further. With this change, occur need to set compilation-last-buffer to the *occur* buffer and bind compilation-next-error-function in that buffer to #'occur-next. BTW, here are some comments on your patch: > > If occur has not been loaded at all (checked by soft-intern of > "occur-last-buffer") next-error behaves exactly as before, looking at > grep and compile output. IMO, it would be cleaner to add (provide 'occur) to replace.el and just test with (featurep 'occur). You can then add (defvar occur-last-buffer) to compile.el to avoid byte-compiler warnings. The autoload of occur-next should be done as an autoload cookie in occur.el But I don't see why do you need it at all? -- Kim F. Storm http://www.cua.dk