[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/log-view.el,v [EMACS_22_BASE]
From: |
Dan Nicolaescu |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/log-view.el,v [EMACS_22_BASE] |
Date: |
Sat, 22 Sep 2007 00:02:56 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: Dan Nicolaescu <dann> 07/09/22 00:02:55
Index: log-view.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/log-view.el,v
retrieving revision 1.33.2.3
retrieving revision 1.33.2.4
diff -u -b -r1.33.2.3 -r1.33.2.4
--- log-view.el 10 Aug 2007 08:20:20 -0000 1.33.2.3
+++ log-view.el 22 Sep 2007 00:02:52 -0000 1.33.2.4
@@ -92,6 +92,7 @@
("m" . set-mark-command)
;; ("e" . cvs-mode-edit-log)
("d" . log-view-diff)
+ ("a" . log-view-annotate-version)
("f" . log-view-find-version)
("n" . log-view-msg-next)
("p" . log-view-msg-prev)
@@ -114,6 +115,7 @@
["Mark Log Entry for Diff" set-mark-command]
["Diff Revisions" log-view-diff]
["Visit Version" log-view-find-version]
+ ["Annotate Version" log-view-annotate-version]
["Next Log Entry" log-view-msg-next]
["Previous Log Entry" log-view-msg-prev]
["Next File" log-view-file-next]
@@ -184,6 +186,10 @@
"Major mode for browsing CVS log output."
(setq buffer-read-only t)
(set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults)
+ (set (make-local-variable 'beginning-of-defun-function)
+ 'log-view-beginning-of-defun)
+ (set (make-local-variable 'end-of-defun-function)
+ 'log-view-end-of-defun)
(set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap))
;;;;
@@ -237,6 +243,51 @@
(unless (re-search-forward log-view-file-re pt t)
rev))))))
+(defun log-view-beginning-of-defun ()
+ ;; This assumes that a log entry starts with a line matching
+ ;; `log-view-message-re'. Modes that derive from `log-view-mode'
+ ;; for which this assumption is not valid will have to provide
+ ;; another implementation of this function. `log-view-msg-prev'
+ ;; does a similar job to this function, we can't use it here
+ ;; directly because it prints messages that are not appropriate in
+ ;; this context and it does not move to the beginning of the buffer
+ ;; when the point is before the first log entry.
+
+ ;; `log-view-beginning-of-defun' and `log-view-end-of-defun' have
+ ;; been checked to work with logs produced by RCS, CVS, git,
+ ;; mercurial and subversion.
+
+ (re-search-backward log-view-message-re nil 'move))
+
+(defun log-view-end-of-defun ()
+ ;; The idea in this function is to search for the beginning of the
+ ;; next log entry using `log-view-message-re' and then go back one
+ ;; line when finding it. Modes that derive from `log-view-mode' for
+ ;; which this assumption is not valid will have to provide another
+ ;; implementation of this function.
+
+ ;; Look back and if there is no entry there it means we are before
+ ;; the first log entry, so go forward until finding one.
+ (unless (save-excursion (re-search-backward log-view-message-re nil t))
+ (re-search-forward log-view-message-re nil t))
+
+ ;; In case we are at the end of log entry going forward a line will
+ ;; make us find the next entry when searching. If we are inside of
+ ;; an entry going forward a line will still keep the point inside
+ ;; the same entry.
+ (forward-line 1)
+
+ ;; In case we are at the beginning of an entry, move past it.
+ (when (looking-at log-view-message-re)
+ (goto-char (match-end 0))
+ (forward-line 1))
+
+ ;; Search for the start of the next log entry. Go to the end of the
+ ;; buffer if we could not find a next entry.
+ (when (re-search-forward log-view-message-re nil 'move)
+ (goto-char (match-beginning 0))
+ (forward-line -1)))
+
(defvar cvs-minor-current-files)
(defvar cvs-branch-prefix)
(defvar cvs-secondary-branch-prefix)
@@ -276,6 +327,14 @@
(switch-to-buffer (vc-find-version (log-view-current-file)
(log-view-current-tag)))))
+(defun log-view-annotate-version (pos)
+ "Annotate the version at point."
+ (interactive "d")
+ (save-excursion
+ (goto-char pos)
+ (switch-to-buffer (vc-annotate (log-view-current-file)
+ (log-view-current-tag)))))
+
;;
;; diff
;;
- [Emacs-diffs] Changes to emacs/lisp/log-view.el,v [EMACS_22_BASE],
Dan Nicolaescu <=