unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
@ 2021-06-29 14:44 Christopher League
  2021-06-29 22:38 ` Mauro Aranda
  0 siblings, 1 reply; 12+ messages in thread
From: Christopher League @ 2021-06-29 14:44 UTC (permalink / raw)
  To: 49274; +Cc: Christopher League

When editing an existing theme using `custom-theme-visit-theme`, the
theme's documentation string would always be discarded and replaced
with "Created DATE."

With this improvement, the existing theme documentation string (if
available) will be presented and editable in the widget, and emitted
in the `deftheme` declaration when saved. A newly-created theme or an
existing theme with no documentation string will get the "Created
DATE" as before.

*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.

*Steps to reproduce the issue:*

```
% emacs -Q
M-x custom-theme-visit-theme RET tango RET
```

*Result before this patch:* In the Custom Theme buffer, the
Description field has the text `Created 2021-06-29.` followed by the
editable widget containing the same string a second time.

*Result after this patch:* The Description field has the text "Face
colors using the Tango palette (light background) ..." -- the
documentation string provided to `deftheme` in
`etc/themes/tango-theme.el`.
---
 lisp/cus-theme.el | 100 +++++++++++++++++++++++-----------------------
 1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index dfa2226403..3741f286e9 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -108,60 +108,16 @@ named *Custom Theme*."
     (unless (y-or-n-p "Include basic face customizations in this theme? ")
       (setq custom-theme--listed-faces nil)))
 
-  (if (eq theme 'user)
-      (widget-insert "This buffer contains all the Custom settings you have made.
-You can convert them into a new custom theme, and optionally
-remove them from your saved Custom file.\n\n"))
-
-  (widget-create 'push-button
-		 :tag " Visit Theme "
-		 :help-echo "Insert the settings of a pre-defined theme."
-		 :action (lambda (_widget &optional _event)
-                           (call-interactively #'custom-theme-visit-theme)))
-  (widget-insert "  ")
-  (widget-create 'push-button
-		 :tag " Merge Theme "
-		 :help-echo "Merge in the settings of a pre-defined theme."
-		 :action (lambda (_widget &optional _event)
-                           (call-interactively #'custom-theme-merge-theme)))
-  (widget-insert "  ")
-  (widget-create 'push-button
-		 :tag " Revert "
-		 :help-echo "Revert this buffer to its original state."
-		 :action (lambda (&rest ignored) (revert-buffer)))
-
-  (widget-insert "\n\nTheme name : ")
-  (setq custom-theme-name
-	(widget-create 'editable-field
-		       :value (if (and theme (not (eq theme 'user)))
-				  (symbol-name theme)
-				"")))
-  (widget-insert "Description: ")
-  (setq custom-theme-description
-	(widget-create 'text
-		       :value (format-time-string "Created %Y-%m-%d.")))
-  (widget-create 'push-button
-                 :notify #'custom-theme-write
-     		 " Save Theme ")
-  (when (eq theme 'user)
-    (setq custom-theme--migrate-settings t)
-    (widget-insert "  ")
-    (widget-create 'checkbox
-		   :value custom-theme--migrate-settings
-		   :action (lambda (widget &optional event)
-			     (when (widget-value widget)
-			       (widget-toggle-action widget event)
-			       (setq custom-theme--migrate-settings
-				     (widget-value widget)))))
-    (widget-insert (propertize " Remove saved theme settings from Custom save file."
-			       'face '(variable-pitch (:height 0.9)))))
-
   (let (vars values faces face-specs)
 
     ;; Load the theme settings.
     (when theme
-      (unless (eq theme 'user)
-	(load-theme theme nil t))
+      (if (eq theme 'user)
+          (widget-insert "This buffer contains all the Custom settings you have made.
+You can convert them into a new custom theme, and optionally
+remove them from your saved Custom file.\n\n")
+        (load-theme theme nil t))
+
       (dolist (setting (get theme 'theme-settings))
 	(if (eq (car setting) 'theme-value)
 	    (progn (push (nth 1 setting) vars)
@@ -169,6 +125,50 @@ remove them from your saved Custom file.\n\n"))
 	  (push (nth 1 setting) faces)
 	  (push (nth 3 setting) face-specs))))
 
+    (widget-create 'push-button
+		   :tag " Visit Theme "
+		   :help-echo "Insert the settings of a pre-defined theme."
+		   :action (lambda (_widget &optional _event)
+                             (call-interactively #'custom-theme-visit-theme)))
+    (widget-insert "  ")
+    (widget-create 'push-button
+		   :tag " Merge Theme "
+		   :help-echo "Merge in the settings of a pre-defined theme."
+		   :action (lambda (_widget &optional _event)
+                             (call-interactively #'custom-theme-merge-theme)))
+    (widget-insert "  ")
+    (widget-create 'push-button
+		   :tag " Revert "
+		   :help-echo "Revert this buffer to its original state."
+		   :action (lambda (&rest ignored) (revert-buffer)))
+
+    (widget-insert "\n\nTheme name : ")
+    (setq custom-theme-name
+	  (widget-create 'editable-field
+		         :value (if (and theme (not (eq theme 'user)))
+				    (symbol-name theme)
+				  "")))
+    (widget-insert "Description: ")
+    (setq custom-theme-description
+	  (widget-create 'editable-field
+		         :value (or (get theme 'theme-documentation)
+				    (format-time-string "Created %Y-%m-%d."))))
+    (widget-create 'push-button
+                   :notify #'custom-theme-write
+     		   " Save Theme ")
+    (when (eq theme 'user)
+      (setq custom-theme--migrate-settings t)
+      (widget-insert "  ")
+      (widget-create 'checkbox
+		     :value custom-theme--migrate-settings
+		     :action (lambda (widget &optional event)
+			       (when (widget-value widget)
+			         (widget-toggle-action widget event)
+			         (setq custom-theme--migrate-settings
+				       (widget-value widget)))))
+      (widget-insert (propertize " Remove saved theme settings from Custom save file."
+			         'face '(variable-pitch (:height 0.9)))))
+
     ;; If THEME is non-nil, insert all of that theme's faces.
     ;; Otherwise, insert those in `custom-theme--listed-faces'.
     (widget-insert "\n\n  Theme faces:\n ")
