Subject: Re: bug#65468: 29.1; describe-theme fails to describe some themes not loaded

From: Mauro Aranda <[email-masked]>
Date: Thu, 24 Aug 2023 07:16:10 -0300

Eli Zaretskii <[email-masked]> writes:

 >> Cc: [email-masked]
 >> Date: Wed, 23 Aug 2023 06:53:03 -0300
 >> From: Mauro Aranda <[email-masked]>
 >>
 >> Thierry Volpiatto <[email-masked]> writes:
 >>
 >>  > This because `describe-theme-1` is not looping in buffer to find
 >>  > `deftheme` definition.
 >>
 >> It is a convention that the first form should be a call to deftheme.
 >> But it seems built-in themes have deviated from that convention.  And
 >> other themes might as well, I don't know.
 >>
 >>  >
 >>  > Try (describe-theme 'leuven) to reproduce (if not already loaded of
 >> course).
 >>  >
 >>
 >> At least for the leuven themes, it should be easy to make them follow
 >> the convention.
 >
 > I think we should indeed fix the themes that come with Emacs.

Here's a patch for the leuven themes.  And I'm CCing Prot so he can take
a look to adjust the modus-themes.

From ab417284f27d172cc95f4c735f28bdfd6366817b Mon Sep 17 00:00:00 2001
From: Mauro Aranda <[email-masked]>
Date: Thu, 24 Aug 2023 07:12:41 -0300
Subject: [PATCH] Adjust built-in themes to convention (Bug#65468)

* etc/themes/leuven-dark-theme.el
* etc/themes/leuven-theme.el: Make the deftheme call the first form.
---
 etc/themes/leuven-dark-theme.el | 20 ++++++++++----------
 etc/themes/leuven-theme.el      | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/etc/themes/leuven-dark-theme.el b/etc/themes/leuven-dark-theme.el
index 33a15945e71..a2445896ea6 100644
--- a/etc/themes/leuven-dark-theme.el
+++ b/etc/themes/leuven-dark-theme.el
@@ -39,6 +39,16 @@
 
 ;;; Code:
 
+;;;###theme-autoload
+(deftheme leuven-dark
+  "Face colors with a dark background.
+Basic, Font Lock, Isearch, Gnus, Message, Org mode, Diff, Ediff,
+Flyspell, Semantic, and Ansi-Color faces are included -- and much
+more..."
+  :background-mode 'dark
+  :family 'leuven
+  :kind 'color-scheme)
+
 ;;; Options.
 
 (defgroup leuven-dark nil
@@ -93,16 +103,6 @@ leuven-dark-scale-font
 
 ;;; Theme Faces.
 
-;;;###theme-autoload
-(deftheme leuven-dark
-  "Face colors with a dark background.
-Basic, Font Lock, Isearch, Gnus, Message, Org mode, Diff, Ediff,
-Flyspell, Semantic, and Ansi-Color faces are included -- and much
-more..."
-  :background-mode 'dark
-  :family 'leuven
-  :kind 'color-scheme)
-
 (let ((class '((class color) (min-colors 89)))
 
       ;; Leuven generic colors.
diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el
index f7d454381d7..3d8d0d49b36 100644
--- a/etc/themes/leuven-theme.el
+++ b/etc/themes/leuven-theme.el
@@ -38,6 +38,16 @@
 
 ;;; Code:
 
+;;;###theme-autoload
+(deftheme leuven
+  "Face colors with a light background.
+Basic, Font Lock, Isearch, Gnus, Message, Org mode, Diff, Ediff,
+Flyspell, Semantic, and Ansi-Color faces are included -- and much
+more..."
+  :background-mode 'light
+  :kind 'color-scheme
+  :family 'leuven)
+
 ;;; Options.
 
 (defgroup leuven nil
@@ -74,16 +84,6 @@ leuven-scale-font
 
 ;;; Theme Faces.
 
-;;;###theme-autoload
-(deftheme leuven
-  "Face colors with a light background.
-Basic, Font Lock, Isearch, Gnus, Message, Org mode, Diff, Ediff,
-Flyspell, Semantic, and Ansi-Color faces are included -- and much
-more..."
-  :background-mode 'light
-  :kind 'color-scheme
-  :family 'leuven)
-
 (let ((class '((class color) (min-colors 89)))
 
       ;; Leuven generic colors.
-- 
2.34.1