unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "rms@gnu.org" <rms@gnu.org>, Howard Melman <hmelman@gmail.com>
Cc: "21695@debbugs.gnu.org" <21695@debbugs.gnu.org>
Subject: bug#21695: [External] : bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable'? Really?
Date: Thu, 2 Sep 2021 17:08:22 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488B07306EBA9F4432BDFB6F3CE9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <E1mLdc4-0004JR-W5@fencepost.gnu.org>

>> Searching emacs 27.2 elisp source I find about 400 hits for :set.
> 
> That is more than I expected.  However, there around 8000 defcustoms
> in master as of May 11, and only 462 instances of :set.

Numbers are good to have.  But we've said from the
beginning that a small minority of defcustoms use
:set.  That's 6%, which doesn't surprise me at all.

(Of course that checks only code that's part of
Emacs as distributed, not 3rd-party code.  But I
expect the proportion to be even smaller there.)

> Telling people to use customize-set-variable for all 8000 of them
> feels like the tail wagging the dog.

No one, I think, has suggested that users should
privilege using Lisp to set user options.  I said
we should recommend that they use the Customize UI.

For users who do sometimes use Lisp for that, no
one has suggested that they customize all 8000
options.  What was suggested is that for Lisp use
it's appropriate to use `customize-set-variable',
not `setq'.

> I have a feeling that most of those 462 with :set actually require
> that people use customize-set-variable to set them in the init file.

Why that feeling?  Why not a feeling that :set and
:initialize are there mainly with the expectation
that users use the Customize UI?

> I suspect that, for most of them, :set is meant to handle the case
> where you change the setting once the feature is already in use.

Why do you suspect that?  And what difference does
it make when (or why) you change the value?  Maybe
I'm missing something here - could you elaborate?

> I think that if we eliminate these, we will get a much smaller
> number of exceptions, and we could find a nicer way to handle them.

Again, I'm not clear about what you're saying, or
why.  I guess you mean eliminate the use of :set
in some of those defcustoms that use it?

> But even with 462 exceptions, it could be easy enough to warn about
> setting one of those in .emacs with setq.

I don't think that's the right approach, but I
hear you.  (Eli spoke to the use of warnings for
init-file loading.)
________


I suggest that we create a short alias, such as
`cset' for `customize-set-variable' - for "set
custom variable".

And I suggest that we recommend, for options,
that users use, in order of priority/favor:

 1. The Customize UI.
 2 `cset' if they don't use the UI.

Simple.  Both just DTRT for options.  No gotcha.

And I suggest that we motivate this by telling
users why - tell them that setting some options
requires additional behavior, besides just
setting the value (i.e., besides `setq').

Not the end of the world for users who don't
read or follow that recommendation - just what we
have now (gotchas in a small minority of cases).

And I recommend that the doc examples that use
`setq' with user options be changed to use `cset'.

I don't think this is a radical or cumbersome
proposal.  Others can disagree, of course.  If
implemented, who would be bothered by it, in
practice?  Not those who would continue to use
`setq' with options, I expect.

How much doc would actually need to be fixed?
Likely very little, but it would mean checking
occurrences of `setq'.  How many example
occurrences involve options?  I expect few.
___

Here's another alternative (I'm _not_ suggesting
it):

`customize-set-variable' in fact does just a
`set' if applied to a non-option.  This means
that `set' and `setq' could do just that, i.e.,
they could take care of the option case.

Looking at the code for `customize-set-variable',
it seems like is should first test whether the
arg is in fact an option, before doing a bunch
of custom stuff.  Maybe I'm misreading, and
there's no quicker way.

Or maybe `customize-set-variable' should _not_
set non-options?  Maybe it should raise an error
for a non-option?  (Someone will say that's not
backward-compatible...)
___