-- 
2.31.1






^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-29 14:44 bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme Christopher League
@ 2021-06-29 22:38 ` Mauro Aranda
  2021-06-29 23:54   ` Christopher League
  0 siblings, 1 reply; 12+ messages in thread
From: Mauro Aranda @ 2021-06-29 22:38 UTC (permalink / raw)
  To: Christopher League; +Cc: 49274

Hello Christopher,

Christopher League <league@contrapunctus.net> writes:

> When editing an existing theme using `custom-theme-visit-theme`, the
> theme's documentation string would always be discarded and replaced
> with "Created DATE."
>
> With this improvement, the existing theme documentation string (if
> available) will be presented and editable in the widget, and emitted
> in the `deftheme` declaration when saved. A newly-created theme or an
> existing theme with no documentation string will get the "Created
> DATE" as before.

I think this is a good change.

> *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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-29 22:38 ` Mauro Aranda
@ 2021-06-29 23:54   ` Christopher League
  2021-06-30  0:03     ` Mauro Aranda
  0 siblings, 1 reply; 12+ messages in thread
From: Christopher League @ 2021-06-29 23:54 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 49274

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]

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

> I think this is a good change.

Thanks!

>> *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.]

When it's 'editable-field as in my patch, you are correct that RET 
leaves
the field, but C-j or M-j will insert a newline, and M-q actually seems 
to
work too (though it doesn't preserve the first line of the doc string 
like
it would in a doc string in elisp mode).

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

-- 
CL

[-- Attachment #2: 2021-06-29_19-43.png --]
[-- Type: image/png, Size: 64278 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-29 23:54   ` Christopher League
@ 2021-06-30  0:03     ` Mauro Aranda
  2021-06-30  1:57       ` Christopher League
  0 siblings, 1 reply; 12+ messages in thread
