GNU bug report logs - #18189
customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Mon, 4 Aug 2014 13:19:02 UTC

Severity: minor

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18189 in the body.
You can then email your comments to 18189 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18189; Package emacs. (Mon, 04 Aug 2014 13:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Pogonyshev <pogonyshev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Aug 2014 13:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: customized value of 'vc-annotate-background-mode' is applied only
 after restarting Emacs
Date: Mon, 4 Aug 2014 15:18:06 +0200
[Message part 1 (text/plain, inline)]
To reproduce:

- customize the variable and toggle its value;
- observe that annotation buffers still look the same, even if you generate
them anew;
- new variable value is only honored if you restart Emacs.

Ideally the value should be apply on-the-fly. But at least it should be
applied if I hit 'C-x v g' after customizing the variable.

Paul
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18189; Package emacs. (Tue, 05 Aug 2014 00:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 18189 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 18189 <at> debbugs.gnu.org
Subject: Re: bug#18189: customized value of 'vc-annotate-background-mode' is
 applied only after restarting Emacs
Date: Tue, 05 Aug 2014 03:11:05 +0300
> To reproduce:
>
> - customize the variable and toggle its value;
> - observe that annotation buffers still look the same, even if you generate
> them anew;
> - new variable value is only honored if you restart Emacs.
>
> Ideally the value should be apply on-the-fly. But at least it should be
> applied if I hit 'C-x v g' after customizing the variable.

I believe this should be implemented by this patch:

=== modified file 'lisp/vc/vc-annotate.el'
--- lisp/vc/vc-annotate.el	2014-07-08 08:49:18 +0000
+++ lisp/vc/vc-annotate.el	2014-08-05 00:07:51 +0000
@@ -139,6 +139,12 @@ (defcustom vc-annotate-color-map
   :type 'alist
   :group 'vc)
 
+(put 'vc-annotate-background-mode 'custom-set
+     (lambda (symbol value)
+       (set-default symbol value)
+       (ignore-errors
+	 (custom-reevaluate-setting 'vc-annotate-color-map))))
+
 (defcustom vc-annotate-very-old-color (if vc-annotate-background-mode "#CCCCFF" "#3F3FFF")
   "Color for lines older than the current color range in \\[vc-annotate]."
   :type 'string





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18189; Package emacs. (Wed, 06 Aug 2014 17:34:01 GMT) Full text and rfc822 format available.

Message #11 received at 18189 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: Paul Pogonyshev <pogonyshev <at> gmail.com>, 18189 <at> debbugs.gnu.org
Subject: Re: bug#18189: customized value of 'vc-annotate-background-mode' is
 applied only after restarting Emacs
Date: Wed, 06 Aug 2014 13:32:59 -0400
> +(put 'vc-annotate-background-mode 'custom-set
> +     (lambda (symbol value)
> +       (set-default symbol value)
> +       (ignore-errors
> +	 (custom-reevaluate-setting 'vc-annotate-color-map))))

Why not provide it directly in the `defcustom'?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18189; Package emacs. (Sat, 09 Aug 2014 00:51:02 GMT) Full text and rfc822 format available.

Message #14 received at 18189 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Paul Pogonyshev <pogonyshev <at> gmail.com>, 18189 <at> debbugs.gnu.org
Subject: Re: bug#18189: customized value of 'vc-annotate-background-mode' is
 applied only after restarting Emacs
Date: Sat, 09 Aug 2014 02:31:50 +0300
>> +(put 'vc-annotate-background-mode 'custom-set
>> +     (lambda (symbol value)
>> +       (set-default symbol value)
>> +       (ignore-errors
>> +	 (custom-reevaluate-setting 'vc-annotate-color-map))))
>
> Why not provide it directly in the `defcustom'?

`vc-annotate-background-mode' is defined before `vc-annotate-color-map'
in the source file vc-annotate.el, so there is a cyclic dependency
in these variables.  When I tried to provide it directly in the `defcustom'

  :set (lambda (symbol value)
	 (set-default symbol value)
	 (ignore-errors
	   (custom-reevaluate-setting 'vc-annotate-color-map)))

then loading the file failed with the error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  #[257 "\211\300_\301\302\303\"\304\305E\306\307\310\311\312E&\207" [nil vector format "Span %.1f days" vc-annotate-display-select nil :style toggle :selected eql vc-annotate-display-mode] 11 "\n\n(fn ELEMENT)"](2)
  mapcar(#[257 "\211\300_\301\302\303\"\304\305E\306\307\310\311\312E&\207" [nil vector format "Span %.1f days" vc-annotate-display-select nil :style toggle :selected eql vc-annotate-display-mode] 11 "\n\n(fn ELEMENT)"] (2 0.5 0.1 0.01))
  byte-code("\304\305\306\307\310\311\312!\313\314\315\316\317\320!\321\"\322\323%\n\"\262\324\325\326\327\325\330\331\332\333\334\335\325\336\337\340\320\341\342\343\344\345\346\347BBE\350BBBB\"\351BBBBBBBBBBBBBBB\"BB$\207" [vc-annotate-mode-map vc-annotate-color-map vc-annotate-menu-elements vc-annotate-backend easy-menu-do-define vc-annotate-mode-menu "VC Annotate Display Menu" "VC-Annotate" ["By Color Map Range" (unless (null vc-annotate-display-mode) (setq vc-annotate-display-mode nil) (vc-annotate-display-select)) :style toggle :selected (null vc-annotate-display-mode)] append vc-annotate-oldest-in-map mapcar make-byte-code 257 "\211\300_\301\302\303\"\304\305E\306\307\310\311\312E&\207" vconcat vector [vector format "Span %.1f days" vc-annotate-display-select nil :style toggle :selected eql vc-annotate-display-mode] 11 "\n\n(fn ELEMENT)" ["Span ..." (vc-annotate-display-select nil (float (string-to-number (read-string "Span how many days? "))))] "--" ["Span to Oldest" (unless (eq vc-annotate-display-mode (quote scale)) (vc-annotate-display-select nil (quote scale))) :help "Use an autoscaled color map from the oldest annotation to the current time" :style toggle :selected (eq vc-annotate-display-mode (quote scale))] ["Span Oldest->Newest" (unless (eq vc-annotate-display-mode (quote fullscale)) (vc-annotate-display-select nil (quote fullscale))) :help "Use an autoscaled color map from the oldest to the newest annotation" :style toggle :selected (eq vc-annotate-display-mode (quote fullscale))] ["Toggle annotation visibility" vc-annotate-toggle-annotation-visibility :help "Toggle whether the annotation is visible or not"] ["Annotate previous revision" vc-annotate-prev-revision :help "Visit the annotation of the revision previous to this one"] ["Annotate next revision" vc-annotate-next-revision :help "Visit the annotation of the revision after this one"] ["Annotate revision at line" vc-annotate-revision-at-line :help "Visit the annotation of the revision identified in the current line"] ["Annotate revision previous to line" vc-annotate-revision-previous-to-line :help "Visit the annotation of the revision before the revision at line"] ["Annotate latest revision" vc-annotate-working-revision :help "Visit the annotation of the working revision of this file"] ["Show log of revision at line" vc-annotate-show-log-revision-at-line :help "Visit the log of the revision at line"] ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line :help "Visit the diff of the revision at line from its previous revision"] apply "Show changeset diff of revision at line" vc-annotate-show-changeset-diff-revision-at-line :enable eq (quote repository) vc-call-backend ((quote revision-granularity)) (:help "Visit the diff of the revision at line from its previous revision") (["Visit revision at line" vc-annotate-find-revision-at-line :help "Visit the revision identified in the current line"])] 32)
  autoload-do-load((autoload "vc-annotate" 1541696 t nil) vc-annotate)
  command-execute(vc-annotate)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18189; Package emacs. (Sat, 09 Aug 2014 01:50:01 GMT) Full text and rfc822 format available.

Message #17 received at 18189 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: Paul Pogonyshev <pogonyshev <at> gmail.com>, 18189 <at> debbugs.gnu.org
Subject: Re: bug#18189: customized value of 'vc-annotate-background-mode' is
 applied only after restarting Emacs
Date: Fri, 08 Aug 2014 21:49:15 -0400
> `vc-annotate-background-mode' is defined before `vc-annotate-color-map'
> in the source file vc-annotate.el, so there is a cyclic dependency
> in these variables.  When I tried to provide it directly in the `defcustom'

>   :set (lambda (symbol value)
> 	 (set-default symbol value)
> 	 (ignore-errors
> 	   (custom-reevaluate-setting 'vc-annotate-color-map)))

Maybe we should check (boundp 'vc-annotate-color-map) before calling
custom-reevaluate-setting.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18189; Package emacs. (Sat, 09 Aug 2014 20:06:02 GMT) Full text and rfc822 format available.

Message #20 received at 18189 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 18189 <at> debbugs.gnu.org,
 Paul Pogonyshev <pogonyshev <at> gmail.com>
Subject: Re: bug#18189: customized value of 'vc-annotate-background-mode' is
 applied only after restarting Emacs
Date: Sat, 09 Aug 2014 16:05:11 -0400
Juri Linkov wrote:

> `vc-annotate-background-mode' is defined before `vc-annotate-color-map'
> in the source file vc-annotate.el, so there is a cyclic dependency
> in these variables.  When I tried to provide it directly in the `defcustom'

Usually that's a sign you need an :initialize as well as a :set, and/or
a :set-after.




Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Sun, 10 Aug 2014 00:02:03 GMT) Full text and rfc822 format available.

Notification sent to Paul Pogonyshev <pogonyshev <at> gmail.com>:
bug acknowledged by developer. (Sun, 10 Aug 2014 00:02:04 GMT) Full text and rfc822 format available.

Message #25 received at 18189-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 18189-done <at> debbugs.gnu.org,
 Paul Pogonyshev <pogonyshev <at> gmail.com>
Subject: Re: bug#18189: customized value of 'vc-annotate-background-mode' is
 applied only after restarting Emacs
Date: Sun, 10 Aug 2014 02:57:43 +0300
>> `vc-annotate-background-mode' is defined before `vc-annotate-color-map'
>> in the source file vc-annotate.el, so there is a cyclic dependency
>> in these variables.  When I tried to provide it directly in the `defcustom'
>
> Usually that's a sign you need an :initialize as well as a :set, and/or
> a :set-after.

I don't see how :initialize and :set-after could be used
to update the value of the dependent variable, and can't find
a suitable example in the source code, so I just added a check
for (boundp 'vc-annotate-color-map).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Sep 2014 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.