all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jorge <jorge13515@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "Pascal J. Bourguignon" <pjb@informatimago.com>, help-gnu-emacs@gnu.org
Subject: Re: How to customize an option to a dynamic value (computed by lisp form)
Date: Fri, 26 Aug 2016 09:54:49 -0300	[thread overview]
Message-ID: <CAJR3Qnc-9e0DcYZjwii_6CXdZYc1askY3vD=6WuGYqMtJ2Ce=A@mail.gmail.com> (raw)
In-Reply-To: <83832586-765e-4df4-917a-98458247d829@default>

On 25 August 2016 at 17:54, Drew Adams <drew.adams@oracle.com> wrote:
>> How can I elegantly combine both?  And shouldn't elisp
>> provide a convenient command for this?
>
> Try to specify the behavior you want (more clearly).  Presumably
> you are looking for a way, using Lisp (non-interactively), to set
> an option value and get all of the behavior that you get when you
> set it using the Customize UI (:set, :type, etc. control).
I want one elisp function that, even when called non-interactively,
respects custom-set and does type-checking.

> A variable value is always "static", by definition of the word "value".
> It's not clear (to me) just what you are looking for.
I am sorry.  By "static value" I meant "literal".

>
> BTW, you can easily check whether an option has been changed outside
> Customize, i.e., using something like `setq' and not something like
> `customize-set-variable', by invoking code such as this (taken from
> `customize-rogue', which lets you open Customize for all such options):
>
> (defun rogue-option-p (symbol)
>   (let ((cval  (or (get symbol 'customized-value)
>                    (get symbol 'saved-value)
>                    (get symbol 'standard-value))))
>     (and cval                           ;Declared with defcustom.
>          (default-boundp symbol)        ;Has a value.
>          (not (equal (eval (car cval))
>                      ;; Which does not match customize.
>                      (default-value symbol))))))
Thank you for sharing this.  But for now, I think I will rely on my
memory (I just have to remember that three options are customized on
org-init.el, and I can memorize the fact that options that use the
value of org-directory are configured in org-init.el).
-- 
• I am Brazilian.  I hope my English is correct and I welcome corrections.
• Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
• Free (as in free speech) software for Android: https://f-droid.org/



  reply	other threads:[~2016-08-26 12:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 20:26 How to customize an option to a dynamic value (computed by lisp form) Jorge
2016-08-24 17:50 ` Pascal J. Bourguignon
2016-08-25 17:55   ` Jorge
2016-08-25 20:54     ` Drew Adams
2016-08-26 12:54       ` Jorge [this message]
2016-08-26 13:26         ` Jorge
2016-08-26 14:28         ` Drew Adams
2016-08-26 19:02           ` Jorge
2016-08-26 20:18             ` Jorge
2016-08-26 20:59             ` Drew Adams
2016-08-27 11:50               ` tomas
2016-08-30 20:42               ` Jorge

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

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

  git send-email \
    --in-reply-to='CAJR3Qnc-9e0DcYZjwii_6CXdZYc1askY3vD=6WuGYqMtJ2Ce=A@mail.gmail.com' \
    --to=jorge13515@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pjb@informatimago.com \
    /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 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.