unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 43593@debbugs.gnu.org
Subject: bug#43593: 27.1; `customize-set-variable': wrong prompt for Boolean value
Date: Thu, 24 Sep 2020 10:09:57 -0700 (PDT)	[thread overview]
Message-ID: <8c3c3f0f-c6ed-4883-b815-1f729879f0d3@default> (raw)

This bug exists since at least Emacs 22.

emacs -Q

(defcustom bar nil
  "@@@"
  :type 'boolean :group 'convenience)

M-x customize-set-variable bar
Set variable: bar

The prompt for the Boolean value is this:

[boolean] Set customized value for bar to: (y or n)

Set it to WHAT?

It turns out that `y' sets the value to `t' and `n' sets the value to
`nil'.  But there's no way of knowing that.

The fault is with function `custom-prompt-variable', or more precisely,
with `widget-prompt-value', and then with `widget-boolean-prompt-value'.
It's the latter that calls `y-or-n-p'.

The value returned by `y-or-n-p' is t or nil, which is OK.  But the
prompt and the expected inputs are wrong.

Even if the prompt said "[boolean] Set customized value for bar to `t':
(y or n)" it would be inadequate, because it suggests that if you reply
`n' then the variable value remains unchanged.  `y-or-n-p' is just wrong
here.

The comment for `widget-boolean-prompt-value' says that it toggles.  But
it does NOT toggle.  And `customize-set-variable' should NOT just toggle
the current value anyway.  It should always prompt you for the new
value, which may or may not be already the current value.  The command
needs to be consistent.

Maybe the `boolean' widget should be changed to use `widge-prompt-value,
not `widget-boolean-prompt-value' or something?  That it inherits from
the `toggle' widget is fine - that's for the Toggle button in the
Customize UI.  But `customize-set-variable' needs a better prompt
(better behavior).

In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-12 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.18362
System Description: Microsoft Windows 10 Pro (v10.0.1903.18362.1082)





             reply	other threads:[~2020-09-24 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 17:09 Drew Adams [this message]
2020-09-24 17:26 ` bug#43593: 27.1; `customize-set-variable': wrong prompt for Boolean value Eli Zaretskii
     [not found] <<8c3c3f0f-c6ed-4883-b815-1f729879f0d3@default>
     [not found] ` <<83d02bt7ah.fsf@gnu.org>
2020-09-24 18:14   ` Drew Adams
2021-06-06 11:22     ` Lars Ingebrigtsen
2021-06-06 15:17       ` bug#43593: [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=8c3c3f0f-c6ed-4883-b815-1f729879f0d3@default \
    --to=drew.adams@oracle.com \
    --cc=43593@debbugs.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).