aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2004-11-03 14:28:31 +0000
committerThien-Thi Nguyen2004-11-03 14:28:31 +0000
commitb44a1825e5b5de262b51dde301a145ec3f59cf98 (patch)
treee70ab54cfdf78c62a313cdde937eefae2fdb26c4
parentcd227df34ce1a9716dad95acc3cccf602611ae39 (diff)
downloademacs-b44a1825e5b5de262b51dde301a145ec3f59cf98.tar.gz
emacs-b44a1825e5b5de262b51dde301a145ec3f59cf98.zip
(vc-cvs-local-month-numbers): Delete var.
(vc-cvs-annotate-time): Incorporate value of deleted var. Remove special-case handling of beginning-of-buffer cruft. Cache ending position (point) and return value in text property `vc-cvs-annotate-time', and consult it on subsequent invocations.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/vc-cvs.el59
2 files changed, 36 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9e6bdf07cb9..91cd415c9fd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12004-11-03 Thien-Thi Nguyen <ttn@gnu.org> 12004-11-03 Thien-Thi Nguyen <ttn@gnu.org>
2 2
3 * vc-cvs.el (vc-cvs-local-month-numbers): Delete var.
4 (vc-cvs-annotate-time): Incorporate value of deleted var.
5 Remove special-case handling of beginning-of-buffer cruft.
6 Cache ending position (point) and return value in text property
7 `vc-cvs-annotate-time', and consult it on subsequent invocations.
8
3 * vc-cvs.el (vc-cvs-annotate-command): 9 * vc-cvs.el (vc-cvs-annotate-command):
4 Delete extraneous lines from beginning of buffer. 10 Delete extraneous lines from beginning of buffer.
5 * vc-mcvs.el (vc-mcvs-annotate-command): Likewise. 11 * vc-mcvs.el (vc-mcvs-annotate-command): Likewise.
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 273700ed6a4..45ff233eb86 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -152,12 +152,6 @@ See also variable `vc-cvs-sticky-date-format-string'."
152;;; Internal variables 152;;; Internal variables
153;;; 153;;;
154 154
155(defvar vc-cvs-local-month-numbers
156 '(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" . 4)
157 ("May" . 5) ("Jun" . 6) ("Jul" . 7) ("Aug" . 8)
158 ("Sep" . 9) ("Oct" . 10) ("Nov" . 11) ("Dec" . 12))
159 "Local association list of month numbers.")
160
161 155
162;;; 156;;;
163;;; State-querying functions 157;;; State-querying functions
@@ -605,29 +599,36 @@ encoded as fractional days."
605(defun vc-cvs-annotate-time () 599(defun vc-cvs-annotate-time ()
606 "Return the time of the next annotation (as fraction of days) 600 "Return the time of the next annotation (as fraction of days)
607systime, or nil if there is none." 601systime, or nil if there is none."
608 (let ((time-stamp 602 (let* ((bol (point))
609 "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ")) 603 (cache (get-text-property bol 'vc-cvs-annotate-time))
610 (if (looking-at time-stamp) 604 buffer-read-only)
611 (progn 605 (cond
612 (let* ((day (string-to-number (match-string 1))) 606 (cache)
613 (month (cdr (assoc (match-string 2) 607 ((looking-at
614 vc-cvs-local-month-numbers))) 608 "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ")
615 (year-tmp (string-to-number (match-string 3))) 609 (let ((day (string-to-number (match-string 1)))
616 ;; Years 0..68 are 2000..2068. 610 (month (cdr (assq (intern (match-string 2))
617 ;; Years 69..99 are 1969..1999. 611 '((Jan . 1) (Feb . 2) (Mar . 3)
618 (year (+ (cond ((> 69 year-tmp) 2000) 612 (Apr . 4) (May . 5) (Jun . 6)
619 ((> 100 year-tmp) 1900) 613 (Jul . 7) (Aug . 8) (Sep . 9)
620 (t 0)) 614 (Oct . 10) (Nov . 11) (Dec . 12)))))
621 year-tmp))) 615 (year (let ((tmp (string-to-number (match-string 3))))
622 (goto-char (match-end 0)) ; Position at end makes for nicer overlay result 616 ;; Years 0..68 are 2000..2068.
623 (vc-annotate-convert-time (encode-time 0 0 0 day month year)))) 617 ;; Years 69..99 are 1969..1999.
624 ;; If we did not look directly at an annotation, there might be 618 (+ (cond ((> 69 tmp) 2000)
625 ;; some further down. This is the case if we are positioned at 619 ((> 100 tmp) 1900)
626 ;; the very top of the buffer, for instance. 620 (t 0))
627 (if (re-search-forward time-stamp nil t) 621 tmp))))
628 (progn 622 (put-text-property
629 (beginning-of-line nil) 623 bol (1+ bol) 'vc-cvs-annotate-time
630 (vc-cvs-annotate-time)))))) 624 (setq cache (cons
625 ;; Position at end makes for nicer overlay result.
626 (match-end 0)
627 (vc-annotate-convert-time
628 (encode-time 0 0 0 day month year))))))))
629 (when cache
630 (goto-char (car cache)) ; fontify from here to eol
631 (cdr cache)))) ; days (float)
631 632
632(defun vc-cvs-annotate-extract-revision-at-line () 633(defun vc-cvs-annotate-extract-revision-at-line ()
633 (save-excursion 634 (save-excursion