From b283472855be6a83ebf05a44b9b969949909dc9e Mon Sep 17 00:00:00 2001
From: Daniel Alejandro Tapia <sequential.design.dat@gmail.com>
Date: Tue, 10 Dec 2024 02:47:47 -0500
Subject: [PATCH] add `after-load-theme-hook`

add `after-load-theme-hook` so that users may add functions that should run after a theme is loaded.  this could be useful in some cases.  in my specific case, it's to to maintain the color of the point since it is always very hard to see when the point is on an overlay like in search.
---
 src/color-theme.lisp       | 7 ++++++-
 src/internal-packages.lisp | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/color-theme.lisp b/src/color-theme.lisp
index f7e498a0c..f79c97181 100644
--- a/src/color-theme.lisp
+++ b/src/color-theme.lisp
@@ -1,5 +1,9 @@
 (in-package :lem-core)
 
+(defvar *after-load-theme-hook* '()
+  "For functions that should run after a theme is loaded,
+for example, to maintain an attribute like CURSOR.")
+
 (defvar *current-theme* nil)
 
 (defun current-theme ()
@@ -96,7 +100,8 @@
     (redraw-display :force t)
     (setf (current-theme) name)
     (when save-theme
-      (setf (config :color-theme) (current-theme)))))
+      (setf (config :color-theme) (current-theme))))
+  (run-hooks *after-load-theme-hook*))
 
 (defun get-color-theme-color (color-theme key)
   (second (assoc key (color-theme-specs color-theme))))
diff --git a/src/internal-packages.lisp b/src/internal-packages.lisp
index 9a460655f..a15c6975b 100644
--- a/src/internal-packages.lisp
+++ b/src/internal-packages.lisp
@@ -622,6 +622,7 @@
   (:export
    :color-theme-names
    :define-color-theme
+   :*after-load-theme-hook*
    :load-theme
    :current-theme
    :find-color-theme