Skip to content

Commit

Permalink
add after-load-theme-hook
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SequentialDesign committed Dec 10, 2024
1 parent 49d2f62 commit b283472
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/color-theme.lisp
Original file line number Diff line number Diff line change
@@ -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 ()
Expand Down Expand Up @@ -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))))
Expand Down
1 change: 1 addition & 0 deletions src/internal-packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@
(:export
:color-theme-names
:define-color-theme
:*after-load-theme-hook*
:load-theme
:current-theme
:find-color-theme
Expand Down

0 comments on commit b283472

Please sign in to comment.