unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* custom-set-variables considered harmful
@ 2017-11-04 17:10 Stefan Monnier
  2017-11-06  9:02 ` Philippe Vaucher
                   ` (3 more replies)
  0 siblings, 4 replies; 38+ messages in thread
From: Stefan Monnier @ 2017-11-04 17:10 UTC (permalink / raw)
  To: emacs-devel

I keep seeing people copy and pasting part of calls to
custom-set-variables, and getting all confused about it.

I think we should stop using it.  Here's a proposal for that.

When writing customizations, instead of writing

    (custom-set-variables
     ;; Big ugly warning which doesn't help enough.
     '(VAR1 VAL1)
     '(VAR2 VAL2 nil '(REQUEST) COMMENT)
     '(VAR3 VAL3)
     ...)

we write

    (autogenerated-custom-settings
      ;; Big warning, still, but less important.
      (setq VAR1 VAL1)
      (require 'REQUEST)
      (customize-set-variable VAR2 VAL2 COMMENT)
      (customize-set-variable VAR3 VAL3)
      ...)

where `autogenerated-custom-settings` is a macro which turns that call
back into the form expected by custom-set-variables.

The idea is basically to use a syntax which happens to look close to
what you'd write by hand if you weren't using Customize, so that users
who copy&paste snippets of code end up copying more or less valid code,
instead of copying "code" like

    '(toto 2)

and then be surprised that it doesn't do anything.

[ The difference between VAR1 and VAR3 is that VAR1 doesn't have
  a setter.  I guess in some cases we should emit `(setq-default VAR VAL)`
  also.  ]

One question, tho: could someone explain to me what the NOW is used
for, really?  I've read the docstrings, comments, and the code that
seems related to it, and I have some idea of what it supposedly does,
but I don't have a clear idea of a scenario where it's used.


        Stefan



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2017-12-05  1:45 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-04 17:10 custom-set-variables considered harmful Stefan Monnier
2017-11-06  9:02 ` Philippe Vaucher
2017-11-06 12:19   ` Clément Pit-Claudel
2017-11-06 16:36   ` raman
2017-11-07 19:53     ` Stefan Monnier
2017-11-08 10:06 ` Vivek Dasmohapatra
2017-11-08 13:38   ` Stefan Monnier
2017-11-08 14:23     ` Vivek Dasmohapatra
2017-11-08 15:17       ` Stefan Monnier
2017-11-08 15:34         ` Vivek Dasmohapatra
2017-11-13 16:26 ` Stefan Monnier
2017-11-24  7:04   ` Elias Mårtenson
2017-11-24  7:16     ` Stefan Monnier
2017-11-24 17:37       ` Clément Pit-Claudel
2017-11-24 17:56         ` Stefan Monnier
2017-11-26 12:15       ` Elias Mårtenson
2017-11-26 16:30         ` Drew Adams
2017-11-28 14:12         ` Philippe Vaucher
2017-11-28 16:50           ` John Wiegley
2017-12-01  9:44             ` Philippe Vaucher
2017-11-29  3:36           ` Elias Mårtenson
2017-11-29 15:00             ` Stefan Monnier
2017-11-29 15:03               ` Drew Adams
2017-12-01 20:42                 ` Robert Weiner
2017-12-02  0:10                   ` Richard Stallman
2017-12-02  1:58                     ` Drew Adams
2017-12-02  5:56                 ` Teemu Likonen
2017-11-29 16:35               ` Elias Mårtenson
2017-11-29 19:57                 ` Scott Randby
2017-11-29 22:08                   ` Stefan Monnier
2017-11-30  0:40                     ` Scott Randby
2017-12-01  9:51             ` Philippe Vaucher
2017-12-04 13:48   ` Stefan Monnier
2017-12-04 15:36     ` Eli Zaretskii
2017-12-04 16:05     ` Robert Weiner
2017-12-04 23:50     ` Richard Stallman
2017-12-05  1:45       ` Stefan Monnier
2017-11-23 20:12 ` John Wiegley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).