all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
@ 2014-08-04 13:18 Paul Pogonyshev
  2014-08-05  0:11 ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Pogonyshev @ 2014-08-04 13:18 UTC (permalink / raw)
  To: 18189

[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 461 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
  2014-08-04 13:18 bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs Paul Pogonyshev
@ 2014-08-05  0:11 ` Juri Linkov
  2014-08-06 17:32   ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2014-08-05  0:11 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 18189

> 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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
  2014-08-05  0:11 ` Juri Linkov
@ 2014-08-06 17:32   ` Stefan Monnier
  2014-08-08 23:31     ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2014-08-06 17:32 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Paul Pogonyshev, 18189

> +(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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
  2014-08-06 17:32   ` Stefan Monnier
@ 2014-08-08 23:31     ` Juri Linkov
  2014-08-09  1:49       ` Stefan Monnier
  2014-08-09 20:05       ` Glenn Morris
  0 siblings, 2 replies; 7+ messages in thread
From: Juri Linkov @ 2014-08-08 23:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Paul Pogonyshev, 18189

>> +(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)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
  2014-08-08 23:31     ` Juri Linkov
@ 2014-08-09  1:49       ` Stefan Monnier
  2014-08-09 20:05       ` Glenn Morris
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2014-08-09  1:49 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Paul Pogonyshev, 18189

> `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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
  2014-08-08 23:31     ` Juri Linkov
  2014-08-09  1:49       ` Stefan Monnier
@ 2014-08-09 20:05       ` Glenn Morris
  2014-08-09 23:57         ` Juri Linkov
  1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2014-08-09 20:05 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 18189, Paul Pogonyshev

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs
  2014-08-09 20:05       ` Glenn Morris
@ 2014-08-09 23:57         ` Juri Linkov
  0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2014-08-09 23:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 18189-done, Paul Pogonyshev

>> `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).





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-09 23:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04 13:18 bug#18189: customized value of 'vc-annotate-background-mode' is applied only after restarting Emacs Paul Pogonyshev
2014-08-05  0:11 ` Juri Linkov
2014-08-06 17:32   ` Stefan Monnier
2014-08-08 23:31     ` Juri Linkov
2014-08-09  1:49       ` Stefan Monnier
2014-08-09 20:05       ` Glenn Morris
2014-08-09 23:57         ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.