Subject: bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme

From: Mauro Aranda <[email-masked]>
Date: Tue, 29 Jun 2021 21:03:09 -0300

Christopher League <[email-masked]> writes:

> On 2021-06-29 18:38, Mauro Aranda wrote:

>>> *Implementation details:* we had to move the chunk marked "Load the
>>> theme settings" earlier in the function `customize-create-theme`. Then
>>> the `custom-theme-description` widget was made an `editable-field`
>>> whose value comes from `theme-documentation` if available, else
>>> `format-time-string`. The rest of the patch is reindentation due to
>>> the larger scope of the let that holds the theme settings.
>> 
>> Why change the widget from a text widget to an editable-field
>> widget? I think a text widget is better here, since a docstring usually
>> would have more than one line, and the editable-field keymap remaps RET
>> while the text keymap doesn't.
>
> Interesting. I'm not that familiar with the widget types, but the reason 
> I
> chose 'editable-field is because 'text seems to *duplicate* the content,
> which is much more annoying for a multi-line doc string than a short 
> name.
> I'll attach a screen-shot -- this is the effect when it's
> (widget-create 'text ...). [Or maybe this is a widget bug? I'm using git
> master from earlier today.]

That's because there was a change to the :format property of the text
widget, but this call wasn't updated.  Try overriding it like this:
(widget-create 'text :format "%v" ...)

> If there's a fix for duplicating the string with a text widget, I'll be
> happy with it! Thanks.

The above should make it work.  Please try it, thank you.