unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomas Nordin <tomasn@posteo.net>
To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: show: stop display of appliaction/* parts
Date: Sun, 08 Jan 2017 20:52:05 +0100	[thread overview]
Message-ID: <877f65qqhm.fsf@debian.tompa.tv> (raw)
In-Reply-To: <m28tql30qj.fsf@guru.guru-group.fi>

Hello Tomi

Tomi Ollila <tomi.ollila@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

  reply	other threads:[~2017-01-08 19:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07 21:25 [PATCH] emacs: show: stop display of appliaction/* parts Mark Walters
2017-01-07 23:12 ` Tomas Nordin
2017-01-08 12:22   ` David Bremner
2017-01-08 13:09 ` Tomi Ollila
2017-01-08 17:44   ` Tomi Ollila
2017-01-08 19:52     ` Tomas Nordin [this message]
2017-01-08 21:49       ` Tomi Ollila
2017-01-28  9:47         ` [PATCH v2] emacs: show: stop display of application/* parts Mark Walters
2017-02-12 22:53           ` Tomas Nordin
2017-02-13 14:33             ` David Bremner
2017-02-27  8:31               ` Mark Walters
2017-02-27  9:00                 ` Tomi Ollila
2017-02-27 20:36                 ` Tomas Nordin

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://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877f65qqhm.fsf@debian.tompa.tv \
    --to=tomasn@posteo.net \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /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://yhetil.org/notmuch.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).