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: Wed, 30 Jun 2004 14:38:05 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <4n8ye4dh82.fsf@bwh.harvard.edu> 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> <4nd64ndhdt.fsf@lifelogs.com> <4nllj76uqz.fsf@lifelogs.com> <4n8yf76u05.fsf@lifelogs.com> <4nbrk0651p.fsf@lifelogs.com> <4n8yezqr2r.fsf@lifelogs.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1088621818 475 80.91.224.253 (30 Jun 2004 18:56:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Jun 2004 18:56:58 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Jun 30 20:56: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 1BfkGI-0005yy-00 for ; Wed, 30 Jun 2004 20:56:50 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BfkGH-0006Ww-00 for ; Wed, 30 Jun 2004 20:56:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BfkI0-00089V-Dv for emacs-devel@quimby.gnus.org; Wed, 30 Jun 2004 14:58:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BfkHw-00089E-R5 for emacs-devel@gnu.org; Wed, 30 Jun 2004 14:58:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BfkHw-000892-6G for emacs-devel@gnu.org; Wed, 30 Jun 2004 14:58:32 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BfkHw-00088z-21 for emacs-devel@gnu.org; Wed, 30 Jun 2004 14:58:32 -0400 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BfkG9-0007vc-H5 for emacs-devel@gnu.org; Wed, 30 Jun 2004 14:56:42 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BfkG8-0004GJ-00 for ; Wed, 30 Jun 2004 20:56:40 +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 ; Wed, 30 Jun 2004 20:56:40 +0200 Original-Received: from tzz by asimov.bwh.harvard.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jun 2004 20:56:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 211 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:0g2DVtVcPwa5TzTN2HtkumT2qTM= 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:25337 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25337 --=-=-= On Tue, 08 Jun 2004, rms@gnu.org wrote: > So the coming release needs a manual updated for the current > state of the functionality. I am attaching the simple.el and building.texi patches that add the explanations needed for the new state of things. I believe that from the user's viewpoint the building.texi modifications are all that's needed right now, except that maybe the Occur documentation should be modified to indicate it can use next-error. I made a small mention of the next-error functionality. I am attaching a trivial patch of search.texi in addition to the two above. I made other changes based on a note from Juri Linkov and Jason Rumney. Now, next-error and all associated interactive functions don't require an argument. I *think* this gives us the right effect (it did for me) but please test it if you can. If this patch is OK I can add the ChangeLog entries appropriate. Ted --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=next-error.patch --- /usr/src/emacs/lisp/simple.el 2004-06-30 14:03:13.000000000 -0400 +++ /home/tzz/emacs/mine/simple.el 2004-06-30 14:49:04.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 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. ;; 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 + (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 (not other-buffer) + (next-error-buffer-p (current-buffer) extra-test)) + ;; The current buffer is a next-error capable buffer. + (current-buffer)))) (let ((buffers (buffer-list))) (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) (and other-buffer @@ -133,9 +134,9 @@ (if other-buffer (message "This is the only next-error capable buffer.")) (current-buffer))) - (error "No next-error capable buffer found")))))))) + (error "No next-error capable buffer found!"))))) -(defun next-error (arg &optional reset) +(defun next-error (&optional arg reset) "Visit next next-error message and corresponding source code. If all the error messages parsed so far have been processed already, @@ -153,9 +154,10 @@ buffer with output from the \\[compile], \\[grep] commands, or, more generally, on any buffer in Compilation mode or with Compilation Minor mode enabled, or any buffer in which -`next-error-function' is bound to an appropriate -function. To specify use of a particular buffer for error -messages, type \\[next-error] in that buffer. +`next-error-function' is bound to an appropriate function. To +specify use of a particular buffer for error messages, type +\\[next-error] in that buffer when it is the only one displayed +in the current frame. Once \\[next-error] has chosen the buffer for error messages, it stays with that buffer until you use it in some other buffer which @@ -164,7 +166,9 @@ See variables `compilation-parse-errors-function' and \`compilation-error-regexp-alist' for customization ideas." (interactive "P") - (if (consp arg) (setq reset t arg nil)) + (if (consp arg) + (setq reset t + arg nil)) (when (setq next-error-last-buffer (next-error-find-buffer)) ;; we know here that next-error-function is a valid symbol we can funcall (with-current-buffer next-error-last-buffer @@ -175,7 +179,7 @@ (define-key ctl-x-map "`" 'next-error) -(defun previous-error (n) +(defun previous-error (&optional n) "Visit previous next-error message and corresponding source code. Prefix arg N says how many error messages to move backwards (or @@ -183,9 +187,11 @@ This operates on the output from the \\[compile] and \\[grep] commands." (interactive "p") - (next-error (- n))) + (if n + (next-error (- n)) + (next-error))) -(defun first-error (n) +(defun first-error (&optional n) "Restart at the first error. Visit corresponding source code. With prefix arg N, visit the source code of the Nth error. @@ -193,7 +199,7 @@ (interactive "p") (next-error n t)) -(defun next-error-no-select (n) +(defun next-error-no-select (&optional n) "Move point to the next error in the next-error buffer and highlight match. Prefix arg N says how many error messages to move forwards (or backwards, if negative). @@ -203,14 +209,16 @@ (next-error n) (pop-to-buffer next-error-last-buffer)) -(defun previous-error-no-select (n) +(defun previous-error-no-select (&optional n) "Move point to the previous error in the next-error buffer and highlight match. Prefix arg N says how many error messages to move backwards (or forwards, if negative). Finds and highlights the source line like \\[previous-error], but does not select the source buffer." (interactive "p") - (next-error-no-select (- n))) + (if n + (next-error-no-select (- n)) + (next-error-no-select))) ;;; --- /usr/src/emacs/man/search.texi 2004-06-30 14:16:13.000000000 -0400 +++ /home/tzz/emacs/mine/search.texi 2004-06-30 14:34:40.000000000 -0400 @@ -1268,6 +1268,9 @@ @kbd{o} and @kbd{C-o} display the match in another window; @kbd{C-o} does not select it. +Occur mode supports the @code{next-error} functionality, described in +the section on Compilation. + @item M-x list-matching-lines Synonym for @kbd{M-x occur}. --- /usr/src/emacs/man/building.texi 2004-06-30 14:03:29.000000000 -0400 +++ /home/tzz/emacs/mine/building.texi 2004-06-30 14:52:02.000000000 -0400 @@ -204,6 +204,14 @@ buffer and finds no more error messages to visit, it fails and signals an Emacs error. + You don't have to be in the compilation buffer in order to use +@code{next-error}. If one window on the selected frame can be the +target of the @code{next-error} call, it is used. Else, if a buffer +previously had @code{next-error} called on it, it is used. Else, +if the current buffer can be the target of @code{next-error}, it is +used. Else, all the buffers Emacs manages are tried for +@code{next-error} support. + @kbd{C-u C-x `} starts scanning from the beginning of the compilation buffer. This is one way to process the same set of errors again. --=-=-= 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 --=-=-=--