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

On Sun, Jan 08 2017, Tomas Nordin <tomasn@posteo.net> wrote:

> Hello Tomi
>
>
> 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?

I looked a bit into custom.el, and it was doing exactly that
(i.e. (eval (car (get symbol 'standard-value)))
like everywhere...

Nice play,

Tomi

>
> Best regards
> --
> Tomas

  reply	other threads:[~2017-01-08 21: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
2017-01-08 21:49       ` Tomi Ollila [this message]
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=m28tqlql1l.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    --cc=tomasn@posteo.net \
    /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).