From 8d00eda9289cd161f22d9bebcd7122e94c660726 Mon Sep 17 00:00:00 2001 From: opfez Date: Sun, 18 Jul 2021 01:45:37 +0200 Subject: [PATCH] abstract theme switching --- custom.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/custom.el b/custom.el index a956ec9..bd10fc6 100644 --- a/custom.el +++ b/custom.el @@ -191,14 +191,15 @@ (global-set-key (kbd "M-z") 'zap-up-to-char) ;; Binds for switching between light and dark themes. -(global-set-key [f5] (lambda () - (interactive) - (disable-theme 'basic) - (load-theme 'magik))) -(global-set-key [f6] (lambda () - (interactive) - (disable-theme 'magik) - (load-theme 'basic))) +(defmacro fez/switch-theme (new-theme) + `(lambda () + (interactive) + (disable-theme (car custom-enabled-themes)) + (enable-theme ,new-theme))) + +(global-set-key [f5] (fez/switch-theme 'magik)) +(global-set-key [f6] (fez/switch-theme 'basic)) + (add-hook 'emacs-lisp-mode-hook (lambda () (local-set-key (kbd "C-c k") #'fez/insert-keybind)))