GNU bug report logs -
#64046
30.0.50; Quoting in customize choice tags
Previous Next
Reported by: Stephen Berman <stephen.berman <at> gmx.net>
Date: Tue, 13 Jun 2023 14:04:02 UTC
Severity: normal
Found in version 30.0.50
Done: Stephen Berman <stephen.berman <at> gmx.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Mon, 21 Aug 2023 11:51:36 -0300 Mauro Aranda <maurooaranda <at> gmail.com> wrote:
> Ola x Nilsson <ola.x.nilsson <at> 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:
[Message part 2 (text/x-patch, inline)]
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)
[Message part 3 (text/plain, inline)]
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:
[Message part 4 (text/x-patch, inline)]
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))
[Message part 5 (text/plain, inline)]
I don't see any obvious problem with this, but I'm not sure.
Steve Berman
This bug report was last modified 1 year and 312 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.