all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Lele Gaifax <lele@metapensiero.it>, help-gnu-emacs@gnu.org
Subject: RE: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
Date: Fri, 11 Dec 2015 10:53:30 -0800 (PST)	[thread overview]
Message-ID: <63e721db-3901-4017-a254-a679a4d8d04e@default> (raw)
In-Reply-To: <87twnorgig.fsf@metapensiero.it>

> After reading this thread, as well as the referenced
> http://permalink.gmane.org/gmane.emacs.bugs/107690, I tried to see if I
> should
> rectify some settings in my own init file. Indeed, I was using `setq' on a
> bunch of customizable options...
> 
> Given that checking each variable documentation to see the right way to
> set its value is error prone, I wrote the following macro and used it in
> almost all cases, replacing `setq' and `set-default' in my configuration:
> 
>     (defmacro csetq (variable value)
>       "Macro to set the value of a variable, possibly a custom user
> option."
>       `(funcall (or (get ',variable 'custom-set)
>                     (and (plist-member (symbol-plist ',variable)
> 'standard-value) 'set-default)
>                     'set)
>                 ',variable ,value))
> 
> While it seems working as expected, I like to hear other's opinion: do you
> see any problem with this approach?

You can do that.  But I would advise just using `customize-set-variable'
for a user option, and using `setq' or `setq-default' etc. for non-options.

That is much more readable in your code, IMO.

And no, you do not ever need to "check each variable documentation to
see the right way to set its value".  (And you should anyway not rely
on a variable's documentation for that.)



  reply	other threads:[~2015-12-11 18:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 18:47 which one to use: custom-set-variables, customize-set-variable, or customize-set-value? Alan Schmitt
2015-11-29 19:19 ` Drew Adams
2015-11-30  8:52   ` Alan Schmitt
2015-11-30 15:20     ` Drew Adams
2015-11-30 15:44       ` Alan Schmitt
2015-12-11 18:23       ` Lele Gaifax
2015-12-11 18:53         ` Drew Adams [this message]
2015-12-12  8:31           ` Lele Gaifax
2015-12-12 12:09             ` tomas
2015-12-12 13:31               ` Lele Gaifax
2015-12-12 16:11             ` Drew Adams
2015-12-13  8:17               ` tomas
2015-12-13 17:32                 ` Drew Adams
2015-12-14  2:44                   ` B.V. Raghav
2015-12-14  8:28                   ` Lele Gaifax

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=63e721db-3901-4017-a254-a679a4d8d04e@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=lele@metapensiero.it \
    /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.