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
On Thu, Aug 24 2023, Mauro Aranda wrote:
> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> On Thu, 24 Aug 2023 17:14:53 -0300 Mauro Aranda
> <maurooaranda <at> gmail.com> wrote:
>>
>>> Stephen Berman <stephen.berman <at> gmx.net> writes:
>>>
>>>> Right after sending, I found an obvious problem: only one of the car or
>>>> the cdr might be a string. The following patch accounts for this:
>>>>
>>>> diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
>>>> index a70598bb6c9..891e98b6de5 100644
>>>> --- a/lisp/wid-edit.el
>>>> +++ b/lisp/wid-edit.el
>>>> @@ -285,12 +285,18 @@ 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 (consp x)
>>>> + (when (stringp (car x))
>>>> + (setcar x (substitute-command-keys
> (car x))))
>>>> + (when (stringp (cdr x))
>>>> + (setcdr x (substitute-command-keys (cdr
>>> x)))))))
>>>
>>> Thinking about it, why do we need to call substitute-command-keys on the
>>> VALUE part (i.e., the cdr of the cons cell), in case of simple item
>>> definitions?
>>>
>>> I re-read the bug report, but I didn't find any reference to why that is
>>> a need. Did I miss something?
>>
>> Well, the VALUE is displayed on entering a choice. That is, when I do
>>
>> M-: (widget-choose "Title" '(("Use `a'" . "Use `1'") ("Use `b'"
> . "Use `2'")))
>>
>> I see curve-quoting in the widget-choose buffer:
>>
>> Available choices:
>>
>> 0 = Use ‘a’
>> 1 = Use ‘b’
>>
>> C-g = Quit
>>
>> and when I enter e.g. `0' at the "Title: " prompt in the minibuffer, it
>> displays "Use ‘1’", i.e., with curve-quoting. But if I omit the call to
>> substitute-command-keys on the cdr in widget-choose, then typing `0' at
>> the "Title: " prompt displays "Use `1'", i.e. with grave-quoting. But I
>> don't know which one is the intended result.
>
> I see, thank you. Your last patch looks good to me, then.
The cdr is the return value, I would expect widget-choose to not
modify that.
--
Ola x Nilsson
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.