Anyway, I remind everyone posting in this thread
that the bug was already summarily dismissed
("won't fix").


  parent reply	other threads:[~2021-09-02 17:08 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 21:50 bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable' Drew Adams
2015-10-16 23:57 ` Drew Adams
2021-05-26 22:30 ` Lars Ingebrigtsen
2021-08-29 19:05 ` Drew Adams
2021-08-29 22:36   ` Drew Adams
2021-08-29 22:52     ` Drew Adams
2021-08-29 22:58       ` Drew Adams
2021-08-31  3:06     ` bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable'? Really? Richard Stallman
2021-08-31  3:43       ` Arthur Miller
2021-08-31 16:15         ` bug#21695: [External] : " Drew Adams
2021-08-31 16:15       ` Drew Adams
2021-09-02  6:53         ` Kevin Vigouroux via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-02 17:08           ` Drew Adams
2021-09-03  9:54             ` bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable' Kevin Vigouroux via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-01  3:07       ` bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable'? Really? Howard Melman
2021-09-02  3:42         ` Richard Stallman
2021-09-02  6:53           ` Eli Zaretskii
2021-09-02 17:08             ` bug#21695: [External] : " Drew Adams
2021-09-02 17:17               ` Eli Zaretskii
2021-09-05  3:42                 ` Richard Stallman
2021-09-05  3:43             ` Richard Stallman
2021-09-06 17:43               ` Eli Zaretskii
2021-09-08  3:23                 ` Richard Stallman
2021-09-08  7:03                   ` Eli Zaretskii
2021-09-09  3:11                     ` Richard Stallman
2021-09-09  6:52                       ` Eli Zaretskii
2021-09-09  7:43                   ` Gregory Heytings
2021-09-09 11:44                     ` Gregory Heytings
2021-09-09 12:07                       ` Lars Ingebrigtsen
2021-09-09 12:12                         ` Gregory Heytings
2021-09-09 12:15                           ` Lars Ingebrigtsen
2021-09-09 12:40                             ` Gregory Heytings
2021-09-09 12:47                               ` Lars Ingebrigtsen
2021-09-09 13:04                                 ` Gregory Heytings
2021-09-09 13:10                                   ` Lars Ingebrigtsen
2021-09-09 14:27                                     ` Gregory Heytings
2021-09-10 10:15                                       ` Lars Ingebrigtsen
2021-09-10 14:26                                         ` Gregory Heytings
2021-09-12  8:23                                           ` Gregory Heytings
2021-09-12  8:57                                             ` Eli Zaretskii
2021-09-12  9:30                                               ` Gregory Heytings
2021-09-12  9:37                                                 ` Eli Zaretskii
2021-09-12  9:54                                                   ` Gregory Heytings
2021-09-12 10:11                                                     ` Eli Zaretskii
2021-09-12 10:21                                                       ` Eli Zaretskii
2021-09-12 21:26                                                       ` Gregory Heytings
2021-09-12 22:11                                                         ` Gregory Heytings
2021-09-13  7:04                                                         ` Lars Ingebrigtsen
2021-09-13  9:11                                                           ` Gregory Heytings
2021-09-13  9:18                                                             ` Lars Ingebrigtsen
2021-09-13 13:00                                                               ` Gregory Heytings
2021-09-13 13:56                                                                 ` Eli Zaretskii
2021-09-13 12:17                                                             ` Eli Zaretskii
2021-09-13 11:31                                                         ` Eli Zaretskii
2021-09-13  8:03                                                       ` martin rudalics
2021-09-13  9:14                                                         ` Gregory Heytings
2021-09-13 12:36                                                           ` martin rudalics
2021-09-13 12:52                                                             ` Gregory Heytings
2021-09-15  9:27                                                               ` martin rudalics
2021-09-15 10:00                                                                 ` Gregory Heytings
2021-09-15 20:13                                                                 ` Richard Stallman
2021-09-16  6:56                                                                   ` martin rudalics
2021-09-18  0:30                                                                     ` Richard Stallman
2021-09-18  7:34                                                                       ` martin rudalics
2021-09-18  9:20                                                                       ` Gregory Heytings
2021-09-13  1:17                                           ` Richard Stallman
2021-09-10  3:41                               ` Richard Stallman
2021-09-10 13:49                                 ` Gregory Heytings
2021-09-13  1:17                                   ` Richard Stallman
2021-09-02 17:08           ` Drew Adams [this message]
2021-09-05  3:42             ` bug#21695: [External] : " Richard Stallman
2021-09-04  3:38           ` Richard Stallman
2021-09-01 12:48       ` Augusto Stoffel
2021-09-02  3:38         ` Richard Stallman
2021-09-02  6:56           ` Eli Zaretskii
2021-09-02 17:07           ` bug#21695: [External] : " Drew Adams

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488B07306EBA9F4432BDFB6F3CE9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=21695@debbugs.gnu.org \
    --cc=hmelman@gmail.com \
    --cc=rms@gnu.org \
    /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 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).