Subject: Re: bug#15214: 24.3.50; `Revert This Session's Customization' does not do what it says

From: Eli Zaretskii <[email-masked]>
Date: Tue, 31 Dec 2019 18:26:50 +0200

> From: Mauro Aranda <[email-masked]>
> Date: Mon, 30 Dec 2019 18:30:31 -0300
> 
> > Click State and Revert This Session's Customization.

You should instead click "Set to Backup Value".  The Revert button is
in general for variables you have saved for future sessions.

> The function that runs for that option is custom-variable-reset-saved,
> and the doc string of custom-variable-reset-saved says something similar.

The doc string is ambiguous, and the code definitely does NOT intend
to reset the value, just to remove the recorded setting, so that it
won't be saved in the custom file.  That code was installed in
response to a very similar bug report (bug#9509, except that it
complained that Emacs signals an error for a variable that was never
saved).  I very much doubt that Chong, who made that change, omitted
setting the value by mistake.

In general, there's a feature creep here: this menu item was
originally only for customized options that were saved during this
session.  That was lifted back then, and now we want also to change
the value, although another menu item exists to do just that.

> The attached patch fixes custom-variable-reset-saved to do what it says
> it does when the variable has no previous saved value.

I won't object too much to such a change, if you still think it's TRT
here after reading the above, but I wonder whether it would be cleaner
and safer to set just the value, and move the funcall out of the
if-else form, so that we'd have only one funcall, and it will be
inside ignore-errors.

> -	;; If there is no saved value, remove the setting.
> -	(custom-push-theme 'theme-value symbol 'user 'reset)
> +        (progn
> +	  ;; If there is no saved value, remove the setting.

The comment needs to be updated, since we now don't merely remove the
setting.

Thanks.