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 refactoring Date: Mon, 13 Sep 2004 14:56:43 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <4ny8je80b8.fsf@lifelogs.com> References: <87llk552oz.fsf@mail.jurta.org> <87isf6e7ji.fsf@mail.jurta.org> <87iseg4x5d.fsf@mail.jurta.org> <4npt8oeet9.fsf_-_@lifelogs.com> <4nd64j6u3p.fsf@lifelogs.com> <4n3c5c64mx.fsf@lifelogs.com> <4nhdtnqrek.fsf@lifelogs.com> <4n659yhrby.fsf@lifelogs.com> <4nzn6kc2fg.fsf@lifelogs.com> <87n02kl1in.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1095103264 19219 80.91.229.6 (13 Sep 2004 19:21:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Sep 2004 19:21:04 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 13 21:20:26 2004 Return-path: Original-Received: from hermes.netfonds.no ([80.91.224.195]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C6wNG-0001kk-00 for ; Mon, 13 Sep 2004 21:20:26 +0200 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by hermes.netfonds.no (8.12.8p1/8.12.8) with ESMTP id i8DJFrOn000816 for ; Mon, 13 Sep 2004 21:15:54 +0200 (CEST) Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6wOP-0005tG-EA for ged-emacs-devel@m.gmane.org; Mon, 13 Sep 2004 15:21:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6wOH-0005sy-5t for emacs-devel@gnu.org; Mon, 13 Sep 2004 15:21:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6wOF-0005sa-Jr for emacs-devel@gnu.org; Mon, 13 Sep 2004 15:21:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6wOF-0005sW-Gr for emacs-devel@gnu.org; Mon, 13 Sep 2004 15:21:27 -0400 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C6wIf-0006Gg-AH for emacs-devel@gnu.org; Mon, 13 Sep 2004 15:15:41 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1C6wIe-0001lU-00 for ; Mon, 13 Sep 2004 21:15: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 ; Mon, 13 Sep 2004 21:15:40 +0200 Original-Received: from tzz by asimov.bwh.harvard.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Sep 2004 21:15:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 97 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:F2/KMIGNbY8YaCku3OfjQqTSppQ= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:27084 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27084 --=-=-= On Thu, 01 Jul 2004, juri@jurta.org wrote: > If you want to add next-error support for more modes, you might consider > etags, dired-do-search, find-grep-dired. I haven't looked at etags, but here's a patch for dired.el that will add next-error support. That will support find-grep-dired, dired-do-search, and all other dired-mode usages. There's two issues: 1) by default, most users will probably not want this next-error support so I added a variable dired-next-error-support that's nil by default. This is my conjecture so I may be wrong. 2) I am not sure of the right way to move negative distances in dired-mode, since not every line is a file. I reuse the dired-goto-next-nontrivial-file function for forward motion and ignore negative distances for now. I could write my own, but was wondering if something already existed for negative motion. Please comment and I hope this can make it in Emacs eventually (it's not ready as it is). I am attaching a context patch. Ted --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=dired-next-error.patch *** /usr/src/emacs/lisp/dired.el Wed Jul 14 18:59:08 2004 --- /home/tzz/emacs/mine/dired.el Mon Sep 13 15:09:54 2004 *************** *** 215,220 **** --- 215,227 ---- :type '(alist :key-type regexp :value-type string) :version "21.4") + ;; should we use next-error support? + (defcustom dired-next-error-support nil + "Specifies whether Dired should support the next-error + framework." + :group 'dired + :type 'boolean) + ;; Internal variables (defvar dired-marker-char ?* ; the answer is 42 *************** *** 1397,1402 **** --- 1404,1411 ---- selective-display t ; for subdirectory hiding mode-line-buffer-identification (propertized-buffer-identification "%17b")) + (when dired-next-error-support + (setq next-error-function 'dired-next-error)) (set (make-local-variable 'revert-buffer-function) (function dired-revert)) (set (make-local-variable 'buffer-stale-function) *************** *** 1450,1455 **** --- 1459,1490 ---- (message "Change in Dired buffer undone. Actual changes in files cannot be undone by Emacs.")) + (defun dired-next-error (&optional argp reset) + "Move to the ARGP (default 1) next match in an Dired mode buffer. + When RESET is given, starts from the beginning. + Compatibility function for \\[next-error] invocations." + (interactive "p") + + (when reset + ;; go to beginning of buffer + (goto-char (point-min))) + + (dired-next-error-move-n-file-lines + (prefix-numeric-value argp)) + + ;; visit file if possible + (when (dired-get-filename nil t) + (dired-find-file))) + + (defun dired-next-error-move-n-file-lines (argp) + "Move ARGP file lines from the current line. + File lines are lines with a file listed in them. + ONLY SUPPORT POSITIVE MOTION FOR NOW" + (when (> argp 0) + (dotimes (n argp) + (forward-line 1) + (dired-goto-next-nontrivial-file)))) + (defun dired-next-line (arg) "Move down lines then position at filename. Optional prefix ARG says how many lines to move; default is one line." --=-=-= 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 --=-=-=--