comparison lisp/log-view.el @ 81330:f7754bd2e73f

(log-view-file-re, log-view-message-re): Use \(?1:...\). (log-view-font-lock-keywords): Simplify. (log-view-current-file, log-view-current-tag): Simplify.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 12 Jun 2007 18:52:05 +0000
parents e3694f1cb928
children 9785d18889ed 3619e7770f2e
comparison
equal deleted inserted replaced
81329:465e2d55267d 81330:f7754bd2e73f
127 ;; backward-compatibility alias 127 ;; backward-compatibility alias
128 (put 'log-view-message-face 'face-alias 'log-view-message) 128 (put 'log-view-message-face 'face-alias 'log-view-message)
129 (defvar log-view-message-face 'log-view-message) 129 (defvar log-view-message-face 'log-view-message)
130 130
131 (defconst log-view-file-re 131 (defconst log-view-file-re
132 (concat "^\\(?:Working file: \\(.+\\)" ;RCS and CVS. 132 (concat "^\\(?:Working file: \\(?1:.+\\)" ;RCS and CVS.
133 "\\|\\(?:SCCS/s\\.\\|Changes to \\)\\(.+\\):" ;SCCS and Darcs. 133 ;; Subversion has no such thing??
134 "\\|\\(?:SCCS/s\\.\\|Changes to \\)\\(?1:.+\\):" ;SCCS and Darcs.
134 "\\)\n")) ;Include the \n for font-lock reasons. 135 "\\)\n")) ;Include the \n for font-lock reasons.
135 136
136 (defconst log-view-message-re 137 (defconst log-view-message-re
137 (concat "^\\(?:revision \\([.0-9]+\\)\\(?:\t.*\\)?" ; RCS and CVS. 138 (concat "^\\(?:revision \\(?1:[.0-9]+\\)\\(?:\t.*\\)?" ; RCS and CVS.
138 "\\|r\\([0-9]+\\) | .* | .*" ; Subversion. 139 "\\|r\\(?1:[0-9]+\\) | .* | .*" ; Subversion.
139 "\\|D \\([.0-9]+\\) .*" ; SCCS. 140 "\\|D \\(?1:[.0-9]+\\) .*" ; SCCS.
140 ;; Darcs doesn't have revision names. VC-darcs uses patch names 141 ;; Darcs doesn't have revision names. VC-darcs uses patch names
141 ;; instead. Darcs patch names are hashcodes, which do not appear 142 ;; instead. Darcs patch names are hashcodes, which do not appear
142 ;; in the log output :-(, but darcs accepts any prefix of the log 143 ;; in the log output :-(, but darcs accepts any prefix of the log
143 ;; message as a patch name, so we match the first line of the log 144 ;; message as a patch name, so we match the first line of the log
144 ;; message. 145 ;; message.
145 ;; First loosely match the date format. 146 ;; First loosely match the date format.
146 (concat "\\|[^ \n].*[^0-9\n][0-9][0-9]:[0-9][0-9][^0-9\n].*[^ \n]" 147 (concat "\\|[^ \n].*[^0-9\n][0-9][0-9]:[0-9][0-9][^0-9\n].*[^ \n]"
147 ;;Email of user and finally Msg, used as revision name. 148 ;;Email of user and finally Msg, used as revision name.
148 " .*@.*\n\\(?: \\* \\(.*\\)\\)?") 149 " .*@.*\n\\(?: \\* \\(?1:.*\\)\\)?")
149 "\\)$")) 150 "\\)$"))
150 151
151 (defconst log-view-font-lock-keywords 152 (defconst log-view-font-lock-keywords
152 `((,log-view-file-re 153 `((,log-view-file-re
153 (1 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t) 154 (1 (if (boundp 'cvs-filename-face) cvs-filename-face))
154 (2 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t)
155 (0 log-view-file-face append)) 155 (0 log-view-file-face append))
156 (,log-view-message-re . log-view-message-face))) 156 (,log-view-message-re . log-view-message-face)))
157 (defconst log-view-font-lock-defaults 157 (defconst log-view-font-lock-defaults
158 '(log-view-font-lock-keywords t nil nil nil)) 158 '(log-view-font-lock-keywords t nil nil nil))
159 159
192 (defun log-view-current-file () 192 (defun log-view-current-file ()
193 (save-excursion 193 (save-excursion
194 (forward-line 1) 194 (forward-line 1)
195 (or (re-search-backward log-view-file-re nil t) 195 (or (re-search-backward log-view-file-re nil t)
196 (re-search-forward log-view-file-re)) 196 (re-search-forward log-view-file-re))
197 (let* ((file (or (match-string 1) (match-string 2))) 197 (let* ((file (match-string 1))
198 (cvsdir (and (re-search-backward log-view-dir-re nil t) 198 (cvsdir (and (re-search-backward log-view-dir-re nil t)
199 (match-string 1))) 199 (match-string 1)))
200 (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re) 200 (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re)
201 (re-search-backward cvs-pcl-cvs-dirchange-re nil t) 201 (re-search-backward cvs-pcl-cvs-dirchange-re nil t)
202 (match-string 1))) 202 (match-string 1)))
210 (save-excursion 210 (save-excursion
211 (when where (goto-char where)) 211 (when where (goto-char where))
212 (forward-line 1) 212 (forward-line 1)
213 (let ((pt (point))) 213 (let ((pt (point)))
214 (when (re-search-backward log-view-message-re nil t) 214 (when (re-search-backward log-view-message-re nil t)
215 (let (rev) 215 (let ((rev (match-string 1)))
216 ;; Find the subgroup that matched.
217 (dotimes (i (/ (length (match-data 'integers)) 2))
218 (setq rev (or rev (match-string (1+ i)))))
219 (unless (re-search-forward log-view-file-re pt t) 216 (unless (re-search-forward log-view-file-re pt t)
220 rev)))))) 217 rev))))))
221 218
222 (defvar cvs-minor-current-files) 219 (defvar cvs-minor-current-files)
223 (defvar cvs-branch-prefix) 220 (defvar cvs-branch-prefix)