diff options
| author | Stefan Monnier | 2000-03-22 01:10:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-03-22 01:10:09 +0000 |
| commit | cdbb990f7884be01a1945822f38297aa6ef26293 (patch) | |
| tree | f981a0122f635810baec15c39ca7035865329fcc | |
| parent | 43e56cba2ad79487bdd21415db54f6cf5afcbc40 (diff) | |
| download | emacs-cdbb990f7884be01a1945822f38297aa6ef26293.tar.gz emacs-cdbb990f7884be01a1945822f38297aa6ef26293.zip | |
(log-view-(msg|file)-(prev|next)): Rename from
log-view-*-(message|file) and use easy-mmode-define-navigation.
(log-view-message-re): Match SCCS format as well.
And match the revision line rather than the dashed separator line.
(log-view-mode): Use the new define-derived-mode.
(log-view-current-tag): Fill in with an actual implementation.
| -rw-r--r-- | lisp/log-view.el | 68 |
1 files changed, 23 insertions, 45 deletions
diff --git a/lisp/log-view.el b/lisp/log-view.el index c157b392ad9..46cefeae8ab 100644 --- a/lisp/log-view.el +++ b/lisp/log-view.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> | 5 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> |
| 6 | ;; Keywords: pcl-cvs cvs log | 6 | ;; Keywords: pcl-cvs cvs log |
| 7 | ;; Version: $Name: $ | 7 | ;; Version: $Name: $ |
| 8 | ;; Revision: $Id: log-view.el,v 1.2 2000/03/03 20:58:09 monnier Exp $ | 8 | ;; Revision: $Id: log-view.el,v 1.1 2000/03/11 03:42:28 monnier Exp $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -28,8 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | ;; Todo: | 29 | ;; Todo: |
| 30 | 30 | ||
| 31 | ;; - extract version info in log-view-current-tag | ||
| 32 | ;; - add support for SCCS' output format | ||
| 33 | ;; - add compatibility with cvs-log.el | 31 | ;; - add compatibility with cvs-log.el |
| 34 | ;; - add ability to modify a log-entry (via cvs-mode-admin ;-) | 32 | ;; - add ability to modify a log-entry (via cvs-mode-admin ;-) |
| 35 | 33 | ||
| @@ -46,12 +44,12 @@ | |||
| 46 | :prefix "log-view-") | 44 | :prefix "log-view-") |
| 47 | 45 | ||
| 48 | (easy-mmode-defmap log-view-mode-map | 46 | (easy-mmode-defmap log-view-mode-map |
| 49 | '(("n" . log-view-next-message) | 47 | '(("n" . log-view-msg-next) |
| 50 | ("N" . log-view-next-file) | 48 | ("p" . log-view-msg-prev) |
| 51 | ("M-n" . log-view-next-file) | 49 | ("N" . log-view-file-next) |
| 52 | ("p" . log-view-prev-message) | 50 | ("P" . log-view-file-prev) |
| 53 | ("P" . log-view-prev-file) | 51 | ("M-n" . log-view-file-next) |
| 54 | ("M-p" . log-view-prev-file)) | 52 | ("M-p" . log-view-file-prev)) |
| 55 | "Log-View's keymap." | 53 | "Log-View's keymap." |
| 56 | :group 'log-view | 54 | :group 'log-view |
| 57 | :inherit 'cvs-mode-map) | 55 | :inherit 'cvs-mode-map) |
| @@ -80,7 +78,7 @@ | |||
| 80 | "Working file: \\(.+\\)" | 78 | "Working file: \\(.+\\)" |
| 81 | "\\|SCCS/s\\.\\(.+\\):" | 79 | "\\|SCCS/s\\.\\(.+\\):" |
| 82 | "\\)\n")) | 80 | "\\)\n")) |
| 83 | (defconst log-view-message-re "^----------------------------$") | 81 | (defconst log-view-message-re "^\\(revision \\([.0-9]+\\)\\|D \\([.0-9]+\\) .*\\)$") |
| 84 | 82 | ||
| 85 | (defconst log-view-font-lock-keywords | 83 | (defconst log-view-font-lock-keywords |
| 86 | `((,log-view-file-re | 84 | `((,log-view-file-re |
| @@ -96,9 +94,7 @@ | |||
| 96 | ;;;; | 94 | ;;;; |
| 97 | 95 | ||
| 98 | ;;;###autoload | 96 | ;;;###autoload |
| 99 | (autoload 'log-view-mode "log-view" "Major mode for browsing CVS log output." t) | 97 | (define-derived-mode log-view-mode fundamental-mode "Log-View" |
| 100 | (eval-when-compile (autoload 'easy-mmode-define-derived-mode "easy-mmode")) | ||
| 101 | (easy-mmode-define-derived-mode log-view-mode fundamental-mode "Log-View" | ||
| 102 | "Major mode for browsing CVS log output." | 98 | "Major mode for browsing CVS log output." |
| 103 | (set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults) | 99 | (set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults) |
| 104 | (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap)) | 100 | (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap)) |
| @@ -107,37 +103,9 @@ | |||
| 107 | ;;;; Navigation | 103 | ;;;; Navigation |
| 108 | ;;;; | 104 | ;;;; |
| 109 | 105 | ||
| 110 | (defun log-view-next-message (&optional count) | 106 | ;; define log-view-{msg,file}-{next,prev} |
| 111 | "Move to next (COUNT'th) log message." | 107 | (easy-mmode-define-navigation log-view-msg log-view-message-re "log message") |
| 112 | (interactive "p") | 108 | (easy-mmode-define-navigation log-view-file log-view-file-re "file") |
| 113 | (unless count (setq count 1)) | ||
| 114 | (if (< count 0) (log-view-prev-message (- count)) | ||
| 115 | (when (looking-at log-view-message-re) (incf count)) | ||
| 116 | (re-search-forward log-view-message-re nil nil count) | ||
| 117 | (goto-char (match-beginning 0)))) | ||
| 118 | |||
| 119 | (defun log-view-next-file (&optional count) | ||
| 120 | "Move to next (COUNT'th) file." | ||
| 121 | (interactive "p") | ||
| 122 | (unless count (setq count 1)) | ||
| 123 | (if (< count 0) (log-view-prev-file (- count)) | ||
| 124 | (when (looking-at log-view-file-re) (incf count)) | ||
| 125 | (re-search-forward log-view-file-re nil nil count) | ||
| 126 | (goto-char (match-beginning 0)))) | ||
| 127 | |||
| 128 | (defun log-view-prev-message (&optional count) | ||
| 129 | "Move to previous (COUNT'th) log message." | ||
| 130 | (interactive "p") | ||
| 131 | (unless count (setq count 1)) | ||
| 132 | (if (< count 0) (log-view-next-message (- count)) | ||
| 133 | (re-search-backward log-view-message-re nil nil count))) | ||
| 134 | |||
| 135 | (defun log-view-prev-file (&optional count) | ||
| 136 | "Move to previous (COUNT'th) file." | ||
| 137 | (interactive "p") | ||
| 138 | (unless count (setq count 1)) | ||
| 139 | (if (< count 0) (log-view-next-file (- count)) | ||
| 140 | (re-search-backward log-view-file-re nil nil count))) | ||
| 141 | 109 | ||
| 142 | ;;;; | 110 | ;;;; |
| 143 | ;;;; Linkage to PCL-CVS (mostly copied from cvs-status.el) | 111 | ;;;; Linkage to PCL-CVS (mostly copied from cvs-status.el) |
| @@ -162,7 +130,13 @@ | |||
| 162 | (expand-file-name file dir))))) | 130 | (expand-file-name file dir))))) |
| 163 | 131 | ||
| 164 | (defun log-view-current-tag () | 132 | (defun log-view-current-tag () |
| 165 | nil);; FIXME | 133 | (save-excursion |
| 134 | (forward-line 1) | ||
| 135 | (let ((pt (point))) | ||
| 136 | (when (re-search-backward log-view-message-re nil t) | ||
| 137 | (let ((rev (or (match-string 2) (match-string 3)))) | ||
| 138 | (unless (re-search-forward log-view-file-re pt t) | ||
| 139 | rev)))))) | ||
| 166 | 140 | ||
| 167 | (defun log-view-minor-wrap (buf f) | 141 | (defun log-view-minor-wrap (buf f) |
| 168 | (let ((data (with-current-buffer buf | 142 | (let ((data (with-current-buffer buf |
| @@ -186,4 +160,8 @@ | |||
| 186 | (funcall f)))) | 160 | (funcall f)))) |
| 187 | 161 | ||
| 188 | (provide 'log-view) | 162 | (provide 'log-view) |
| 163 | |||
| 164 | ;;; Change Log: | ||
| 165 | ;; $Log$ | ||
| 166 | |||
| 189 | ;;; log-view.el ends here | 167 | ;;; log-view.el ends here |