From: Mauro Aranda @ 2021-06-30  0:03 UTC (permalink / raw)
  To: Christopher League; +Cc: 49274

Christopher League <league@contrapunctus.net> 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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-30  0:03     ` Mauro Aranda
@ 2021-06-30  1:57       ` Christopher League
  2021-06-30 14:09         ` Mauro Aranda
  0 siblings, 1 reply; 12+ messages in thread
From: Christopher League @ 2021-06-30  1:57 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 49274

On 2021-06-29 20:03, Mauro Aranda wrote:
> 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" ...)
> 
> The above should make it work.  Please try it, thank you.

Yes, that works. I'm including an updated patch below. Thanks. CL


 From 390ed4d6adf83e66b2f1d78637c071babbe62029 Mon Sep 17 00:00:00 2001
 From: Christopher League <league@contrapunctus.net>
Date: Mon, 28 Jun 2021 22:41:07 -0400
Subject: [PATCH] lisp/cus-theme: retain documentation string when 
customizing
  theme

When editing an existing theme using `custom-theme-visit-theme`, the
theme's documentation string would always be discarded and replaced
with "Created DATE."

With this improvement, the existing theme documentation string (if
available) will be presented and editable in the widget, and emitted
in the `deftheme` declaration when saved. A newly-created theme or an
existing theme with no documentation string will get the "Created
DATE" as before.

*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.

*Steps to reproduce the issue:*

```
% emacs -Q
M-x custom-theme-visit-theme RET tango RET
```

*Result before this patch:* In the Custom Theme buffer, the
Description field has the text `Created 2021-06-29.` followed by the
editable widget containing the same string a second time.

*Result after this patch:* The Description field has the text "Face
colors using the Tango palette (light background) ..." -- the
documentation string provided to `deftheme` in
`etc/themes/tango-theme.el`.
---
  lisp/cus-theme.el | 100 +++++++++++++++++++++++-----------------------
  1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index dfa2226403..3741f286e9 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -108,60 +108,16 @@ named *Custom Theme*."
      (unless (y-or-n-p "Include basic face customizations in this theme? 
")
        (setq custom-theme--listed-faces nil)))

-  (if (eq theme 'user)
-      (widget-insert "This buffer contains all the Custom settings you 
have made.
-You can convert them into a new custom theme, and optionally
-remove them from your saved Custom file.\n\n"))
-
-  (widget-create 'push-button
-		 :tag " Visit Theme "
-		 :help-echo "Insert the settings of a pre-defined theme."
-		 :action (lambda (_widget &optional _event)
-                           (call-interactively 
#'custom-theme-visit-theme)))
-  (widget-insert "  ")
-  (widget-create 'push-button
-		 :tag " Merge Theme "
-		 :help-echo "Merge in the settings of a pre-defined theme."
-		 :action (lambda (_widget &optional _event)
-                           (call-interactively 
#'custom-theme-merge-theme)))
-  (widget-insert "  ")
-  (widget-create 'push-button
-		 :tag " Revert "
-		 :help-echo "Revert this buffer to its original state."
-		 :action (lambda (&rest ignored) (revert-buffer)))
-
-  (widget-insert "\n\nTheme name : ")
-  (setq custom-theme-name
-	(widget-create 'editable-field
-		       :value (if (and theme (not (eq theme 'user)))
-				  (symbol-name theme)
-				"")))
-  (widget-insert "Description: ")
-  (setq custom-theme-description
-	(widget-create 'text
-		       :value (format-time-string "Created %Y-%m-%d.")))
-  (widget-create 'push-button
-                 :notify #'custom-theme-write
-     		 " Save Theme ")
-  (when (eq theme 'user)
-    (setq custom-theme--migrate-settings t)
-    (widget-insert "  ")
-    (widget-create 'checkbox
-		   :value custom-theme--migrate-settings
-		   :action (lambda (widget &optional event)
-			     (when (widget-value widget)
-			       (widget-toggle-action widget event)
-			       (setq custom-theme--migrate-settings
-				     (widget-value widget)))))
-    (widget-insert (propertize " Remove saved theme settings from 
Custom save file."
-			       'face '(variable-pitch (:height 0.9)))))
-
    (let (vars values faces face-specs)

      ;; Load the theme settings.
      (when theme
-      (unless (eq theme 'user)
-	(load-theme theme nil t))
+      (if (eq theme 'user)
+          (widget-insert "This buffer contains all the Custom settings 
you have made.
+You can convert them into a new custom theme, and optionally
+remove them from your saved Custom file.\n\n")
+        (load-theme theme nil t))
+
        (dolist (setting (get theme 'theme-settings))
  	(if (eq (car setting) 'theme-value)
  	    (progn (push (nth 1 setting) vars)
@@ -169,6 +125,50 @@ remove them from your saved Custom file.\n\n"))
  	  (push (nth 1 setting) faces)
  	  (push (nth 3 setting) face-specs))))

+    (widget-create 'push-button
+		   :tag " Visit Theme "
+		   :help-echo "Insert the settings of a pre-defined theme."
+		   :action (lambda (_widget &optional _event)
+                             (call-interactively 
#'custom-theme-visit-theme)))
+    (widget-insert "  ")
+    (widget-create 'push-button
+		   :tag " Merge Theme "
+		   :help-echo "Merge in the settings of a pre-defined theme."
+		   :action (lambda (_widget &optional _event)
+                             (call-interactively 
#'custom-theme-merge-theme)))
+    (widget-insert "  ")
+    (widget-create 'push-button
+		   :tag " Revert "
+		   :help-echo "Revert this buffer to its original state."
+		   :action (lambda (&rest ignored) (revert-buffer)))
+
+    (widget-insert "\n\nTheme name : ")
+    (setq custom-theme-name
+	  (widget-create 'editable-field
+		         :value (if (and theme (not (eq theme 'user)))
+				    (symbol-name theme)
+				  "")))
+    (widget-insert "Description: ")
+    (setq custom-theme-description
+	  (widget-create 'editable-field
+		         :value (or (get theme 'theme-documentation)
+				    (format-time-string "Created %Y-%m-%d."))))
+    (widget-create 'push-button
+                   :notify #'custom-theme-write
+     		   " Save Theme ")
+    (when (eq theme 'user)
+      (setq custom-theme--migrate-settings t)
+      (widget-insert "  ")
+      (widget-create 'checkbox
+		     :value custom-theme--migrate-settings
+		     :action (lambda (widget &optional event)
+			       (when (widget-value widget)
+			         (widget-toggle-action widget event)
+			         (setq custom-theme--migrate-settings
+				       (widget-value widget)))))
+      (widget-insert (propertize " Remove saved theme settings from 
Custom save file."
+			         'face '(variable-pitch (:height 0.9)))))
+
      ;; If THEME is non-nil, insert all of that theme's faces.
      ;; Otherwise, insert those in `custom-theme--listed-faces'.
      (widget-insert "\n\n  Theme faces:\n ")
