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: Sat, 12 Dec 2015 13:09:57 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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

On Sat, Dec 12, 2015 at 09:31:49AM +0100, Lele Gaifax wrote:
> Drew Adams <drew.adams@oracle.com> writes:
> 
> >> 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.
> 
> Ok, thanks, I will rethink my step.
> 
> > 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.)
> 
> How's it that possible? How can then I know when to use `setq', `setq-default'
> or `customize-set-variable'?

I think Lele has a point here. Imagine some "simple" variable which becomes
later (i.e. in a later Emacs version) a user option. The once "right" code
in the Emacs init file becomes kind-of "wrong".

This makes the idea of a "generic" setq which'd invoke a setter if there is
one somewhat attractive, doesn't it?

OTOH this is only valuable if it becomes a "common idiom"; otherwise the
readability argument Drew advances applies.

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

iEYEARECAAYFAlZsDpUACgkQBcgs9XrR2kY9KQCfc8KZIZsRu0dNby4DRHP5vvGu
3G4AnjqzLdYQkwQ0rZ/rImyWhOzibjSN
=3W0C
-----END PGP SIGNATURE-----



reply via email to

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