From: JD Smith <jdsmith@as.arizona.edu>
Subject: Re: vc-annotate error, PATCH
Date: Mon, 10 Apr 2006 15:00:13 -0700 [thread overview]
Message-ID: <pan.2006.04.10.22.00.13.145676@as.arizona.edu> (raw)
In-Reply-To: pan.2006.04.07.23.28.15.308299@as.arizona.edu
On Fri, 07 Apr 2006 16:28:16 -0700, JD Smith wrote:
>
> vc-annotate is giving me a similar error as was reported earlier for vc.el
> revision 1.408:
>
> (file-error "Cannot open load file" "vc-nil")
>
> This occurs because I have specified a default annotate mode of
> 'fullscale, and the `vc-annotate-display-autoscale' function still relies
> on the variable `vc-annotate-backend' to call the appropriate backend time
> functions I wrote years ago. This was formerly a global variable, but
> Stefan's changes to `vc-annotate' circa 1.408 made it buffer local:
>
> (with-current-buffer temp-buffer-name
> (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
> (set (make-local-variable 'vc-annotate-parent-file) file) (set
> (make-local-variable 'vc-annotate-parent-rev) rev) (set
> (make-local-variable 'vc-annotate-parent-display-mode)
> display-mode))
>
> For whatever reason, these are not currently being set in the annotate
> output buffer, which breaks the auto-scaling annotation display, since it
> doesn't know the backend to use. I haven't figured out how the
> buffer-local variables are being lost. Other annotate display modes don't
> have backend-specific functions, so they continue to work.
>
> By the way, should we make 'fullscale the default display mode? Rather
> than scaling colors based on a fixed time window (1 year I believe is the
> current default), it auto-scales to ensure the oldest and newest colors
> both are used, to match the dynamic range of annotation dates in the file
> to the available number of display colors. Currently, files less than a
> year old will be displayed entirely in one color.
I looked into this further, and it turns out the ordering was correct,
but the `temp-buffer-show-function' was getting called before the
local variables were set, at the end of `with-output-to-temp-buffer'.
Since this in turns calls the auto-scaling display code, which
requires the local variables to be set, it fails.
Simply including the local variable setting inside the
`with-output-to-temp-buffer' body doesn't quite do it either, because
all local variables are being killed when vc-annotate-mode is entered
(as is normal for major modes). The locals also get killed by
`with-output-to-temp-buffer', and indirectly by `vc-call'. So the
only way to have local variables do this job is to set them after all
the commands which kill them off, but before the completion of
`with-output-to-temp-buffer'. This is by no means obvious, and took a
fair bit of hunting to find all the things that were killing off
locals.
I also noticed that the default annotation colormap is sub-optimal.
The manual says "Text colored red is new, blue means old, and
intermediate colors indicate intermediate ages." But the current
colormap jumps back and forth between green/magenta/yellow/etc, and
pure red is the 4th newest color, not the newest (currently an off
yellow).
To address this, I created a new colormap with 18 entries which fixes
saturation at 70%, value at 100%, and rotates from red to blue in
equal angle ~14 degree increments of hue. The saturation of 70% keeps
the text light enough to be readable on the default black background,
but still usable on a white background. I also renamed the display
mode "Default" to "By Colormap", and made Oldest->Newest auto-scaling
the default choice.
Below is a patch which does all this. Any objections to installing
it? Give it a try on a really old file, like subr.el.
JD
*** vc.el 10 Apr 2006 12:16:37 -0700 1.414
--- vc.el 10 Apr 2006 14:32:50 -0700
***************
*** 584,592 ****
:group 'vc
:version "21.1")
! (defcustom vc-annotate-display-mode nil
"Which mode to color the output of \\[vc-annotate] with by default."
! :type '(choice (const :tag "Default" nil)
(const :tag "Scale to Oldest" scale)
(const :tag "Scale Oldest->Newest" fullscale)
(number :tag "Specify Fractional Number of Days"
--- 584,592 ----
:group 'vc
:version "21.1")
! (defcustom vc-annotate-display-mode 'fullscale
"Which mode to color the output of \\[vc-annotate] with by default."
! :type '(choice (const :tag "By Colormap" nil)
(const :tag "Scale to Oldest" scale)
(const :tag "Scale Oldest->Newest" fullscale)
(number :tag "Specify Fractional Number of Days"
***************
*** 617,646 ****
;; Annotate customization
(defcustom vc-annotate-color-map
! '(( 20. . "#FFCC00")
! ( 40. . "#FF6666")
! ( 60. . "#FF6600")
! ( 80. . "#FF3300")
! (100. . "#FF00FF")
! (120. . "#FF0000")
! (140. . "#CCCC00")
! (160. . "#CC00CC")
! (180. . "#BC8F8F")
! (200. . "#99CC00")
! (220. . "#999900")
! (240. . "#7AC5CD")
! (260. . "#66CC00")
! (280. . "#33CC33")
! (300. . "#00CCFF")
! (320. . "#00CC99")
! (340. . "#0099FF"))
"Association list of age versus color, for \\[vc-annotate].
Ages are given in units of fractional days. Default is eighteen steps
! using a twenty day increment."
:type 'alist
:group 'vc)
! (defcustom vc-annotate-very-old-color "#0046FF"
"Color for lines older than the current color range in \\[vc-annotate]]."
:type 'string
:group 'vc)
--- 617,647 ----
;; Annotate customization
(defcustom vc-annotate-color-map
! '(( 20. . "#FF4C4C")
! ( 40. . "#FF764C")
! ( 60. . "#FFA04C")
! ( 80. . "#FFCA4C")
! (100. . "#FFF44C")
! (120. . "#DFFF4C")
! (140. . "#B5FF4C")
! (160. . "#8BFF4C")
! (180. . "#61FF4C")
! (200. . "#4CFF61")
! (220. . "#4CFF8B")
! (240. . "#4CFFB5")
! (260. . "#4CFFDF")
! (280. . "#4CF4FF")
! (300. . "#4CCAFF")
! (320. . "#4CA0FF")
! (340. . "#4C76FF")
! (360. . "#4C4CFF"))
"Association list of age versus color, for \\[vc-annotate].
Ages are given in units of fractional days. Default is eighteen steps
! using a twenty day increment, from red to blue."
:type 'alist
:group 'vc)
! (defcustom vc-annotate-very-old-color "#4C4CFF"
"Color for lines older than the current color range in \\[vc-annotate]]."
:type 'string
:group 'vc)
***************
*** 2971,2977 ****
(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
"VC Annotate Display Menu"
`("VC-Annotate"
! ["Default" (unless (null vc-annotate-display-mode)
(setq vc-annotate-display-mode nil)
(vc-annotate-display-select))
:style toggle :selected (null vc-annotate-display-mode)]
--- 2972,2978 ----
(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
"VC Annotate Display Menu"
`("VC-Annotate"
! ["By Colormap" (unless (null vc-annotate-display-mode)
(setq vc-annotate-display-mode nil)
(vc-annotate-display-select))
:style toggle :selected (null vc-annotate-display-mode)]
***************
*** 3016,3023 ****
(when buffer
(set-buffer buffer)
(display-buffer buffer))
- (if (not vc-annotate-parent-rev)
- (vc-annotate-mode))
(cond ((null vc-annotate-display-mode)
;; The ratio is global, thus relative to the global color-map.
(kill-local-variable 'vc-annotate-color-map)
--- 3017,3022 ----
***************
*** 3087,3101 ****
;; In case it had to be uniquified.
(setq temp-buffer-name (buffer-name))))
(with-output-to-temp-buffer temp-buffer-name
! (vc-call annotate-command file (get-buffer temp-buffer-name) rev))
! (with-current-buffer temp-buffer-name
! (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
! (set (make-local-variable 'vc-annotate-parent-file) file)
! (set (make-local-variable 'vc-annotate-parent-rev) rev)
! (set (make-local-variable 'vc-annotate-parent-display-mode)
! display-mode))
!
! (message "Annotating... done")))
(defun vc-annotate-prev-version (prefix)
"Visit the annotation of the version previous to this one.
--- 3086,3104 ----
;; In case it had to be uniquified.
(setq temp-buffer-name (buffer-name))))
(with-output-to-temp-buffer temp-buffer-name
! (vc-call annotate-command file (get-buffer temp-buffer-name) rev)
! ;; we must setup the mode first, and then set our local
! ;; variables before the show-function is called at the exit of
! ;; with-output-to-temp-buffer
! (with-current-buffer temp-buffer-name
! (if (not (equal major-mode 'vc-annotate-mode))
! (vc-annotate-mode))
! (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
! (set (make-local-variable 'vc-annotate-parent-file) file)
! (set (make-local-variable 'vc-annotate-parent-rev) rev)
! (set (make-local-variable 'vc-annotate-parent-display-mode)
! display-mode)))
! (message "Annotating... done")))
(defun vc-annotate-prev-version (prefix)
"Visit the annotation of the version previous to this one.
next prev parent reply other threads:[~2006-04-10 22:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-07 23:28 vc-annotate error JD Smith
2006-04-08 0:40 ` Kevin Rodgers
2006-04-08 1:36 ` JD Smith
2006-04-10 22:00 ` JD Smith [this message]
2006-04-10 22:27 ` vc-annotate error, PATCH Stefan Monnier
2006-04-10 22:59 ` JD Smith
2006-04-11 16:57 ` Richard Stallman
2006-04-11 18:02 ` JD Smith
2006-04-11 18:34 ` Dan Nicolaescu
2006-04-11 19:02 ` JD Smith
2006-04-11 19:19 ` Dan Nicolaescu
2006-04-12 17:09 ` Richard Stallman
2006-04-12 19:17 ` JD Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pan.2006.04.10.22.00.13.145676@as.arizona.edu \
--to=jdsmith@as.arizona.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).