Subject: Re: bug#76664: 31.0.50; behavior of widget-put implemented in Lisp changed compared to C

From: Stefan Kangas <[email-masked]>
Date: Sat, 1 Mar 2025 17:21:03 -0800

Version: 30.1

David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <[email-masked]> writes:

> Since this commit:
>
>        author	Stefan Kangas <[email-masked]>	
>        Fri, 28 Feb 2025 18:28:58 +0100 (18:28 +0100)
>        commit	8b659313b83c82cfe09af1638289fccdfc9af23d
>
>        Lift widget functions from C to Lisp
>
> I encounter errors in widgets because the behavior of the Lisp
> implementation of `widget-put' changed compared to the C version.
>
> Specifically the C version used to return the passed value, which
> is no more the case of the Lisp version.
>
> This trivial patch fixed the issue for me:

Thanks, I pushed the below change to master in your name.  I also
separately added a unit test for this.

I'm therefore closing this bug report.

> diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
> index d6fd1156123..ff6550e852f 100644
> --- a/lisp/wid-edit.el
> +++ b/lisp/wid-edit.el
> @@ -625,7 +625,8 @@ widgetp
>   (defun widget-put (widget property value)
>     "In WIDGET, set PROPERTY to VALUE.
>   The value can later be retrieved with `widget-get'."
> -  (setcdr widget (plist-put (cdr widget) property value)))
> +  (setcdr widget (plist-put (cdr widget) property value))
> +  value)
>
>   ;;;###autoload
>   (defun widget-get (widget property)