[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57639: [PATCH] Add new command 'toggle-theme'
From: |
Stefan Monnier |
Subject: |
bug#57639: [PATCH] Add new command 'toggle-theme' |
Date: |
Thu, 20 Oct 2022 13:04:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>>> We could arrange for `autoload/loaddefs-gen` to recognize `deftheme` and
>>>> add the directory containing the file containing this `deftheme` to the
>>>> `custom-theme-load-path`.
>>> If this is possible I think this would be a nice idea.
>> It should be easy to do.
> Sadly I am stumped on how this could be done, as I have little
> experience with the bootstrapping process. Could you give me a few pointers?
I was thinking of something like the patch below.
Stefan
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index ecc5f7e47bd..a07d0e9ad61 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -286,8 +286,16 @@ loaddefs-generate--make-autoload
;; Extract theme properties.
((eq car 'deftheme)
(let* ((name (car-safe (cdr-safe form)))
- (props (nthcdr 3 form)))
- `(put ',name 'theme-properties (list ,@props))))
+ (props (nthcdr 3 form))
+ (dir (file-name-directory file)))
+ `(progn
+ (add-to-list 'custom-theme-load-path
+ ,(if dir
+ `(expand-file-name ,dir
+ (file-name-directory
+ (macroexp-file-name)))
+ `(file-name-directory (macroexp-file-name))))
+ (put ',name 'theme-properties (list ,@props)))))
((eq car 'defgroup)
;; In Emacs this is normally handled separately by cus-dep.el, but for
- bug#57639: [PATCH] Add new command 'toggle-theme', (continued)
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Eli Zaretskii, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Stefan Kangas, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Stefan Monnier, 2022/10/18
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/19
- bug#57639: [PATCH] Add new command 'toggle-theme', Stefan Monnier, 2022/10/19
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/20
- bug#57639: [PATCH] Add new command 'toggle-theme',
Stefan Monnier <=
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/20
- bug#57639: [PATCH] Add new command 'toggle-theme', Stefan Monnier, 2022/10/20
- bug#57639: [PATCH] Add new command 'toggle-theme', Stefan Monnier, 2022/10/18
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/19
- bug#57639: [PATCH] Add new command 'toggle-theme', Eli Zaretskii, 2022/10/19
- bug#57639: [PATCH] Add new command 'toggle-theme', Stefan Monnier, 2022/10/19
- bug#57639: [PATCH] Add new command 'toggle-theme', Lars Ingebrigtsen, 2022/10/13
- bug#57639: [PATCH] Add new command 'toggle-theme', Philip Kaludercic, 2022/10/13
bug#57639: [PATCH] Add new command 'toggle-theme', Mauro Aranda, 2022/10/13