From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: next-error-last-buffer Date: Fri, 28 May 2004 23:47:10 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <4nd64ndhdt.fsf@lifelogs.com> References: <871xluig40.fsf@mail.jurta.org> <87u0y6jjq9.fsf@mail.jurta.org> <4nwu31j4ff.fsf@lifelogs.com> <87zn7wgtel.fsf@mail.jurta.org> <4nu0y0ef4z.fsf@lifelogs.com> <87n03sfd1x.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1085806533 29247 80.91.224.253 (29 May 2004 04:55:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 29 May 2004 04:55:33 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat May 29 06:55:28 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 1BTvsW-0007ek-00 for ; Sat, 29 May 2004 06:55:28 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BTvsW-0003Bs-00 for ; Sat, 29 May 2004 06:55:28 +0200 Original-Received: from [127.0.0.1] (helo=mailman.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BTvsa-0006gh-5t for emacs-devel@quimby.gnus.org; Sat, 29 May 2004 00:55:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BTvsX-0006gH-CU for emacs-devel@gnu.org; Sat, 29 May 2004 00:55:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BTvsW-0006g5-Of for emacs-devel@gnu.org; Sat, 29 May 2004 00:55:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BTvsW-0006g2-MI for emacs-devel@gnu.org; Sat, 29 May 2004 00:55:28 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BTvqV-00012r-GP for emacs-devel@gnu.org; Sat, 29 May 2004 00:53:23 -0400 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by mx20.gnu.org with esmtp (Exim 4.34) id 1BTv63-0001p9-Ia for emacs-devel@gnu.org; Sat, 29 May 2004 00:05:27 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BTv52-0004lM-00 for ; Sat, 29 May 2004 06:04:20 +0200 Original-Received: from asimov.bwh.harvard.edu ([134.174.9.63]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 29 May 2004 06:04:20 +0200 Original-Received: from tzz by asimov.bwh.harvard.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 29 May 2004 06:04:20 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 175 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: asimov.bwh.harvard.edu X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:GOadBAJMXnQrWAO0PwPFK2oaeDU= 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:24127 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24127 --=-=-= On Sat, 29 May 2004, juri@jurta.org wrote: > But there is even simpler solution for the user to select a buffer > for the next C-x `. > > Taking into account the recent addition of a rule in > `next-error-find-buffer' which returns a buffer which is displayed > only in one window with a next-error capable buffer on the selected > frame, the user can simply remove the unwanted window with a > next-error capable buffer (e.g. *grep* buffer in the aforementioned > test case) from the selected frame and C-x ` will use the buffer from > the remaining window (e.g. a patch file) even if it is not the same as > next-error-last-buffer. Nice, that simplifies things a lot. > So the only change needed is to modify the rule order like you proposed, > which could look as below: > > 1. If one window on the selected frame displays such buffer, return it. > 2. If next-error-last-buffer is set to a live buffer, use that. > 3. If the current buffer is a next-error capable buffer, return it. > ... Patch attached (unified and context). Ted --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=simple.patch --- lisp/simple.el 2004-05-29 23:02:38.000000000 -0400 +++ /home/tzz/emacs/mine/simple.el 2004-05-29 23:04:45.000000000 -0400 @@ -92,33 +92,34 @@ next-error-function))) ;; Return a next-error capable buffer according to the following rules: -;; 1. If the current buffer is a next-error capable buffer, return it. -;; 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. +;; 1. If next-error-last-buffer is set to a live buffer, use that. +;; 2. If the current buffer is a next-error capable buffer, return it. +;; 3. If one window on the selected frame displays such buffer, return it. ;; 4. Otherwise, look for a next-error capable buffer in a buffer list. ;; 5. Signal an error if there are none. (defun next-error-find-buffer (&optional other-buffer extra-test) - (if (and (not other-buffer) - (next-error-buffer-p (current-buffer) extra-test)) - ;; The current buffer is a next-error capable buffer. - (current-buffer) - (or - (let ((window-buffers - (delete-dups - (delq nil - (mapcar (lambda (w) - (and (next-error-buffer-p (window-buffer w) extra-test) - (window-buffer w))) - (window-list)))))) - (if other-buffer - (setq window-buffers (delq (current-buffer) window-buffers))) - (if (eq (length window-buffers) 1) - (car window-buffers))) - (if (and next-error-last-buffer (buffer-name next-error-last-buffer) - (next-error-buffer-p next-error-last-buffer extra-test) - (or (not other-buffer) (not (eq next-error-last-buffer - (current-buffer))))) - next-error-last-buffer + (if (and next-error-last-buffer + (buffer-name next-error-last-buffer) + (next-error-buffer-p next-error-last-buffer extra-test) + (or (not other-buffer) + (not (eq next-error-last-buffer (current-buffer))))) + next-error-last-buffer + (if (and (not other-buffer) + (next-error-buffer-p (current-buffer) extra-test)) + ;; The current buffer is a next-error capable buffer. + (current-buffer) + (or + (let ((window-buffers + (delete-dups + (delq nil + (mapcar (lambda (w) + (and (next-error-buffer-p (window-buffer w) extra-test) + (window-buffer w))) + (window-list)))))) + (if other-buffer + (setq window-buffers (delq (current-buffer) window-buffers))) + (if (eq (length window-buffers) 1) + (car window-buffers))) (let ((buffers (buffer-list))) (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) (and other-buffer --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=simple.context.patch *** lisp/simple.el Sat May 29 23:02:38 2004 --- /home/tzz/emacs/mine/simple.el Sat May 29 23:04:45 2004 *************** *** 92,124 **** next-error-function))) ;; Return a next-error capable buffer according to the following rules: ! ;; 1. If the current buffer is a next-error capable buffer, return it. ! ;; 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. ;; 4. Otherwise, look for a next-error capable buffer in a buffer list. ;; 5. Signal an error if there are none. (defun next-error-find-buffer (&optional other-buffer extra-test) ! (if (and (not other-buffer) ! (next-error-buffer-p (current-buffer) extra-test)) ! ;; The current buffer is a next-error capable buffer. ! (current-buffer) ! (or ! (let ((window-buffers ! (delete-dups ! (delq nil ! (mapcar (lambda (w) ! (and (next-error-buffer-p (window-buffer w) extra-test) ! (window-buffer w))) ! (window-list)))))) ! (if other-buffer ! (setq window-buffers (delq (current-buffer) window-buffers))) ! (if (eq (length window-buffers) 1) ! (car window-buffers))) ! (if (and next-error-last-buffer (buffer-name next-error-last-buffer) ! (next-error-buffer-p next-error-last-buffer extra-test) ! (or (not other-buffer) (not (eq next-error-last-buffer ! (current-buffer))))) ! next-error-last-buffer (let ((buffers (buffer-list))) (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) (and other-buffer --- 92,125 ---- next-error-function))) ;; Return a next-error capable buffer according to the following rules: ! ;; 1. If next-error-last-buffer is set to a live buffer, use that. ! ;; 2. If the current buffer is a next-error capable buffer, return it. ! ;; 3. If one window on the selected frame displays such buffer, return it. ;; 4. Otherwise, look for a next-error capable buffer in a buffer list. ;; 5. Signal an error if there are none. (defun next-error-find-buffer (&optional other-buffer extra-test) ! (if (and next-error-last-buffer ! (buffer-name next-error-last-buffer) ! (next-error-buffer-p next-error-last-buffer extra-test) ! (or (not other-buffer) ! (not (eq next-error-last-buffer (current-buffer))))) ! next-error-last-buffer ! (if (and (not other-buffer) ! (next-error-buffer-p (current-buffer) extra-test)) ! ;; The current buffer is a next-error capable buffer. ! (current-buffer) ! (or ! (let ((window-buffers ! (delete-dups ! (delq nil ! (mapcar (lambda (w) ! (and (next-error-buffer-p (window-buffer w) extra-test) ! (window-buffer w))) ! (window-list)))))) ! (if other-buffer ! (setq window-buffers (delq (current-buffer) window-buffers))) ! (if (eq (length window-buffers) 1) ! (car window-buffers))) (let ((buffers (buffer-list))) (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) (and other-buffer --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--