unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: 60712@debbugs.gnu.org
Cc: "Omar Antolín Camarena" <omar.antolin@gmail.com>
Subject: bug#60712: 28.2; customize-set-variable won't let you change the type of a choice
Date: Sun, 16 Jul 2023 10:27:39 -0300	[thread overview]
Message-ID: <7daa5402-fb93-c6ba-dbd0-829eb1c4caa4@gmail.com> (raw)
In-Reply-To: <8d7ea0a1-0847-3643-fa8e-7bfe1e066706@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

Mauro Aranda <maurooaranda@gmail.com> writes:

 > We have this condition in widget-choice-prompt-value:
 > ((and (= (length args) 2)
 >       (memq old args))
 >  (if (eq old (nth 0 args))
 >      (nth 1 args)
 >    (nth 0 args)))
 >
 > ARGS holds the choices available in the choice widget and OLD has
 > the choice that matches the current value of the choice widget, before
 > the user enters a new one.  This branch has been in the code since like
 > forever, but I can't explain why it's good to have it.

So, we should respect the value of widget-choice-toggle also when
prompting, of course.  I attach a patch to fix it.

[-- Attachment #2: 0001-Don-t-always-toggle-a-choice-when-prompting.patch --]
[-- Type: text/x-patch, Size: 837 bytes --]

From 1c96c56d62d9535d50fab66bb7b917bd56e823a3 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sun, 16 Jul 2023 09:22:11 -0300
Subject: [PATCH] Don't always toggle a choice when prompting

* lisp/wid-edit.el (widget-choice-prompt-value): Respect the value
of widget-choice-toggle.  (Bug#60712)
---
 lisp/wid-edit.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 234f3d9b74d..96dff69e2df 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3985,7 +3985,8 @@ widget-choice-prompt-value
 		 nil)
 		((= (length args) 1)
 		 (nth 0 args))
-		((and (= (length args) 2)
+                ((and widget-choice-toggle
+                      (= (length args) 2)
 		      (memq old args))
 		 (if (eq old (nth 0 args))
 		     (nth 1 args)
-- 
2.34.1


  reply	other threads:[~2023-07-16 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 17:35 bug#60712: 28.2; customize-set-variable won't let you change the type of a choice Omar Antolín Camarena
2023-07-16 12:18 ` Mauro Aranda
2023-07-16 13:27   ` Mauro Aranda [this message]
2023-07-22 12:59     ` Eli Zaretskii

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=7daa5402-fb93-c6ba-dbd0-829eb1c4caa4@gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=60712@debbugs.gnu.org \
    --cc=omar.antolin@gmail.com \
    /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).