GNU bug report logs -
#57639
[PATCH] Add new command 'toggle-theme'
Previous Next
Reported by: Philip Kaludercic <philipk <at> posteo.net>
Date: Wed, 7 Sep 2022 07:20:01 UTC
Severity: wishlist
Tags: patch
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
Full log
Message #312 received at 57639 <at> debbugs.gnu.org (full text, mbox):
>>>> 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
This bug report was last modified 2 years and 215 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.