From ecbeeee3b596123755ebb2d2b4bc0399b086ccbf Mon Sep 17 00:00:00 2001 From: grtcdr Date: Fri, 5 Jan 2024 15:01:53 +0100 Subject: [PATCH] Define a hook to run functions when the mode is changed Fixes: #2 --- darkman.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/darkman.el b/darkman.el index 490a1cb..762d368 100644 --- a/darkman.el +++ b/darkman.el @@ -39,6 +39,11 @@ :group 'convenience :prefix "darkman-") +(defcustom darkman-after-mode-changed-hook nil + "Hook run after the mode is changed." + :type 'hook + :group 'darkman) + (defcustom darkman-themes '(:light modus-operandi :dark modus-vivendi) "A property list which maps modes to their corresponding themes. @@ -142,7 +147,8 @@ MODE is the new mode." (unless darkman-switch-themes-silently (message "Darkman switched to %s mode, switching to %s theme." mode theme)) - (darkman--load-theme theme)))) + (darkman--load-theme theme) + (run-hooks 'darkman-after-mode-changed-hook)))) (defun darkman--check-dbus-service () "Return non-nil if ‘darkman--dbus-service’ is available." -- 2.45.2