changeset 97288:b0e0f868bbd7

(change-log-next-error, change-log-mode): Add support for `next-error' to call `change-log-goto-source' on named files in a ChangeLog.
author Teodor Zlatanov <tzz@lifelogs.com>
date Tue, 05 Aug 2008 18:37:12 +0000
parents f152a8f9c82f
children 6cec2902d7b8
files lisp/ChangeLog lisp/add-log.el
diffstat 2 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Aug 05 17:33:05 2008 +0000
+++ b/lisp/ChangeLog	Tue Aug 05 18:37:12 2008 +0000
@@ -1,3 +1,9 @@
+2008-08-05  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	* add-log.el (change-log-next-error, change-log-mode): Add support
+	for `next-error' to call `change-log-goto-source' on named files
+	in a ChangeLog.
+
 2008-08-05  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc/calc.el (math-read-number): Handle all C-like languages
--- a/lisp/add-log.el	Tue Aug 05 17:33:05 2008 +0000
+++ b/lisp/add-log.el	Tue Aug 05 18:37:12 2008 +0000
@@ -511,6 +511,29 @@
 	    (error (format "Cannot find matches for tag `%s' in `%s'"
 			   tag file))))))))
 
+(defun change-log-next-error (&optional argp reset)
+  "Move to the Nth (default 1) next match in an Occur mode buffer.
+Compatibility function for \\[next-error] invocations."
+  (interactive "p")
+  (let* ((argp (or argp 0))
+	 (count (abs argp))		; how many cycles
+	 (down (< argp 0))		; are we going down? (is argp negative?)
+	 (up (not down))
+	 (search-function (if up 're-search-forward 're-search-backward)))
+    
+    ;; set the starting position
+    (goto-char (cond (reset (point-min))
+		     (down (line-beginning-position))
+		     (up (line-end-position))
+		     ((point))))
+    
+    (funcall search-function change-log-file-names-re nil t count))
+  
+  (beginning-of-line)
+  ;; if we found a place to visit...
+  (when (looking-at change-log-file-names-re)
+    (change-log-goto-source)))
+
 (defvar change-log-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment)
@@ -997,7 +1020,10 @@
   (set (make-local-variable 'beginning-of-defun-function) 
        'change-log-beginning-of-defun)
   (set (make-local-variable 'end-of-defun-function) 
-       'change-log-end-of-defun))
+       'change-log-end-of-defun)
+  ;; next-error function glue
+  (setq next-error-function 'change-log-next-error)
+  (setq next-error-last-buffer (current-buffer)))
 
 (defun change-log-next-buffer (&optional buffer wrap)
   "Return the next buffer in the series of ChangeLog file buffers.