[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/moe-theme 250749bba2 090/352: Fixed some errors, including
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/moe-theme 250749bba2 090/352: Fixed some errors, including a let expression. |
Date: |
Fri, 7 Jan 2022 03:59:09 -0500 (EST) |
branch: elpa/moe-theme
commit 250749bba265e39d5277385ba6f2c59f1bf76a40
Author: Tobias J <toja92@gmail.com>
Commit: Tobias J <toja92@gmail.com>
Fixed some errors, including a let expression.
---
moe-theme-switcher.el | 56 +++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 31 deletions(-)
diff --git a/moe-theme-switcher.el b/moe-theme-switcher.el
index 82c2700b2e..a10317b7a0 100644
--- a/moe-theme-switcher.el
+++ b/moe-theme-switcher.el
@@ -7,6 +7,8 @@
(require 'moe-dark-theme)
(require 'moe-light-theme)
+(require 'solar)
+(require 'calendar)
(defvar moe-theme-switch-by-sunrise-and-sunset t
"Automatically switch between dark and light moe-theme.
@@ -22,7 +24,7 @@ Take Keelung, Taiwan(25N,121E) for example, you can set like
this:
)
(defun switch-at-fixed-time ()
- (let ((now (string-to-int (format-time-string "%H"))))
+ (let ((now (string-to-number (format-time-string "%H"))))
(if (and (>= now 06) (<= now 18))
(load-theme 'moe-light t) (load-theme 'moe-dark t))
nil))
@@ -40,33 +42,28 @@ Example:
;; Excute every minute.
(defun switch-by-locale ()
- (let ((sunrise-sunset a b c)
- (length-of-day a b)
- (sunrise a)
- (sunset a))
- (setq sunrise-sunset (solar-sunrise-sunset (calendar-current-date)))
- ; length of day should never be nil
- (setq length-of-day (mapcar
- (lambda (x) (string-to-number x))
- (split-string (car (cddr sunrise-sunset ":")))))
-
- (if (equal length-of-day '(0 0)) ; Polar night
- (load-theme 'moe-dark t)
- (if (equal length-of-day '(24 0)) ; Midnight sun
- (load-theme 'moe-light t)
- (let ((now (list (string-to-number (format-time-string "%H"))
- (string-to-number (format-time-string "%M"))))
- (sunrise (float-to-time-list (caar sunrise-sunset)))
- (sunset (float-to-time-list (car (cadr sunrise-sunset)))))
- (if (and
- (or (> (car now) (car sunrise))
- (and (= (car now) (car sunrise))
- (>= (cdr now) (cdr sunrise))))
- (or (< (car now) (car sunset))
- (and (= (car now) (car sunset))
- (< (cdr now) (cdr sunset)))))
- (load-theme 'moe-light t)
- (load-theme 'moe-dark t)))))))
+ (let* ((sunrise-sunset (solar-sunrise-sunset (calendar-current-date)))
+ (length-of-day (mapcar
+ (lambda (x) (string-to-number x))
+ (split-string (car (cddr sunrise-sunset ":"))))))
+ (progn
+ (if (equal length-of-day '(0 0)) ; Polar night
+ (load-theme 'moe-dark t)
+ (if (equal length-of-day '(24 0)) ; Midnight sun
+ (load-theme 'moe-light t)
+ (let ((now (list (string-to-number (format-time-string "%H"))
+ (string-to-number (format-time-string "%M"))))
+ (sunrise (float-to-time-list (caar sunrise-sunset)))
+ (sunset (float-to-time-list (car (cadr sunrise-sunset)))))
+ (if (and
+ (or (> (car now) (car sunrise))
+ (and (= (car now) (car sunrise))
+ (>= (cdr now) (cdr sunrise))))
+ (or (< (car now) (car sunset))
+ (and (= (car now) (car sunset))
+ (< (cdr now) (cdr sunset)))))
+ (load-theme 'moe-light t)
+ (load-theme 'moe-dark t))))))))
(defun moe-theme-auto-switch ()
(interactive)
@@ -81,6 +78,3 @@ Example:
(run-with-timer 0 (* 1 60) 'moe-theme-auto-switch)
(provide 'moe-theme-switcher)
-
-
-
- [nongnu] elpa/moe-theme cb14d6e6fe 053/352: 1. it seems -pkg.el goes wrong., (continued)
- [nongnu] elpa/moe-theme cb14d6e6fe 053/352: 1. it seems -pkg.el goes wrong., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 4234d66184 066/352: Todo list., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 7e569065c4 067/352: typo., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0bdea86acc 069/352: Add faces for yalinum.el, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 51c7d1438f 076/352: moe-dark for Org Agenda, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 436f69e300 077/352: Full support for Org-mode Agenda! ˊ・ω・ˋ, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme c1c8afe313 078/352: Full support for Org-mode Agenda! ˊ・ω・ˋ, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0708cd841a 079/352: Full support for Org-mode Agenda! ˊ・ω・ˋ, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 17684de38d 082/352: Improve the color scheme of org-mode agenda., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 32430b15d8 084/352: Font lock of comments and so on., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 250749bba2 090/352: Fixed some errors, including a let expression.,
ELPA Syncer <=
- [nongnu] elpa/moe-theme 6c30256505 105/352: Apply color-palettes on MMM-mode, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 8cfe4e44e4 108/352: Add git-commit-mode. Fix issue #7., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 50f548d9e8 002/352: 1. add moe-light-theme ! ˊ・w・ˋ, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme a4ee2dc2ad 011/352: 1. Add 8 screenshots., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme b008ad6d9f 029/352: (同上), ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme da0c4aa78e 037/352: 1. Add new 2 screenshots of Magit., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 09444fa932 040/352: 1. Fix flaws of screenshots., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 881c5f94a1 039/352: 1. Trim the KDE panel in dark03.png...orz, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme f380f7b9a0 021/352: (not worth mentioning), ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme b4ff93f1e1 043/352: 1. Poor English..., ELPA Syncer, 2022/01/07