-- 
2.31.1





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-30  1:57       ` Christopher League
@ 2021-06-30 14:09         ` Mauro Aranda
  2021-06-30 15:05           ` Christopher League
  0 siblings, 1 reply; 12+ messages in thread
From: Mauro Aranda @ 2021-06-30 14:09 UTC (permalink / raw)
  To: Christopher League; +Cc: 49274

Christopher League <league@contrapunctus.net> writes:

> On 2021-06-29 20:03, Mauro Aranda wrote:
>> 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" ...)
>> 
>> The above should make it work.  Please try it, thank you.
>
> Yes, that works. I'm including an updated patch below. Thanks. CL
>

[...]

> +    (widget-insert "Description: ")
> +    (setq custom-theme-description
> +	  (widget-create 'editable-field
> +		         :value (or (get theme 'theme-documentation)
> +				    (format-time-string "Created %Y-%m-%d."))))

Did you send the old one by mistake?

Also, please format the commit message according to the Emacs
conventions: see the file CONTRIBUTE and the "Commit messages" section
in particular.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-30 14:09         ` Mauro Aranda
@ 2021-06-30 15:05           ` Christopher League
  2021-07-03 13:23             ` Mauro Aranda
  0 siblings, 1 reply; 12+ messages in thread
From: Christopher League @ 2021-06-30 15:05 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 49274


