From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: next-error-last-buffer Date: Sat, 29 May 2004 00:55:32 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87hdu0fcez.fsf@mail.jurta.org> References: <871xluig40.fsf@mail.jurta.org> <87u0y6jjq9.fsf@mail.jurta.org> <87n03wgt76.fsf@mail.jurta.org> <4nd64rl2ah.fsf@lifelogs.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1085798691 16112 80.91.224.253 (29 May 2004 02:44:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 29 May 2004 02:44:51 +0000 (UTC) Cc: tzz@lifelogs.com, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat May 29 04:44:43 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 1BTtpz-0001lT-00 for ; Sat, 29 May 2004 04:44:43 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BTtpy-0000Gr-00 for ; Sat, 29 May 2004 04:44:43 +0200 Original-Received: from [127.0.0.1] (helo=mailman.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BTtq2-0001FD-HM for emacs-devel@quimby.gnus.org; Fri, 28 May 2004 22:44:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BTtjV-0005tC-0V for emacs-devel@gnu.org; Fri, 28 May 2004 22:38:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BTtjR-0005rz-VG for emacs-devel@gnu.org; Fri, 28 May 2004 22:37:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BTtjQ-0005rX-JL for emacs-devel@gnu.org; Fri, 28 May 2004 22:37:56 -0400 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BTpIo-00067J-2j; Fri, 28 May 2004 17:54:10 -0400 Original-Received: from mail.jurta.org (80-235-39-226-dsl.mus.estpak.ee [80.235.39.226]) by spork.dreamhost.com (Postfix) with ESMTP id EB35D11DC0E; Fri, 28 May 2004 14:54:06 -0700 (PDT) Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "28 May 2004 11:29:00 -0400") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 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:24112 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24112 Stefan Monnier writes: > A less intrusive (and hence less complete) solution: > > - Create a new compilation-last-source-buffer variable. > - At the end of next-error, set this new variable to the buffer just being > displayed. > - at the beginning of next-error check compilation-last-source-buffer: > if it is equal to current-buffer, then don't consider this buffer as > a "compilation" buffer (i.e. ignore its next-error-function). > > This way if a C-x ` lands us in a diff-mode buffer (because of a *grep* that > points to a patch file), a subsequent C-x ` in the same buffer will not > mistakenly step through the diffs of this buffer but will go to the next > grep match. For clarity I'd rewrite your solution as a next-error-find-buffer rule: 1. If the current next-error capable buffer is not the last source buffer. 2. If one window on the selected frame displays such buffer, return it. 3. If next-error-last-buffer is set to a live buffer, use that. ... This will solve the problem. Perhaps there are situations where it may not work, for example, when the user switches the source buffers. But it's impossible to guess whether he switched the source buffer with the intention to start going through the diffs or he wants to continue visiting grep results. In the latter case, he can select the *grep* window and type C-m or C-c C-c to go to the next grep match instead of starting to visit the diffs. So I think your solution will produce the expected behavior. -- Juri Linkov http://www.jurta.org/emacs/