aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2007-11-24 16:20:10 +0000
committerThien-Thi Nguyen2007-11-24 16:20:10 +0000
commit5731a8e006a1b24fc0354d283c3162510f39f2bb (patch)
treea310cb9d1223ca2da30ad4e55dbc75587a0b67a9
parent83f1f73ba6794a67eba66ac7a708129d2ed8ad89 (diff)
downloademacs-5731a8e006a1b24fc0354d283c3162510f39f2bb.tar.gz
emacs-5731a8e006a1b24fc0354d283c3162510f39f2bb.zip
(vc-annotate-mode): Frob buffer invisibility spec.
(vc-annotate-toggle-annotation-visibility): New command. (vc-annotate-mode-map): Bind "V" to it. (vc-annotate-mode-menu): Add entry for it. (vc-annotate-get-time-set-line-props): New func. (vc-annotate-display-autoscale) (vc-annotate-display-difference): Use it.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/vc.el26
2 files changed, 34 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e685cf56091..64f9a183e2c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12007-11-24 Thien-Thi Nguyen <ttn@gnuvola.org>
2
3 * vc.el (vc-annotate-mode): Frob buffer invisibility spec.
4 (vc-annotate-toggle-annotation-visibility): New command.
5 (vc-annotate-mode-map): Bind "V" to it.
6 (vc-annotate-mode-menu): Add entry for it.
7 (vc-annotate-get-time-set-line-props): New func.
8 (vc-annotate-display-autoscale)
9 (vc-annotate-display-difference): Use it.
10
12007-11-24 Michael Albinus <michael.albinus@gmx.de> 112007-11-24 Michael Albinus <michael.albinus@gmx.de>
2 12
3 * ido.el (ido-file-name-all-completions-1): Check for fboundp of 13 * ido.el (ido-file-name-all-completions-1): Check for fboundp of
diff --git a/lisp/vc.el b/lisp/vc.el
index 30e9dc3c37e..0942392a49d 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -774,6 +774,7 @@ List of factors, used to expand/compress the time scale. See `vc-annotate'."
774 (define-key m "N" 'vc-annotate-next-revision) 774 (define-key m "N" 'vc-annotate-next-revision)
775 (define-key m "P" 'vc-annotate-prev-revision) 775 (define-key m "P" 'vc-annotate-prev-revision)
776 (define-key m "W" 'vc-annotate-working-revision) 776 (define-key m "W" 'vc-annotate-working-revision)
777 (define-key m "V" 'vc-annotate-toggle-annotation-visibility)
777 m) 778 m)
778 "Local keymap used for VC-Annotate mode.") 779 "Local keymap used for VC-Annotate mode.")
779 780
@@ -3151,11 +3152,24 @@ to provide the `find-revision' operation instead."
3151You can use the mode-specific menu to alter the time-span of the used 3152You can use the mode-specific menu to alter the time-span of the used
3152colors. See variable `vc-annotate-menu-elements' for customizing the 3153colors. See variable `vc-annotate-menu-elements' for customizing the
3153menu items." 3154menu items."
3155 ;; Frob buffer-invisibility-spec so that if it is originally a naked t,
3156 ;; it will become a list, to avoid initial annotations being invisible.
3157 (add-to-invisibility-spec 'foo)
3158 (remove-from-invisibility-spec 'foo)
3154 (set (make-local-variable 'truncate-lines) t) 3159 (set (make-local-variable 'truncate-lines) t)
3155 (set (make-local-variable 'font-lock-defaults) 3160 (set (make-local-variable 'font-lock-defaults)
3156 '(vc-annotate-font-lock-keywords t)) 3161 '(vc-annotate-font-lock-keywords t))
3157 (view-mode 1)) 3162 (view-mode 1))
3158 3163
3164(defun vc-annotate-toggle-annotation-visibility ()
3165 "Toggle whether or not the annotation is visible."
3166 (interactive)
3167 (funcall (if (memq 'vc-annotate-annotation buffer-invisibility-spec)
3168 'remove-from-invisibility-spec
3169 'add-to-invisibility-spec)
3170 'vc-annotate-annotation)
3171 (force-window-update (current-buffer)))
3172
3159(defun vc-annotate-display-default (ratio) 3173(defun vc-annotate-display-default (ratio)
3160 "Display the output of \\[vc-annotate] using the default color range. 3174 "Display the output of \\[vc-annotate] using the default color range.
3161The color range is given by `vc-annotate-color-map', scaled by RATIO. 3175The color range is given by `vc-annotate-color-map', scaled by RATIO.
@@ -3170,6 +3184,13 @@ The current time is used as the offset."
3170 ;; Since entries should be sorted, we can just use the last one. 3184 ;; Since entries should be sorted, we can just use the last one.
3171 (caar (last color-map))) 3185 (caar (last color-map)))
3172 3186
3187(defun vc-annotate-get-time-set-line-props ()
3188 (let ((bol (point))
3189 (date (vc-call-backend vc-annotate-backend 'annotate-time))
3190 (inhibit-read-only t))
3191 (put-text-property bol (point) 'invisible 'vc-annotate-annotation)
3192 date))
3193
3173(defun vc-annotate-display-autoscale (&optional full) 3194(defun vc-annotate-display-autoscale (&optional full)
3174 "Highlight the output of \\[vc-annotate] using an autoscaled color map. 3195 "Highlight the output of \\[vc-annotate] using an autoscaled color map.
3175Autoscaling means that the map is scaled from the current time to the 3196Autoscaling means that the map is scaled from the current time to the
@@ -3185,7 +3206,7 @@ cover the range from the oldest annotation to the newest."
3185 (save-excursion 3206 (save-excursion
3186 (goto-char (point-min)) 3207 (goto-char (point-min))
3187 (while (not (eobp)) 3208 (while (not (eobp))
3188 (when (setq date (vc-call-backend vc-annotate-backend 'annotate-time)) 3209 (when (setq date (vc-annotate-get-time-set-line-props))
3189 (if (> date newest) 3210 (if (> date newest)
3190 (setq newest date)) 3211 (setq newest date))
3191 (if (< date oldest) 3212 (if (< date oldest)
@@ -3233,6 +3254,7 @@ cover the range from the oldest annotation to the newest."
3233 :style toggle :selected 3254 :style toggle :selected
3234 (eq vc-annotate-display-mode 'fullscale)] 3255 (eq vc-annotate-display-mode 'fullscale)]
3235 "--" 3256 "--"
3257 ["Toggle annotation visibility" vc-annotate-toggle-annotation-visibility]
3236 ["Annotate previous revision" vc-annotate-prev-revision] 3258 ["Annotate previous revision" vc-annotate-prev-revision]
3237 ["Annotate next revision" vc-annotate-next-revision] 3259 ["Annotate next revision" vc-annotate-next-revision]
3238 ["Annotate revision at line" vc-annotate-revision-at-line] 3260 ["Annotate revision at line" vc-annotate-revision-at-line]
@@ -3497,7 +3519,7 @@ The argument TIME is a list as returned by `current-time' or
3497This calls the backend function annotate-time, and returns the 3519This calls the backend function annotate-time, and returns the
3498difference in days between the time returned and the current time, 3520difference in days between the time returned and the current time,
3499or OFFSET if present." 3521or OFFSET if present."
3500 (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time))) 3522 (let ((next-time (vc-annotate-get-time-set-line-props)))
3501 (if next-time 3523 (if next-time
3502 (- (or offset 3524 (- (or offset
3503 (vc-call-backend vc-annotate-backend 'annotate-current-time)) 3525 (vc-call-backend vc-annotate-backend 'annotate-current-time))