From 1cdb14ca0ec453d918683d9bdccd7dbe4c6d55e9 Mon Sep 17 00:00:00 2001 From: David Florness Date: Fri, 14 Jun 2024 12:05:32 -0400 Subject: [PATCH] add functions for switching themes and disabling all enabled themes --- lisp/themes.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lisp/themes.el b/lisp/themes.el index 469eecb..e395345 100644 --- a/lisp/themes.el +++ b/lisp/themes.el @@ -26,3 +26,23 @@ (load-theme 'doom-one t t) (load-theme 'doom-one-light t t) (load-theme 'doom-vibrant t t)) + +(defun switch-theme (theme) + ;; The (interactive ...) and subsequent (unless ...) code was copied from the + ;; enable-theme function in custom.el.gz + (interactive (list (intern + (completing-read + "Switch to custom theme: " + obarray (lambda (sym) (get sym 'theme-settings)) t)))) + (unless (custom-theme-p theme) + (error "Undefined Custom theme %s" theme)) + ;; end of copied code + + (disable-current-themes) + (enable-theme theme)) + +(defun disable-current-themes () + "disabled all currently-enabled themes" + (interactive) + (dolist (thm custom-enabled-themes) + (disable-theme thm))) -- 2.38.4