Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当切换主题后, sis-default-cursor-color 应当更新. #78

Open
unifreak opened this issue Apr 5, 2024 · 1 comment
Open

当切换主题后, sis-default-cursor-color 应当更新. #78

unifreak opened this issue Apr 5, 2024 · 1 comment

Comments

@unifreak
Copy link

unifreak commented Apr 5, 2024

现在的 sis-default-cursor-color 在第一次从当前主题拿到值后, 就定下来不会变了. 如果此时切换到另一个主题 (比如从亮色主题切到了暗色主题), 旧的光标颜色, 大概率是很难在新主题中有比较好的显示效果的.

Emacs 没有内置的主题切换相关的 hook, 我现在是通过下面的方式, 绕过了这个问题:

;; taken from:
;; https://www.gnu.org/software/emacs/manual/html_node/modus-themes/A-theme_002dagnostic-hook-for-theme-loading.html
;; (sis need this to reset default cursor color after theme change)
(defvar after-enable-theme-hook nil
   "Normal hook run after enabling a theme.")

(defun run-after-enable-theme-hook (&rest _args)
   "Run `after-enable-theme-hook'."
   (run-hooks 'after-enable-theme-hook))

(advice-add 'enable-theme :after #'run-after-enable-theme-hook)

;; input method
(use-package sis
  :config
  (defun reset-sis-cursor-color ()
    "Reset sis cursor color to nil, to trigger updates after theme change"
    (setq sis-default-cursor-color nil))
  (add-hook 'after-enable-theme-hook 'reset-sis-cursor-color)) 

希望能在 sis 内部解决这个 bug, 这样就不需要这个 hack 了.

@laishulu
Copy link
Owner

laishulu commented Apr 5, 2024

挺好的建议。这几天我抽空写进去。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants