all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jorge <jorge13515@gmail.com>
To: "Pascal J. Bourguignon" <pjb@informatimago.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to customize an option to a dynamic value (computed by lisp form)
Date: Thu, 25 Aug 2016 14:55:36 -0300	[thread overview]
Message-ID: <CAJR3QneOs2digjSU2MQ4-MAwUnCeQRq5AxkCrHvhkCU+DFzkwg@mail.gmail.com> (raw)
In-Reply-To: <87k2f69hvb.fsf@kuiper.lan.informatimago.com>

On 24 August 2016 at 14:50, Pascal J. Bourguignon <pjb@informatimago.com> wrote:

> 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.
OK.  I have moved the customization of these three options to my
org-init.el.  Instead of the simple setq, I used
customize-set-variable, because it respects the respective custom-set
property (if it exists).

There remain two problems:
1.  customize-set-variable does not do type checking.  I have just
tested it by setting org-agenda-files to 42 (an integer).
set-variable does type checking, but does not respect any custom-set
property.  How can I elegantly combine both?  And shouldn't elisp
provide a convenient command for this?
2.  If I forget that these options are changed manually (Emacs does
not warn), and configure them via customize, then the new value will
be added to the custom-set-variables form with static values.  This
has two problems:
      1. It will have static values.
      2. Since org-init.el is called after the custom-set-variables
form, the values set in the form will be overwritten.



  reply	other threads:[~2016-08-25 17:55 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 [this message]
2016-08-25 20:54     ` Drew Adams
2016-08-26 12:54       ` Jorge
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=CAJR3QneOs2digjSU2MQ4-MAwUnCeQRq5AxkCrHvhkCU+DFzkwg@mail.gmail.com \
    --to=jorge13515@gmail.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.