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: 07 Feb 2004 00:57:52 +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> <4nbrodxwqm.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 1076108959 20688 80.91.224.253 (6 Feb 2004 23:09:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2004 23:09:19 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Feb 07 00:09:12 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 1ApF60-0003yg-00 for ; Sat, 07 Feb 2004 00:09:12 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ApF5z-00084l-00 for ; Sat, 07 Feb 2004 00:09:12 +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 1ApEyU-0006XT-PD for emacs-devel@quimby.gnus.org; Fri, 06 Feb 2004 18:01:26 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ApEvp-0005b2-SM for emacs-devel@gnu.org; Fri, 06 Feb 2004 17:58:41 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ApEvE-0005I7-Ji for emacs-devel@gnu.org; Fri, 06 Feb 2004 17:58:35 -0500 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ApEvD-0005HC-Ne for emacs-devel@gnu.org; Fri, 06 Feb 2004 17:58:03 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepb.post.tele.dk (Postfix) with SMTP id C45CE5EE2D2; Fri, 6 Feb 2004 23:58:00 +0100 (CET) Original-To: Ted Zlatanov In-Reply-To: <4nbrodxwqm.fsf@collins.bwh.harvard.edu> Original-Lines: 78 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:19776 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19776 Ted Zlatanov writes: > I see, that is indeed a much better solution. I've reworked the patch > to do what you suggest; Yes, it is much cleaner now, and you are almost there. > only the universal-prefix is not handled by > occur-next-error. It is much better from the perspective of > occur-mode, but I had to modify compilation-find-buffer and > compilation-buffer-p to avoid complicating next-error. Anyhow, see > what you think. I haven't thought a lot about it, but I don't understand why you need that extra allow-with-next-error-function arg to compilation-buffer-p and compilation-find-buffer. If you simply change compilation-buffer-p to (defsubst compilation-buffer-p (buffer) (save-excursion (set-buffer buffer) (or compilation-shell-minor-mode compilation-minor-mode (eq major-mode 'compilation-mode) compilation-next-error-function))) it will always consider an occur buffer (and other buffers which have a non-nil compilation-next-error-function) as a compilation buffer. To me that would seem logical, but I'm probably overlooking something. Can you mention the commands where is that behaviour NOT desireable, and why? In any case, here are some comments on your latest patch: > > (save-excursion > (set-buffer buffer) > - (or compilation-shell-minor-mode compilation-minor-mode > - (eq major-mode 'compilation-mode)))) > + (or compilation-shell-minor-mode > + compilation-minor-mode > + (eq major-mode 'compilation-mode) > + (and allow-with-next-error-function > + (buffer-local-value > + 'compilation-next-error-function > + buffer))))) For the last four lines, you can just write (and allow-with-next-error-function compilation-next-error-function) as you already did a (set-buffer buffer), so there's no reason to use buffer-local-value here. > > +;; override compilation-last-buffer > +(defvar occur-last-buffer nil > + "The most recent occur buffer. > +An occur buffer becomes most recent when its process is started > +or when it is used with \\[occur-next]. > +Notice that using \\[next-error] or \\[compile-goto-error] modifies > +`complation-last-buffer' rather than `occur-last-buffer'.") > + You no longer need the occur-last-buffer variable. > + (setq occur-last-buffer occur-buf) Likewise. -- Kim F. Storm http://www.cua.dk