From: Stephen Berman <stephen.berman@gmx.net>
To: Mauro Aranda <maurooaranda@gmail.com>
Cc: Ola x Nilsson <ola.x.nilsson@axis.com>, 64046@debbugs.gnu.org
Subject: bug#64046: 30.0.50; Quoting in customize choice tags
Date: Thu, 24 Aug 2023 14:51:39 +0200 [thread overview]
Message-ID: <87fs48ppr8.fsf@gmx.net> (raw)
In-Reply-To: <27a78233-5758-c03e-e3a2-342d194d1448@gmail.com> (Mauro Aranda's message of "Mon, 21 Aug 2023 11:51:36 -0300")
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
On Mon, 21 Aug 2023 11:51:36 -0300 Mauro Aranda <maurooaranda@gmail.com> wrote:
> Ola x Nilsson <ola.x.nilsson@axis.com> writes:
[...]
>> I think I ran into another problem with the change.
>> Using the simple item definitions (described in the docstring), this
>> call
>>
>> (widget-choose "Title" '(("Option1" . "Foo") ("Option 2" . "Bar")))
>>
>> will fail with
>>
>> (wrong-type-argument (listp "Foo"))
>
> Thanks for reporting this.
>
>> Or did I misunderstand how that mode works?
>
> I think your recipe should work, and it worked before.
>
> Hopefully Stephen can take a look at it.
Thanks for reporting this regression. The following patch, which tests
for proper-list-p instead of consp, fixes the above case and still
applies substitute-command-keys correctly in the other cases brought up
in this bug:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: widget-choose patch #1 --]
[-- Type: text/x-patch, Size: 579 bytes --]
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index a70598bb6c9..6b4446a0be8 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -285,7 +285,7 @@ widget-choose
;; Apply quote substitution to customize choice menu item text,
;; whether it occurs in a widget buffer or in a popup menu.
(let ((items (mapc (lambda (x)
- (when (consp x)
+ (when (proper-list-p x)
(dotimes (i (1- (length x)))
(when (stringp (nth i x))
(setcar (nthcdr i x)
[-- Attachment #3: Type: text/plain, Size: 328 bytes --]
However, if the car and cdr of the simple items are strings containing
grave-style quoting, e.g. as in the following:
(widget-choose "Title" '(("Use `a'" . "Use `a'") ("Use `b'" . "Use `b'")))
and this quoting is supposed to appear on evaluation as curve-style,
then something like the following patch seems to be required:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: widget-choose patch #2 --]
[-- Type: text/x-patch, Size: 1450 bytes --]
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index a70598bb6c9..40d7b5b902c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -285,12 +285,17 @@ widget-choose
;; Apply quote substitution to customize choice menu item text,
;; whether it occurs in a widget buffer or in a popup menu.
(let ((items (mapc (lambda (x)
- (when (consp x)
- (dotimes (i (1- (length x)))
- (when (stringp (nth i x))
- (setcar (nthcdr i x)
- (substitute-command-keys
- (car (nthcdr i x))))))))
+ (if (proper-list-p x)
+ (dotimes (i (1- (length x)))
+ (when (stringp (nth i x))
+ (setcar (nthcdr i x)
+ (substitute-command-keys
+ (car (nthcdr i x))))))
+ ;; ITEMS has simple item definitions.
+ (when (and (consp x) (stringp (car x))
+ (stringp (cdr x)))
+ (setcar x (substitute-command-keys (car x)))
+ (setcdr x (substitute-command-keys (cdr x))))))
items)))
(cond ((and (< (length items) widget-menu-max-size)
event (display-popup-menus-p))
[-- Attachment #5: Type: text/plain, Size: 76 bytes --]
I don't see any obvious problem with this, but I'm not sure.
Steve Berman
next prev parent reply other threads:[~2023-08-24 12:51 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 14:02 bug#64046: 30.0.50; Quoting in customize choice tags Stephen Berman
2023-06-13 15:56 ` Eli Zaretskii
2023-06-14 19:51 ` Mauro Aranda
2023-06-14 20:05 ` Mauro Aranda
2023-06-15 11:39 ` Stephen Berman
2023-06-22 20:07 ` Stephen Berman
2023-06-22 22:59 ` Mauro Aranda
2023-06-23 22:18 ` Stephen Berman
2023-06-24 6:37 ` Eli Zaretskii
2023-06-24 8:50 ` Stephen Berman
2023-07-15 13:20 ` Mauro Aranda
2023-07-20 15:48 ` Stephen Berman
2023-07-20 19:11 ` Mauro Aranda
2023-07-20 19:53 ` Stephen Berman
2023-08-21 12:04 ` Ola x Nilsson
2023-08-21 14:51 ` Mauro Aranda
2023-08-24 12:51 ` Stephen Berman [this message]
2023-08-24 13:19 ` Stephen Berman
2023-08-24 20:14 ` Mauro Aranda
2023-08-24 20:54 ` Stephen Berman
2023-08-24 21:58 ` Mauro Aranda
2023-08-25 8:02 ` Ola x Nilsson
2023-08-25 21:50 ` Stephen Berman
2023-08-28 9:33 ` Ola x Nilsson
2023-08-28 13:50 ` Stephen Berman
2023-08-30 15:29 ` Mauro Aranda
2023-08-30 16:29 ` Stephen Berman
2023-08-30 22:33 ` Mauro Aranda
2023-08-30 22:51 ` Stephen Berman
2023-08-30 22:58 ` Mauro Aranda
2023-08-31 5:41 ` Eli Zaretskii
2023-08-31 6:43 ` Stefan Kangas
2023-08-31 15:43 ` Drew Adams
2023-08-31 20:52 ` Stefan Kangas
2023-08-31 22:10 ` Drew Adams
2023-08-31 22:59 ` Stefan Kangas
2023-09-01 1:08 ` Drew Adams
2023-09-01 6:34 ` Eli Zaretskii
2023-09-01 16:17 ` Drew Adams
2023-09-01 23:29 ` Stephen Berman
2023-09-01 23:38 ` Stefan Kangas
2023-09-02 9:49 ` Stephen Berman
2023-09-02 18:59 ` Stefan Kangas
2023-09-02 21:25 ` Stephen Berman
2023-09-02 2:12 ` Drew Adams
2023-09-01 6:16 ` Eli Zaretskii
2023-09-01 16:32 ` Drew Adams
2023-08-24 20:53 ` Stefan Kangas
2023-08-24 21:10 ` Stephen Berman
2023-08-24 21:14 ` Stefan Kangas
2023-08-24 21:41 ` Stephen Berman
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=87fs48ppr8.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--cc=64046@debbugs.gnu.org \
--cc=maurooaranda@gmail.com \
--cc=ola.x.nilsson@axis.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).