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

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

Re: which one to use: custom-set-variables, customize-set-variable, or c


From: tomas
Subject: Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
Date: Sun, 13 Dec 2015 09:17:01 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Dec 12, 2015 at 08:11:07AM -0800, Drew Adams wrote:
> > d> And no, you do not ever need to "check each variable documentation to
> > d> see the right way to set its value".  (And you should anyway not rely
> > d> on a variable's documentation for that.)
> > 
> > How's it that possible? How can then I know when to use `setq',
> > `setq-default' or `customize-set-variable'?
> 
> > t> I think Lele has a point here. Imagine some "simple" variable which
> > t> becomes later (i.e. in a later Emacs version) a user option. The
> > t> once "right" code in the Emacs init file becomes kind-of "wrong".
> > 
> > Yes, exactly. Or a buffer-local setting, when it would be even more
> > "wrong".
> 
> Perhaps I misunderstood.  I thought you meant check the doc for a
> description of what the :set function does, initialization, etc.
> 
> Anyway, what I meant is to not check _only the documentation_.
> Check also the definition of the variable.
> 
> While the documentation should correctly report whether it is
> an option, and whether it might have a buffer-local value, it
> is still good, IMO, to check the defvar/defcustom.

Definitely agree here.

> As I said, you can certainly do as you suggest.  My suggestion is
> to clearly show in your init file how you are setting the value.
> Including for different Emacs versions - so you are aware of such
> changes when you read your code later.  But it's just a suggestion.

Here I was trying to make a case for some kind of "generic setter"
which knows what the right thing is. Of course, such a generic setter
wouldn't be half as valuable without a context. I wouldn't do it in
my init file as of now, where it's not "usual".

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZtKX0ACgkQBcgs9XrR2kYrfACeIPsVUb6XeqXhA/7OMGkA72ep
tcsAnjOZg9CkzUfgxWpRY8iHg/FzZj0+
=NHyI
-----END PGP SIGNATURE-----



reply via email to

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