From 5fc064f14c0e76bf15b7528ef6ef3771ad169aba Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 13 Oct 2022 10:43:36 +0200 Subject: [PATCH] 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(-) 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) -- 2.39.5