emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/meow 5af4798489: Add advice `meow--prepare-face` to `enabl


From: ELPA Syncer
Subject: [nongnu] elpa/meow 5af4798489: Add advice `meow--prepare-face` to `enable-theme` instead of `load-theme` (#488)
Date: Mon, 31 Jul 2023 22:00:16 -0400 (EDT)

branch: elpa/meow
commit 5af47984895fb7b9a5a65a8d919ba62680a975da
Author: HardGraphite <64914256+HardGraphite@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Add advice `meow--prepare-face` to `enable-theme` instead of `load-theme` 
(#488)
    
    * Add advice `meow--prepare-face` to `enable-theme` instead of `load-theme`
    
    Add advice `meow--prepare-face` to function `enable-theme` instead of
    `load-theme`. This will help prepare faces if a theme is enabled with
    `enable-theme`. The modification does not change the current behavior,
    because `enable-theme` is called at the end of `load-theme`, and calling
    `load-theme` also triggers advice on `enable-theme`.
    
    * Use a wrapper of `meow--prepare-face` as an advice to `enable-theme`
    
    Adding advice `meow--prepare-face` to `enable-theme` instead of `load-theme`
    (commit 64bdbee) causes `meow--prepare-face` being called twice when a theme
    is enabled. This commit uses a wrapper of `meow--prepare-face` as the
    advice. The wrapper calls `meow--prepare-face` only when the theme to
    enable is `user`.
---
 meow-core.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/meow-core.el b/meow-core.el
index d783d2b69c..6b2384d42e 100644
--- a/meow-core.el
+++ b/meow-core.el
@@ -160,6 +160,11 @@ there's no chance for meow to call an init function."
   (when (secondary-selection-exist-p)
     (meow--cancel-second-selection)))
 
+(defun meow--enable-theme-advice (theme)
+  "Prepare face if the theme to enable is `user'."
+  (when (eq theme 'user)
+    (meow--prepare-face)))
+
 (defun meow--global-enable ()
   "Enable meow globally."
   (setq-default meow-normal-mode t)
@@ -190,7 +195,7 @@ there's no chance for meow to call an init function."
     (setq redisplay-highlight-region-function 
#'meow--redisplay-highlight-region-function)
     (setq redisplay-unhighlight-region-function 
#'meow--redisplay-unhighlight-region-function))
   (meow--prepare-face)
-  (advice-add 'load-theme :after 'meow--prepare-face))
+  (advice-add 'enable-theme :after 'meow--enable-theme-advice))
 
 (defun meow--global-disable ()
   "Disable Meow globally."
@@ -210,7 +215,7 @@ there's no chance for meow to call an init function."
     (setq redisplay-unhighlight-region-function 
meow--backup-redisplay-unhighlight-region-function))
   (unless window-system
     (meow-esc-mode -1))
-  (advice-remove 'load-theme 'meow--prepare-face))
+  (advice-remove 'enable-theme 'meow--enable-theme-advice))
 
 (provide 'meow-core)
 ;;; meow-core.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]