Mercurial > emacs
comparison lisp/log-view.el @ 28251:21d27711125f
(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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 22 Mar 2000 01:10:09 +0000 |
parents | b442dfc3cef0 |
children | bab7620d1466 |
comparison
equal
deleted
inserted
replaced
28250:3cfb9a01a935 | 28251:21d27711125f |
---|---|
3 ;; Copyright (C) 1999-2000 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1999-2000 Free Software Foundation, Inc. |
4 | 4 |
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 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
26 | 26 |
27 ;;; Commentary: | 27 ;;; Commentary: |
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 |
36 ;;; Code: | 34 ;;; Code: |
37 | 35 |
44 "Major mode for browsing log output for PCL-CVS." | 42 "Major mode for browsing log output for PCL-CVS." |
45 :group 'pcl-cvs | 43 :group 'pcl-cvs |
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) |
58 | 56 |
59 (defvar log-view-mode-hook nil | 57 (defvar log-view-mode-hook nil |
78 (defconst log-view-file-re | 76 (defconst log-view-file-re |
79 (concat "^\\(" | 77 (concat "^\\(" |
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 |
87 (2 'cvs-filename-face nil t) | 85 (2 'cvs-filename-face nil t) |
88 (3 'cvs-filename-face nil t) | 86 (3 'cvs-filename-face nil t) |
94 ;;;; | 92 ;;;; |
95 ;;;; Actual code | 93 ;;;; Actual code |
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)) |
105 | 101 |
106 ;;;; | 102 ;;;; |
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) |
144 ;;;; | 112 ;;;; |
145 | 113 |
160 (when pcldir (setq dir (expand-file-name pcldir dir))) | 128 (when pcldir (setq dir (expand-file-name pcldir dir))) |
161 (when cvsdir (setq dir (expand-file-name cvsdir dir))) | 129 (when cvsdir (setq dir (expand-file-name cvsdir dir))) |
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 |
169 (cons | 143 (cons |
170 (cons (log-view-current-file) | 144 (cons (log-view-current-file) |
184 ;; FIXME: I need to force because the fileinfos are UNKNOWN | 158 ;; FIXME: I need to force because the fileinfos are UNKNOWN |
185 (cvs-force-command "/F")) | 159 (cvs-force-command "/F")) |
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 |