[PATCH] emacs: show: stop display of appliaction/* parts
Tomas Nordin
tomasn at posteo.net
Sun Jan 8 11:52:05 PST 2017
Hello Tomi
Tomi Ollila <tomi.ollila at iki.fi> writes:
> I tried to test the above in emacs *scratch* buffer, but cannot get
> either of the formats work when variable is non-nil.
> example tries
>
> (defcustom a '(a b) "a")
> (defcustom b (list "a" "b") "b")
> (defcustom c (cons 1 nil) "c")
>
> then
>
> (equal a (car (get 'a 'standard-value))) C-j
> nil
>
> (equal (list a) (get 'a 'standard-value)) C-j
> nil
>
> same with b & c
>
> with (defcustom n nil "n") the above work
>
> According to defcustom documentation the expression of STANDARD
> is also stored -- when evaluating (get 'var 'standard-value) the
> output looks like it: for example (get 'c 'standard-value)
> ((cons 1 nil))
>
> If the same happens when using the patch, then we need to look alternative
> -- there might be something good, as customize knows when variable is
> modified...
I played on a bit with your scratch...
(defcustom a '(a b) "a")
(defcustom b (list "a" "b") "b")
(defcustom c (cons 1 nil) "c")
(defcustom T 10 "T")
a -> (a b)
b -> ("a" "b")
c -> (1)
T -> 10
;;; look at one of the plists
(symbol-plist 'a) -> (standard-value ((quote (a b))) custom-requests nil variable-documentation "a")
(get 'a 'standard-value) -> ((quote (a b)))
(car (get 'a 'standard-value)) -> (quote (a b))
(eval (car (get 'a 'standard-value))) -> (a b)
(get 'b 'standard-value) -> ((list "a" "b"))
(car (get 'b 'standard-value)) -> (list "a" "b")
(eval (car (get 'b 'standard-value))) -> ("a" "b")
(get 'c 'standard-value) -> ((cons 1 nil))
(car (get 'c 'standard-value)) -> (cons 1 nil)
(eval (car (get 'c 'standard-value))) -> (1)
(get 'T 'standard-value) -> (10)
(car (get 'T 'standard-value)) -> 10
(eval (car (get 'T 'standard-value))) -> 10
(equal a (eval (car (get 'a 'standard-value)))) -> t
(equal b (eval (car (get 'b 'standard-value)))) -> t
(equal c (eval (car (get 'c 'standard-value)))) -> t
(equal T (eval (car (get 'T 'standard-value)))) -> t
Could it be that the car need to be evaled before compared to the value
of the variable? It looks like it with those experiments.
The docs also say something in those lines:
Internally, ‘defcustom’ uses the symbol property ‘standard-value’ to
record the expression for the standard value, ‘saved-value’ to record
the value saved by the user with the customization buffer, and
‘customized-value’ to record the value set by the user with the
customization buffer, but not saved. *Note Symbol Properties::. These
properties are lists, the car of which is an expression that evaluates
to the value.
... thinking about the last sentence. But it seems strange if there is
not a more convenient function to do this.
What do you think?
Best regards
--
Tomas
More information about the notmuch
mailing list