help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to customize an option to a dynamic value (computed by lisp form


From: Jorge
Subject: Re: How to customize an option to a dynamic value (computed by lisp form)
Date: Fri, 26 Aug 2016 09:54:49 -0300

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 via email to

[Prev in Thread] Current Thread [Next in Thread]