[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/moe-theme b0ca7d3d54 111/352: Fix screen flashing in GUI v
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/moe-theme b0ca7d3d54 111/352: Fix screen flashing in GUI version Emacs. |
Date: |
Fri, 7 Jan 2022 03:59:11 -0500 (EST) |
branch: elpa/moe-theme
commit b0ca7d3d543469e04712b0ba0d20892492ae2bad
Author: kuanyui <azazabc123@gmail.com>
Commit: kuanyui <azazabc123@gmail.com>
Fix screen flashing in GUI version Emacs.
---
moe-theme-switcher.el | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/moe-theme-switcher.el b/moe-theme-switcher.el
index 309d4321a3..0c83c04798 100644
--- a/moe-theme-switcher.el
+++ b/moe-theme-switcher.el
@@ -21,10 +21,25 @@ Take Keelung, Taiwan(25N,121E) for example, you can set
like this:
(setq calendar-longitude +121)"
)
+(defvar moe-now nil
+ "Variable recording which theme (moe-dark or light) is being used.")
+
+(defun moe-load-theme (switch-to)
+ "Avoid unnecessary load-theme and screen flashing in GUI version Emacs"
+ (cond ((equal switch-to "light")
+ (if (not (equal moe-now "light"))
+ (progn (load-theme 'moe-light t)
+ (setq moe-now "light"))))
+ ((equal switch-to "dark")
+ (if (not (equal moe-now "dark"))
+ (progn (load-theme 'moe-dark t)
+ (setq moe-now "dark"))))))
+
(defun switch-at-fixed-time ()
(let ((now (string-to-int (format-time-string "%H"))))
(if (and (>= now 06) (<= now 18))
- (load-theme 'moe-light t) (load-theme 'moe-dark t))
+ (moe-load-theme "light")
+ (moe-load-theme "dark"))
nil))
;; (Thanks for letoh!)
@@ -77,9 +92,9 @@ Take Keelung, Taiwan(25N,121E) for example, you can set like
this:
;; Excute every minute.
(defun switch-by-locale ()
(if (equal 24h/sunrise 'polar-night) ;If polar-night...moe-dark!
- (load-theme 'moe-dark t)
+ (moe-load-theme "dark")
(if (equal 24h/sunrise 'midnight-sun) ;If midnight-sun...moe-light!
- (load-theme 'moe-light t)
+ (moe-load-theme "light")
(progn
(let ((now (list (string-to-number (format-time-string "%H"))
(string-to-number (format-time-string "%M")))))
@@ -93,11 +108,12 @@ Take Keelung, Taiwan(25N,121E) for example, you can set
like this:
(and
(= (car now) (car 24h/sunset))
(< (second now) (second 24h/sunset)))))
- (load-theme 'moe-light t)
- (load-theme 'moe-dark t)
+ (moe-load-theme "light")
+ (moe-load-theme "dark")
))))))
(defun moe-theme-auto-switch ()
+ "Automatically switch between dark and light moe-theme."
(interactive)
(if (boundp '24h/sunrise)
(switch-by-locale)
@@ -117,9 +133,7 @@ Take Keelung, Taiwan(25N,121E) for example, you can set
like this:
(moe-theme-auto-switch)
-(run-with-timer 0 (* 1 60) 'moe-theme-auto-switch)
+(run-with-timer 0 (* 1 60) 'moe-theme-auto-switch)
(provide 'moe-theme-switcher)
-
-
- [nongnu] elpa/moe-theme d25b742cec 193/352: Change org-link to blue-1, (continued)
- [nongnu] elpa/moe-theme d25b742cec 193/352: Change org-link to blue-1, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 5388b25528 221/352: Add faces for menu-bar in Emacs 24.4., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme abfc1aacb6 211/352: light: Change function's face into red., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ea5024cd11 200/352: Update screenshots., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 601fd5839a 233/352: Fixing for latest ReStructText-mode., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme b123ab7fef 179/352: Add support for company completions, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 051de194c2 088/352: Lighter font-lock-preprocessor-face in moe-dark., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 85c21ff4e8 096/352: Dark blue links also hard to read., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme cca04aa36f 095/352: Dark blue for org-date hard to read in dark theme, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 967d8bc048 115/352: Improved some faces for git-commit and magit-mode., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme b0ca7d3d54 111/352: Fix screen flashing in GUI version Emacs.,
ELPA Syncer <=
- [nongnu] elpa/moe-theme 07cb5e56bc 110/352: Clear ace-jump face in moe-dark., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 66d4499bb2 117/352: Lighter popup-menu-selection-face in moe-dark, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 295ea3feeb 109/352: Some magit label., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 75dab3ce6e 116/352: header-line in list-package., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ebfb863ab1 123/352: Lighter blue-1, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme b3cb9ec303 120/352: Improve faces for Diff =w=+, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ee9dd51b43 126/352: Gnus & Message QAQ, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 5fe593f118 132/352: Fix git-commit-mode wrong faces., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0a6857528c 130/352: gnus, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme a23d7203da 166/352: Helm-Swoop, ELPA Syncer, 2022/01/07