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: Pascal J. Bourguignon
Subject: Re: How to customize an option to a dynamic value (computed by lisp form)
Date: Wed, 24 Aug 2016 19:50:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Jorge <jorge13515@gmail.com> writes:

> Hi.  I set three options to a dynamic value, using the value of the option
> `org-directory'.  Now my custom-set-variables call in init.el includes the
> following:
>
>    '(org-agenda-files
>      (list
>       (concat org-directory "/agenda/")
>       "~/Dropbox/wanessa_e_jorge/administração_clínica/derma-prime.org"))
>    [...]
>    '(org-icalendar-combined-agenda-file (concat org-directory "/org.ics"))
>    [...]
>    '(org-mobile-inbox-for-pull (concat org-directory 
> "/agenda/from-mobile.org"))
>
> The problem is that when I try to customize one of these three options, the
> customize buffer does not know that the value was computed dynamically.  For
> example, the customize buffer for org-mobile-inbox-for-pull shows the value as
> simply "~/org/agenda/from-mobile.org".  This means that if I edit the value to
> "~/org/agenda/from-mobile42.org" and save the customization, it will be 
> written
> to init.el as a string literal, no longer respecting org-directory.  Then if I
> later change org-directory I will have problems.
>
> Previously I worked around this problem by setting these options manually
> (editing org-init.el, which is called by init.el), but I think the ideal would
> be to use customize, so I decided to ask here.  I have already searched Google
> and the list archives.
>
> Thank you for your attention.


Since the customization system updates the source form
customize-variables in your init file (actually, in the file indicated by
the custom-file customization variable), and when it saves this source
form, it saves the values of the variables, not the dynamic expressions
you would use to compute them, you won't have much choice if you want to
keep it simple.

Just set the customization variables to your expressions after the
customize-variables form.


Of course, you can alway extend the customization system to take an optional
expression (to be evaluated in what environment?) for each customization
variable, and to generate the customize-variables form using those
expressions instead of the customization variables values.

Is it worth the trouble?
Customization variables are designed for people who can't type a lisp
expression.
As a lisper it's easier to just set the variables yourself.

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk




reply via email to

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