Subject: Re: bug#44331: 28.0.50; Customize won't save a face setting, if not set first

From: Mauro Aranda <[email-masked]>
Date: Fri, 30 Oct 2020 14:43:29 -0300

Sending a better patch, that cleans up the :shown-value property after
using it.
From 4a2764c73663bc2d0c6a8a0fcbea55b85aaa9a7e Mon Sep 17 00:00:00 2001
From: Mauro Aranda <[email-masked]>
Date: Fri, 30 Oct 2020 13:05:08 -0300
Subject: [PATCH] Fix saving a face setting with Customize

* lisp/cus-edit.el (custom-face-save): Make sure we back up into the
:shown-value property what the user has edited so far, if we are going
to recreate the custom-face widget.  (Bug#44331)
---
 lisp/cus-edit.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 769a69a50f..3eef446839 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -3931,7 +3931,12 @@ custom-face-save
         (custom-face-mark-to-save widget)
       ;; The user is working on only a selected terminal type;
       ;; make sure we save the entire spec to `custom-file'. (Bug #40866)
+      ;; If recreating a widget that may have been edited by the user, remember
+      ;; to always save the edited value into the :shown-value property, so
+      ;; we use that value for the recreated widget.  (Bug#44331)
+      (widget-put widget :shown-value (custom-face-widget-to-spec widget))
       (custom-face-edit-all widget)
+      (widget-put widget :shown-value nil) ; Reset it after we used it.
       (custom-face-mark-to-save widget)
       (if (eq form 'selected)
           (custom-face-edit-selected widget)
-- 
2.29.0