From da2e6da72296ed6211b8047ccdc42fccab6f1b31 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 17 Sep 2022 20:11:42 +0200 Subject: Tag themes with properties * doc/emacs/custom.texi (Custom Themes): Document 'theme-choose-variant'. * doc/lispref/customize.texi (Custom Themes): Document the new optional argument to 'deftheme'. (Autoload): Mention that 'deftheme' is not copied verbatim. * etc/themes/adwaita-theme.el (adwaita): Add properties. * etc/themes/deeper-blue-theme.el (deeper-blue): Add properties. * etc/themes/dichromacy-theme.el (dichromacy): Add properties. * etc/themes/light-blue-theme.el (light-blue): Add properties. * etc/themes/manoj-dark-theme.el (manoj-dark): Add properties. * etc/themes/misterioso-theme.el (misterioso): Add properties. * etc/themes/tango-dark-theme.el (tango-dark): Add properties. * etc/themes/tango-theme.el (tango): Add properties. * etc/themes/tsdh-dark-theme.el (tsdh-dark): Add properties. * etc/themes/tsdh-light-theme.el (tsdh-light): Add properties. * etc/themes/wheatgrass-theme.el (wheatgrass): Add properties. * etc/themes/whiteboard-theme.el (whiteboard): Add properties. * etc/themes/wombat-theme.el (wombat): Add properties. * etc/themes/modus-operandi-theme.el: Add properties. * etc/themes/modus-vivendi-theme.el: Add properties. * etc/themes/leuven-dark-theme.el (leuven-dark): Add properties. * etc/themes/leuven-theme.el (leuven): Add properties. * lisp/custom.el (deftheme): Allow for optional arguments to set the property list. (custom-declare-theme): Accept the same optional arguments as 'deftheme'. (theme-list-variants): Add new function. (theme-choose-variant): Add new command for switching between members of a theme family. (toggle-theme): Add an alias for 'theme-choose-variant'. * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload): Handle 'defcustom's by extracting the properties. (Bug#57639) --- lisp/emacs-lisp/loaddefs-gen.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 964d23c770e..d2654fb2064 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -283,6 +283,12 @@ expression, in which case we want to handle forms differently." ,@(when-let ((safe (plist-get props :safe))) `((put ',varname 'safe-local-variable ,safe)))))) + ;; Extract theme properties. + ((eq car 'deftheme) + (let* ((name (car-safe (cdr-safe form))) + (props (nthcdr 3 form))) + `(put ',name 'theme-properties (list ,@props)))) + ((eq car 'defgroup) ;; In Emacs this is normally handled separately by cus-dep.el, but for ;; third party packages, it can be convenient to explicitly autoload -- cgit v1.2.3 From 5fc064f14c0e76bf15b7528ef6ef3771ad169aba Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 13 Oct 2022 10:43:36 +0200 Subject: Handle ;;;###theme-autoload comments in etc/themes * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--emacs-batch): Extract the autoloads and have them loaded along with loaddefs.el. * etc/NEWS: Mention the new feature. (Bug#57639) --- etc/NEWS | 5 +++++ lisp/emacs-lisp/loaddefs-gen.el | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/etc/NEWS b/etc/NEWS index 62004c10a6c..041fe0bdbd8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2846,6 +2846,11 @@ Previously, ';;;###' specs inside a top-level form (i.e., something like '(when ... ;;;### ...)' would be ignored. They are now parsed as normal. +--- +** Themes have special autoload cookies. +All build-in themes are scraped for ;;;###theme-autoload cookies that +are loaded along with the regular auto-loaded code. + +++ ** 'buffer-modified-p' has been extended. This function was previously documented to return only nil or t. This diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index d2654fb2064..a1c4f91579e 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -736,7 +736,14 @@ rules for built-in packages and excluded files." ;; updated. (file-newer-than-file-p (expand-file-name "emacs-lisp/loaddefs-gen.el" lisp-directory) - output-file)))) + output-file))) + (let ((lisp-mode-autoload-regexp + "^;;;###\\(\\(noexist\\)-\\)?\\(theme-autoload\\)")) + (loaddefs-generate + (expand-file-name "../etc/themes/" lisp-directory) + (expand-file-name "theme-loaddefs.el" lisp-directory)))) + +;;;###autoload (load "theme-loaddefs.el") (provide 'loaddefs-gen) -- cgit v1.2.3 From 86581698acc1a0991592e018c1ba749f3ded21be Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 18 Oct 2022 13:14:08 +0200 Subject: Fix faulty loaddefs detection * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--emacs-batch): Fix faulty loaddefs detection. --- lisp/emacs-lisp/loaddefs-gen.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index a1c4f91579e..a76bcf604f7 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -738,7 +738,8 @@ rules for built-in packages and excluded files." (expand-file-name "emacs-lisp/loaddefs-gen.el" lisp-directory) output-file))) (let ((lisp-mode-autoload-regexp - "^;;;###\\(\\(noexist\\)-\\)?\\(theme-autoload\\)")) + ;; Avoid autoloads detection from loaddefs-gen. + (concat "^;;;###\\(\\(noexist\\)-\\)?\\(theme" "-autoload\\)"))) (loaddefs-generate (expand-file-name "../etc/themes/" lisp-directory) (expand-file-name "theme-loaddefs.el" lisp-directory)))) -- cgit v1.2.3 From 6cabef8799eb053c593f0a5241503ccbfb616c8a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 18 Oct 2022 13:17:52 +0200 Subject: Fix previous loaddefs-gen fix --- lisp/emacs-lisp/loaddefs-gen.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index a76bcf604f7..ecc5f7e47bd 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -738,13 +738,12 @@ rules for built-in packages and excluded files." (expand-file-name "emacs-lisp/loaddefs-gen.el" lisp-directory) output-file))) (let ((lisp-mode-autoload-regexp - ;; Avoid autoloads detection from loaddefs-gen. - (concat "^;;;###\\(\\(noexist\\)-\\)?\\(theme" "-autoload\\)"))) + "^;;;###\\(\\(noexist\\)-\\)?\\(theme-autoload\\)")) (loaddefs-generate (expand-file-name "../etc/themes/" lisp-directory) (expand-file-name "theme-loaddefs.el" lisp-directory)))) -;;;###autoload (load "theme-loaddefs.el") +;;;###autoload (load "theme-loaddefs.el" t) (provide 'loaddefs-gen) -- cgit v1.2.3