changeset 67709:6f549652480e

(log-view-file-re, log-view-message-re): Use shy groups. (log-view-font-lock-keywords): Ajust subgroup numbers. (log-view-current-tag): Don't hard code the number of subgroups.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 20 Dec 2005 21:58:14 +0000
parents 1dd43729395d
children 025a6b0b62a2
files lisp/ChangeLog lisp/log-view.el
diffstat 2 files changed, 57 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Dec 20 21:50:23 2005 +0000
+++ b/lisp/ChangeLog	Tue Dec 20 21:58:14 2005 +0000
@@ -1,3 +1,9 @@
+2005-12-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* log-view.el (log-view-file-re, log-view-message-re): Use shy groups.
+	(log-view-font-lock-keywords): Ajust subgroup numbers.
+	(log-view-current-tag): Don't hard code the number of subgroups.
+
 2005-12-20  Juri Linkov  <juri@jurta.org>
 
 	* tooltip.el (tooltip): Move defgroup before define-minor-mode.
@@ -29,8 +35,7 @@
 	(org-set-tags): Efficiency improvements.
 	(org-auto-align-tags): New option.
 	(org-todo, org-demote, org-promote): Realign tags.
-	(org-tags-completion-function): Use also "&" and "|" as
-	separators.
+	(org-tags-completion-function): Use also "&" and "|" as separators.
 	(org-org-menu): Agenda commands simplified.
 
 2005-12-19  Luc Teirlinck  <teirllm@auburn.edu>
@@ -7292,7 +7297,7 @@
 2005-08-26  Kim F. Storm  <storm@cua.dk>
 
 	* subr.el (version-list-<, version-list-<=, version-list-=):
-	Renamed from integer-list-*.
+	Rename from integer-list-*.
 	(version-list-not-zero): Likewise.  Fix while loop.
 	(version=): Use version-list-= instead of string-equal.
 
@@ -12439,8 +12444,7 @@
 	(multiple-value-bind, multiple-value-setq, shiftf):
 	Improve argument/docstring consistency.
 
-	* subr.el (focus-frame, unfocus-frame):
-	Revert deletion on 2005-05-01.
+	* subr.el (focus-frame, unfocus-frame): Revert deletion on 2005-05-01.
 
 2005-05-22  Andre Spiegel  <spiegel@gnu.org>
 
@@ -12573,8 +12577,7 @@
 	(subst-if-not, nsubst, nsubst-if, nsubst-if-not, sublis)
 	(nsublis, tree-equal): Improve argument/docstring consistency.
 
-	* subr.el (send-string, send-region):
-	Remove obsolescence declaration.
+	* subr.el (send-string, send-region): Remove obsolescence declaration.
 	(window-dot, set-window-dot, read-input, show-buffer)
 	(eval-current-buffer, string-to-int):
 	Add release number to obsolescence declarations.
@@ -12651,8 +12654,8 @@
 	* emacs-lisp/byte-run.el (eval-when-compile): Doc fix.
 
 	* emacs-lisp/bytecomp.el
-	(byte-compile-file-form-custom-declare-variable): Call
-	byte-compile-nogroup-warn if appropriate.
+	(byte-compile-file-form-custom-declare-variable):
+	Call byte-compile-nogroup-warn if appropriate.
 
 	* progmodes/compile.el (compilation-finish-function): Mark obsolete.
 	(compilation-set-window): Don't call left-fringe-p; do it directly.
--- a/lisp/log-view.el	Tue Dec 20 21:50:23 2005 +0000
+++ b/lisp/log-view.el	Tue Dec 20 21:58:14 2005 +0000
@@ -25,11 +25,36 @@
 
 ;;; Commentary:
 
-;; Todo:
+;; Major mode to browse revision log histories.
+;; Currently supports the format output by:
+;;  RCS, SCCS, CVS, Subversion.
+
+;; Examples of log output:
+
+;;;; RCS/CVS:
 
-;; - add compatibility with cvs-log.el
+;; ----------------------------
+;; revision 1.35	locked by: turlutut
+;; date: 2005-03-22 18:48:38 +0000;  author: monnier;  state: Exp;  lines: +6 -8
+;; (gnus-display-time-event-handler):
+;; Check display-time-timer at runtime rather than only at load time
+;; in case display-time-mode is turned off in the mean time.
+;; ----------------------------
+;; revision 1.34
+;; date: 2005-02-09 15:50:38 +0000;  author: kfstorm;  state: Exp;  lines: +7 -7
+;; branches:  1.34.2;
+;; Change release version from 21.4 to 22.1 throughout.
+;; Change development version from 21.3.50 to 22.0.50.
+
+;;;; SCCS:
+
+;;;; Subversion:
+
+;;; Todo:
+
 ;; - add ability to modify a log-entry (via cvs-mode-admin ;-)
 ;; - remove references to cvs-*
+;; - make it easier to add support for new backends without changing the code.
 
 ;;; Code:
 
@@ -87,17 +112,20 @@
 (defvar log-view-message-face 'log-view-message)
 
 (defconst log-view-file-re
-  (concat "^\\("
-	  "Working file: \\(.+\\)"
-	  "\\|SCCS/s\\.\\(.+\\):"
-	  "\\)\n"))
-;; In RCS, a locked revision will look like "revision N.M\tlocked by: FOO".
-(defconst log-view-message-re "^\\(revision \\([.0-9]+\\)\\(?:\t.*\\)?\\|r\\([0-9]+\\) | .* | .*\\|D \\([.0-9]+\\) .*\\)$")
+  (concat "^\\(?:Working file: \\(.+\\)"                ;RCS and CVS.
+          "\\|SCCS/s\\.\\(.+\\):"                       ;SCCS.
+	  "\\)\n"))                   ;Include the \n for font-lock reasons.
+
+(defconst log-view-message-re
+  (concat "^\\(?:revision \\([.0-9]+\\)\\(?:\t.*\\)?" ; RCS and CVS.
+          "\\|r\\([0-9]+\\) | .* | .*"                ; Subversion.
+          "\\|D \\([.0-9]+\\) .*"                     ; SCCS.
+          "\\)$"))
 
 (defconst log-view-font-lock-keywords
   `((,log-view-file-re
+     (1 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t)
      (2 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t)
-     (3 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t)
      (0 log-view-file-face append))
     (,log-view-message-re . log-view-message-face)))
 (defconst log-view-font-lock-defaults
@@ -158,10 +186,17 @@
     (forward-line 1)
     (let ((pt (point)))
       (when (re-search-backward log-view-message-re nil t)
-	(let ((rev (or (match-string 2) (match-string 3) (match-string 4))))
+        (let (rev)
+          ;; Find the subgroup that matched.
+          (dotimes (i (/ (match-data 'integers) 2))
+            (setq rev (or rev (match-string (1+ i)))))
 	  (unless (re-search-forward log-view-file-re pt t)
 	    rev))))))
 
+(defvar cvs-minor-current-files)
+(defvar cvs-branch-prefix)
+(defvar cvs-secondary-branch-prefix)
+
 (defun log-view-minor-wrap (buf f)
   (let ((data (with-current-buffer buf
 		(cons