Subject: Re: bug#72341: VC: CVS template lines not stripped when committing

From: Sean Whitton <[email-masked]>
Date: Wed, 05 Mar 2025 19:53:34 +0800

Hello,

Christoph, would you mind testing Mauro's patch here?

I'm keen not to let your valuable feedback on the customize UX, and
Mauro's fix, get lost in this VC bug.

Eli, did you have any feedback on Mauro's patch?

On Sat 15 Feb 2025 at 09:47am -03, Mauro Aranda wrote:

> Mauro Aranda <[email-masked]> writes:
>
>> Eli Zaretskii <[email-masked]> writes:
>>
>>>> Date: Tue, 28 Jan 2025 23:47:56 +0100
>>>> From: Christoph Badura <[email-masked]>
>>>>
>>>> On Tue, Jan 28, 2025 at 02:23:39PM +0200, Eli Zaretskii wrote:
>>>> > The Customize UI will be more helpful if we explicitly mention the
>>>> > recommended values together with descriptive tags.
>>>>
>>>> So, I've just tested this:
>>>>   emacs -nw --eval "(customize-group 'log-edit)"
>>>>
>>>> Search for "done hook".
>>>> Be sure to toggle the "More" button and than the "Show value" button on
>>>> the line for "Log Edit Done Hook".
>>>> With this patch applied there's even a "More" button at the end of the
>>>> one-line description of the log-edit-done-strip-cvs-lines option.
>>>>
>>>> Do you really think that UX needs improving?
>>>>
>>>> The only thing that annoys me is that when I search for "More", the
>>    point
>>>> ends up just behind the button and RET doesn't toggle it.  Whereas
>>    it does
>>>> when it is right before a button.  Fixing that would be a huge
>>    improvement
>>>> for me.  But this is a separate issue.
>>>>
>>>> > But I realize that this is a separate issue, so maybe it should be the
>>>> > subject of a separate patch.  So maybe just mentioning the 3
>>>> > recommended values in the doc string will be enough for fixing this
>>>> > issue.
>>>>
>>>> I've made a note in any case.
>>>>
>>>> I've way overrun my "emacs hacking" time budget for this week.  I'll get
>>>> back to this bug at the end of next week after returning from travel.
>>>
>>> Mauro, WDYT about this?
>>
>> I guess you're asking me about actioning the "More" button when point is
>> past it, to show the rest of the documentation.
>>
>> There's already code that handles custom group links that way, in
>> Custom-newline (RET is bound to that command).  For example:
>> emacs -Q
>> M-x customize-group RET vc
>> C-s Log-Edit RET
>> RET
>>
>> Emacs follows the link even though point is past the link.
>>
>> It should be easy to extend it to other links/buttons.
>
> Like in the attached patch, lightly tested.  I can post it in a
> different bug report if desired.
>
> From e83562f8050118319f701fa45970a721afc44b36 Mon Sep 17 00:00:00 2001
> From: Mauro Aranda <[email-masked]>
> Date: Sat, 15 Feb 2025 09:43:58 -0300
> Subject: [PATCH] Action button when point is just after it
>
> * lisp/cus-edit.el (Custom-newline): If no button at point,
> check for a button before point.  (Bug#72341)
> ---
>  lisp/cus-edit.el | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
> index febbc8d1b8b..1fd87c4e9f3 100644
> --- a/lisp/cus-edit.el
> +++ b/lisp/cus-edit.el
> @@ -5344,10 +5344,13 @@ Custom-newline
>  To see what function the widget will call, use the
>  `widget-describe' command."
>    (interactive "@d")
> -  (let ((button (get-char-property pos 'button)))
> -    ;; If there is no button at point, then use the one at the start
> -    ;; of the line, if it is a custom-group-link (bug#2298).
> +  (let ((button (or (get-char-property pos 'button)
> +                    ;; Maybe we are just past a button, and it's quite handy
> +                    ;; to action it as well.  (Bug#72341)
> +                    (get-char-property (1- pos) 'button))))
>      (or button
> +        ;; If there is no button at point, then use the one at the start
> +        ;; of the line, if it is a custom-group-link (bug#2298).
>  	(if (setq button (get-char-property (line-beginning-position) 'button))
>  	    (or (eq (widget-type button) 'custom-group-link)
>  		(setq button nil))))

-- 
Sean Whitton