mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* files.el (file-name-sans-versions): Allow - and a-z in version
names. * log-view.el (log-view-mode-map, log-view-mode-menu): Bind log-view-annotate-version. (log-view-beginning-of-defun, log-view-end-of-defun) (log-view-annotate-version): New functions. (log-view-mode): Use log-view-beginning-of-defun and log-view-end-of-defun.
This commit is contained in:
parent
2e2cc4e44d
commit
a3f5d84dac
3 changed files with 72 additions and 1 deletions
|
|
@ -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
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue