all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher League <league@contrapunctus.net>
To: Mauro Aranda <maurooaranda@gmail.com>
Cc: 49274@debbugs.gnu.org
Subject: bug#49274: [PATCH] lisp/cus-theme: retain documentation string when customizing theme
Date: Wed, 30 Jun 2021 11:05:28 -0400	[thread overview]
Message-ID: <875yxvl7ev.fsf@contrapunctus.net> (raw)
In-Reply-To: <87y2ar78bq.fsf@tbb.theblackbeard.org>


[-- 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


  reply	other threads:[~2021-06-30 15:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yxvl7ev.fsf@contrapunctus.net \
    --to=league@contrapunctus.net \
    --cc=49274@debbugs.gnu.org \
    --cc=maurooaranda@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.