[-- Attachment #1.1: Type: text/plain, Size: 352 bytes --]

Mauro Aranda <maurooaranda@gmail.com> writes:

> Did you send the old one by mistake?
>
> Also, please format the commit message according to the Emacs
> conventions: see the file CONTRIBUTE and the "Commit messages" section
> in particular.

Oops yes, sorry for the noise. Attached patch should be better -- LMK if
it needs anything else. Thanks, CL


[-- Attachment #1.2: Type: text/html, Size: 519 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Retain-documentation-string-when-customizing-theme.patch --]
[-- Type: text/x-patch, Size: 5423 bytes --]

From f303471a775ab7d622c4d572b40c51a00860f8e8 Mon Sep 17 00:00:00 2001
From: Christopher League <league@contrapunctus.net>
Date: Mon, 28 Jun 2021 22:41:07 -0400
Subject: [PATCH] Retain documentation string when customizing theme

* lisp/cus-theme.el (customize-create-theme): When editing an existing
theme, load its doc string into the description widget, instead of
replacing it with a date stamp (Bug#49274).
---
 lisp/cus-theme.el | 100 +++++++++++++++++++++++-----------------------
 1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index dfa2226403..91e4ea1a1a 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -108,60 +108,16 @@ named *Custom Theme*."
     (unless (y-or-n-p "Include basic face customizations in this theme? ")
       (setq custom-theme--listed-faces nil)))
 
-  (if (eq theme 'user)
-      (widget-insert "This buffer contains all the Custom settings you have made.
-You can convert them into a new custom theme, and optionally
-remove them from your saved Custom file.\n\n"))
-
-  (widget-create 'push-button
-		 :tag " Visit Theme "
-		 :help-echo "Insert the settings of a pre-defined theme."
-		 :action (lambda (_widget &optional _event)
-                           (call-interactively #'custom-theme-visit-theme)))
-  (widget-insert "  ")
-  (widget-create 'push-button
-		 :tag " Merge Theme "
-		 :help-echo "Merge in the settings of a pre-defined theme."
-		 :action (lambda (_widget &optional _event)
-                           (call-interactively #'custom-theme-merge-theme)))
-  (widget-insert "  ")
-  (widget-create 'push-button
-		 :tag " Revert "
-		 :help-echo "Revert this buffer to its original state."
-		 :action (lambda (&rest ignored) (revert-buffer)))
-
-  (widget-insert "\n\nTheme name : ")
-  (setq custom-theme-name
-	(widget-create 'editable-field
-		       :value (if (and theme (not (eq theme 'user)))
-				  (symbol-name theme)
-				"")))
-  (widget-insert "Description: ")
-  (setq custom-theme-description
-	(widget-create 'text
-		       :value (format-time-string "Created %Y-%m-%d.")))
-  (widget-create 'push-button
-                 :notify #'custom-theme-write
-     		 " Save Theme ")
-  (when (eq theme 'user)
-    (setq custom-theme--migrate-settings t)
-    (widget-insert "  ")
-    (widget-create 'checkbox
-		   :value custom-theme--migrate-settings
-		   :action (lambda (widget &optional event)
-			     (when (widget-value widget)
-			       (widget-toggle-action widget event)
-			       (setq custom-theme--migrate-settings
-				     (widget-value widget)))))
-    (widget-insert (propertize " Remove saved theme settings from Custom save file."
-			       'face '(variable-pitch (:height 0.9)))))
-
   (let (vars values faces face-specs)
 
     ;; Load the theme settings.
     (when theme
-      (unless (eq theme 'user)
-	(load-theme theme nil t))
+      (if (eq theme 'user)
+          (widget-insert "This buffer contains all the Custom settings you have made.
+You can convert them into a new custom theme, and optionally
+remove them from your saved Custom file.\n\n")
+        (load-theme theme nil t))
+
       (dolist (setting (get theme 'theme-settings))
 	(if (eq (car setting) 'theme-value)
 	    (progn (push (nth 1 setting) vars)
@@ -169,6 +125,50 @@ remove them from your saved Custom file.\n\n"))
 	  (push (nth 1 setting) faces)
 	  (push (nth 3 setting) face-specs))))
 
+    (widget-create 'push-button
+		   :tag " Visit Theme "
+		   :help-echo "Insert the settings of a pre-defined theme."
+		   :action (lambda (_widget &optional _event)
+                             (call-interactively #'custom-theme-visit-theme)))
+    (widget-insert "  ")
+    (widget-create 'push-button
+		   :tag " Merge Theme "
+		   :help-echo "Merge in the settings of a pre-defined theme."
+		   :action (lambda (_widget &optional _event)
+                             (call-interactively #'custom-theme-merge-theme)))
+    (widget-insert "  ")
+    (widget-create 'push-button
+		   :tag " Revert "
+		   :help-echo "Revert this buffer to its original state."
+		   :action (lambda (&rest ignored) (revert-buffer)))
+
+    (widget-insert "\n\nTheme name : ")
+    (setq custom-theme-name
+	  (widget-create 'editable-field
+		         :value (if (and theme (not (eq theme 'user)))
+				    (symbol-name theme)
+				  "")))
+    (widget-insert "Description: ")
+    (setq custom-theme-description
+	  (widget-create 'text :format "%v"
+			 :value (or (get theme 'theme-documentation)
+				    (format-time-string "Created %Y-%m-%d."))))
+    (widget-create 'push-button
+                   :notify #'custom-theme-write
+     		   " Save Theme ")
+    (when (eq theme 'user)
+      (setq custom-theme--migrate-settings t)
+      (widget-insert "  ")
+      (widget-create 'checkbox
+		     :value custom-theme--migrate-settings
+		     :action (lambda (widget &optional event)
+			       (when (widget-value widget)
+			         (widget-toggle-action widget event)
+			         (setq custom-theme--migrate-settings
+				       (widget-value widget)))))
+      (widget-insert (propertize " Remove saved theme settings from Custom save file."
+			         'face '(variable-pitch (:height 0.9)))))
+
     ;; If THEME is non-nil, insert all of that theme's faces.
     ;; Otherwise, insert those in `custom-theme--listed-faces'.
     (widget-insert "\n\n  Theme faces:\n ")
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-06-30 15:05           ` Christopher League
@ 2021-07-03 13:23             ` Mauro Aranda
  2021-07-03 13:30               ` Lars Ingebrigtsen
  2021-07-03 13:35               ` Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Mauro Aranda @ 2021-07-03 13:23 UTC (permalink / raw)
  To: Christopher League; +Cc: 49274

Christopher League <league@contrapunctus.net> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes: 
>
>  Did you send the old one by mistake? Also, please format the commit message
>  according to the Emacs conventions: see the file CONTRIBUTE and the “Commit
>  messages” section in particular. 
>
> Oops yes, sorry for the noise. Attached patch should be better – LMK if it needs anything
> else. Thanks, CL 

Thanks, the patch looks good to me.


I'd like to install it, but I'm not sure what are the steps in this
case, regarding the copyright assignment.  It doesn't look like a tiny
change, but its mostly indentation: the actual lines changed are 4.

In this case, should I just add a "Copyright-paperwork-exempt: yes"
line? Could someone please confirm, or install the change? Thanks.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-07-03 13:23             ` Mauro Aranda
@ 2021-07-03 13:30               ` Lars Ingebrigtsen
  2021-07-03 13:52                 ` Mauro Aranda
  2021-07-03 13:35               ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-03 13:30 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Christopher League, 49274

Mauro Aranda <maurooaranda@gmail.com> writes:

> I'd like to install it, but I'm not sure what are the steps in this
> case, regarding the copyright assignment.  It doesn't look like a tiny
> change, but its mostly indentation: the actual lines changed are 4.
>
> In this case, should I just add a "Copyright-paperwork-exempt: yes"
> line?

Yup; indentation changes don't "count" when computing how many lines a
patch is.

However, Christopher has assigned copyright to the FSF, so the patch is
fine to install in any case.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-07-03 13:23             ` Mauro Aranda
  2021-07-03 13:30               ` Lars Ingebrigtsen
@ 2021-07-03 13:35               ` Eli Zaretskii
  2021-07-03 13:55                 ` Mauro Aranda
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2021-07-03 13:35 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: league, 49274

> From: Mauro Aranda <maurooaranda@gmail.com>
> Date: Sat, 03 Jul 2021 10:23:25 -0300
> Cc: 49274@debbugs.gnu.org
> 
> I'd like to install it, but I'm not sure what are the steps in this
> case, regarding the copyright assignment.  It doesn't look like a tiny
> change, but its mostly indentation: the actual lines changed are 4.
> 
> In this case, should I just add a "Copyright-paperwork-exempt: yes"
> line?

Yes, that would have been enough.  However, Christopher has copyright
assignment on file, so you don't need to add that.  Just install the
changes under his name as the author.

Thanks.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-07-03 13:30               ` Lars Ingebrigtsen
@ 2021-07-03 13:52                 ` Mauro Aranda
  0 siblings, 0 replies; 12+ messages in thread
From: Mauro Aranda @ 2021-07-03 13:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: league, 49274

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> I'd like to install it, but I'm not sure what are the steps in this
>> case, regarding the copyright assignment.  It doesn't look like a tiny
>> change, but its mostly indentation: the actual lines changed are 4.
>>
>> In this case, should I just add a "Copyright-paperwork-exempt: yes"
>> line?
>
> Yup; indentation changes don't "count" when computing how many lines a
> patch is.

Thank you Lars, I'll keep that in mind for next time.

> However, Christopher has assigned copyright to the FSF, so the patch is
> fine to install in any case.

And thanks for checking that.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
  2021-07-03 13:35               ` Eli Zaretskii
@ 2021-07-03 13:55                 ` Mauro Aranda
  0 siblings, 0 replies; 12+ messages in thread
From: Mauro Aranda @ 2021-07-03 13:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: league, 49274

tags 49274 fixed
close 49274 28.1
quit


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Mauro Aranda <maurooaranda@gmail.com>
>> Date: Sat, 03 Jul 2021 10:23:25 -0300
>> Cc: 49274@debbugs.gnu.org
>> 
>> I'd like to install it, but I'm not sure what are the steps in this
>> case, regarding the copyright assignment.  It doesn't look like a tiny
>> change, but its mostly indentation: the actual lines changed are 4.
>> 
>> In this case, should I just add a "Copyright-paperwork-exempt: yes"
>> line?
>
> Yes, that would have been enough.  However, Christopher has copyright
> assignment on file, so you don't need to add that.  Just install the
> changes under his name as the author.

Thanks Eli.  I installed the change, and I'm closing this bug report.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-07-03 13:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-29 14:44 bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme Christopher League
2021-06-29 22:38 ` Mauro Aranda
2021-06-29 23:54   ` Christopher League
2021-06-30  0:03     ` Mauro Aranda
2021-06-30  1:57       ` Christopher League
2021-06-30 14:09         ` Mauro Aranda
2021-06-30 15:05           ` Christopher League
2021-07-03 13:23             ` Mauro Aranda
2021-07-03 13:30               ` Lars Ingebrigtsen
2021-07-03 13:52                 ` Mauro Aranda
2021-07-03 13:35               ` Eli Zaretskii
2021-07-03 13:55                 ` Mauro Aranda

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).