From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: next-error refactoring
Date: Mon, 13 Sep 2004 14:56:43 -0400 [thread overview]
Message-ID: <4ny8je80b8.fsf@lifelogs.com> (raw)
In-Reply-To: 87n02kl1in.fsf@mail.jurta.org
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dired-next-error.patch --]
[-- Type: text/x-patch, Size: 2069 bytes --]
*** /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."
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2004-09-13 18:56 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-01 5:29 compilation-highlight-duration Tak Ota
2004-05-01 17:51 ` compilation-highlight-duration Richard Stallman
2004-05-02 16:47 ` compilation-highlight-duration Tak Ota
2004-05-03 14:03 ` compilation-highlight-duration Richard Stallman
2004-05-03 14:13 ` compilation-highlight-duration Tak Ota
2004-05-04 7:43 ` compilation-highlight-duration Richard Stallman
2004-05-04 14:54 ` compilation-highlight-duration Tak Ota
2004-05-04 16:55 ` compilation-highlight-duration Juri Linkov
2004-05-04 17:20 ` compilation-highlight-duration Kim F. Storm
2004-05-04 20:01 ` compilation-highlight-duration Juri Linkov
2004-05-04 21:30 ` compilation-highlight-duration Kim F. Storm
2004-05-04 20:32 ` compilation-highlight-duration Drew Adams
2004-05-04 19:15 ` compilation-highlight-duration Tak Ota
2004-05-04 21:35 ` compilation-highlight-duration Tak Ota
2004-05-05 17:33 ` compilation-highlight-duration Stefan Monnier
2004-05-05 18:05 ` compilation-highlight-duration Tak Ota
2004-05-05 20:20 ` compilation-highlight-duration Richard Stallman
2004-05-05 20:59 ` compilation-highlight-duration Tak Ota
2004-05-05 22:47 ` compilation-highlight-duration Thien-Thi Nguyen
2004-05-05 21:22 ` compilation-highlight-duration Stefan Monnier
2004-05-06 5:58 ` compilation-highlight-duration Kim F. Storm
2004-05-06 9:23 ` compilation-highlight-duration Juri Linkov
2004-05-06 7:48 ` compilation-highlight-duration Kim F. Storm
2004-05-06 10:34 ` compilation-highlight-duration David Kastrup
2004-05-06 10:22 ` compilation-highlight-duration Kim F. Storm
2004-05-07 0:29 ` compilation-highlight-duration Richard Stallman
2004-05-07 0:29 ` compilation-highlight-duration Richard Stallman
2004-05-09 1:03 ` compilation-highlight-duration Juri Linkov
2004-05-09 18:48 ` compilation-highlight-duration Richard Stallman
2004-05-09 19:12 ` compilation-highlight-duration Kim F. Storm
2004-05-10 7:17 ` compilation-highlight-duration Eli Zaretskii
2004-05-10 20:30 ` compilation-highlight-duration Stefan Daschek
2004-05-28 11:19 ` compilation-highlight-duration Juri Linkov
2004-05-28 11:42 ` compilation-highlight-duration Kim F. Storm
2004-05-28 15:45 ` next-error refactoring (was: compilation-highlight-duration) Ted Zlatanov
2004-05-28 18:14 ` next-error refactoring Juri Linkov
2004-05-29 3:54 ` Ted Zlatanov
2004-05-29 17:03 ` next-error refactoring (was: compilation-highlight-duration) Richard Stallman
2004-06-01 17:55 ` next-error refactoring Ted Zlatanov
2004-06-02 17:36 ` Richard Stallman
2004-06-03 15:23 ` Ted Zlatanov
2004-06-07 21:27 ` Juri Linkov
2004-06-09 19:52 ` Richard Stallman
2004-06-02 17:36 ` Richard Stallman
2004-06-03 15:30 ` Ted Zlatanov
2004-06-03 23:33 ` Juri Linkov
2004-06-07 16:14 ` Ted Zlatanov
2004-06-04 2:03 ` Richard Stallman
2004-06-07 16:11 ` Ted Zlatanov
2004-06-07 17:01 ` Tak Ota
2004-06-08 20:31 ` Richard Stallman
2004-06-11 18:39 ` Ted Zlatanov
2004-06-12 9:44 ` Richard Stallman
2004-06-30 18:42 ` Ted Zlatanov
2004-07-01 5:47 ` Juri Linkov
2004-09-13 18:56 ` Ted Zlatanov [this message]
2004-09-14 10:28 ` Kim F. Storm
2004-09-15 18:08 ` Ted Zlatanov
2004-06-09 9:53 ` Stefan Monnier
2004-06-09 20:19 ` Juri Linkov
2004-06-10 23:01 ` Richard Stallman
2004-05-29 17:02 ` compilation-highlight-duration Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ny8je80b8.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).