guidoschmidt / circadian.el

Theme-switching for Emacs based on daytime
https://guidoschmidt.github.io/circadian.el
MIT License
175 stars 8 forks source link

sunrise-sunset returns string not parseble by Circadian in Germany #13

Closed phuhl closed 6 years ago

phuhl commented 6 years ago

When running this very snipped (with calendar-latitude/longitude set)

(setq circadian-themes '((:sunrise . whiteboard)
                         (:sunset . tsdh-dark)))
(circadian-setup)

I recieve the following error:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string(".m" "" nil)
  circadian-clear-12h-postfix(nil)
  circadian-parse-time-string("Wed")
  circadian-match-sun(:sunrise)
  circadian-mapc((:sunrise . whiteboard))
  mapc(circadian-mapc ((:sunrise . whiteboard) (:sunset . tsdh-dark)))
  circadian-setup()
  (progn (setq circadian-themes (quote ((:sunrise . whiteboard) (:sunset . tsdh-dark)))) (circadian-setup))
  (condition-case err (progn (setq circadian-themes (quote ((:sunrise . whiteboard) (:sunset . tsdh-dark)))) (circadian-setup)) ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s" "circadian" ":config" (error-message-string err)) :error))))
  (if (not (require (quote circadian) nil (quote t))) (ignore (message (format "Cannot load %s" (quote circadian)))) (condition-case err (progn (setq circadian-themes (quote ((:sunrise . whiteboard) (:sunset . tsdh-dark)))) (circadian-setup)) ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s" "circadian" ":config" (error-message-string err)) :error)))) t)
  (progn (use-package-ensure-elpa (quote circadian) (quote t) (quote nil) :ensure) (if (not (require (quote circadian) nil (quote t))) (ignore (message (format "Cannot load %s" (quote circadian)))) (condition-case err (progn (setq circadian-themes (quote ((:sunrise . whiteboard) (:sunset . tsdh-dark)))) (circadian-setup)) ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s" "circadian" ":config" (error-message-string err)) :error)))) t))
  eval((progn (use-package-ensure-elpa (quote circadian) (quote t) (quote nil) :ensure) (if (not (require (quote circadian) nil (quote t))) (ignore (message (format "Cannot load %s" (quote circadian)))) (condition-case err (progn (setq circadian-themes (quote ((:sunrise . whiteboard) (:sunset . tsdh-dark)))) (circadian-setup)) ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s" "circadian" ":config" (error-message-string err)) :error)))) t)) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

The problem appears to be that Circadian is expecting some string format from (sunrise-sunset) but the function returns the following for me: #("Wed, Apr 18, 2018: Sunrise 6:41am (Mitteleuropäische Sommerzeit), sunset 8:38pm (Mitteleuropäische Sommerzeit) at Aachen, DE (13:57 hours daylight)" 35 63 (charset windows-1252) 81 109 (charset windows-1252)).

Sadly, this breaks the whole package for me

guidoschmidt commented 6 years ago

Hey @phuhl,

thanks for reporting that bug - That output of sunrise-sunset seems to be uncommon. Which kind of Emacs version are you running, and on which operating system: looks like Windows (because of the charset windows-1252 part)? Do you have other packages installed, that might ?

phuhl commented 6 years ago

emacs-version: GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570

Windows 10

I know that i am running quite an old version of emacs but the newer one on windows had a bug (maybe) that broke some behaviour for me but did not add enough value for me to figure it out. If you want to take a look at my packages and my setup i have my .emacs.d files here: .emacs.d. My currently installed packages (without build-in ones) are:

ace-jump-mode      20140616.115
async              20171015.2239
auto-complete      20170124.1845
bind-key           20161218.1520
circadian          20180307.954
company            20171017.1638
company-tern       20161004.1147
dash               20171028.854
dash-functional    20171028.804
diminish           20170419.1036
epl                20150517.433
expand-region      20170514.1309
flycheck           20171109.216
git-commit         20171007.346
google-translate   20170713.119
haskell-mode       20171022.26
ido-vertical-mode  20160429.1037
indium             20171106.916
js-doc             20160714.2134
js2-mode           20171107.333
json-mode          20170719.2205
json-reformat      20160212.53
json-snatcher      20150511.2047
let-alist          1.0.5
macrostep          20161120.1306
magit              20171112.348
magit-popup        20171109.1438
multiple-cursors   20170908.1452
org                20171113
origami            20170129.805
paredit            20170405.1149
pkg-info           20150517.443
popup              20160709.729
restclient         20180316.851
rjsx-mode          20171029.1156
s                  20171102.227
seq                2.20
slime              20171106.1331
ssh-agency         20170807.1152
tern               20170925.1333
tern-auto-complete 20170521.1235
use-package        20171030.1428
web-mode           20171112.1324
websocket          20171113.2045
with-editor        20171006.352
yasnippet          20170923.1646

I guess, you already figured out that I am in Germany. I don't know how that effects that sunrise-sunset function though.

guidoschmidt commented 6 years ago

Thanks for the details - I'm currently running ciradian package in Emacs 25.3 on Windows 10 on my workstation without any issues. Maybe the sunset-sunrise changed from version 24 🤔 I'll try it as soon as I get to it.

Grüße aus Hockenheim 🙃

guidoschmidt commented 6 years ago

Hey @phuhl thanks to @sarg your issue should be fixed 🎉 - would you mind testing circadian 0.3.3 on your system? Thanks in advance!

phuhl commented 6 years ago

That fixed it, good work 🎉

guidoschmidt commented 6 years ago

@phuhl Cool, thanks for testing and closing the issue 🎉