help-gnu-emacs
[Top][All Lists]
Advanced

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

How to use code from solar.el


From: Matthias Pfeifer
Subject: How to use code from solar.el
Date: Fri, 25 Nov 2016 10:02:31 +0100

Hi there,


solar.el is an emacs lisp library that comes with emacs. It (defun)s the
function solar-sunrise-sunset that calculates sunrise, sunset and daylight.
I was wanting to have this information available in the mode-line and added
to my init.el file this piece of emacs lisp:


(require 'solar)

(defun mp:sunrise-sunset-for-modeline ()
  (let ((calendar-time-display-form '(24-hours ":" minutes))
        (l (solar-sunrise-sunset (calendar-current-date))))
    (format "[↑%s, ↓%s]"
            (apply 'solar-time-string (car l))
            (apply 'solar-time-string (cadr l)))))

When i was testing the code it was working find. However when I invoke
emacs i get during loading of init.el this error message:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  solar-exact-local-noon((11 25 2016))
  solar-sunrise-sunset((11 25 2016))
  (let ((calendar-time-display-form (quote (24-hours ":" minutes))) (l
(solar-sunrise-sunset (calendar-current-date)))) (format "[↑%s, ↓%s]"
(apply (quote solar-time-string) (car l)) (apply (quote solar-time-string)
(car (cdr l)))))
  mp:sunrise-sunset-for-modeline()
  eval((mp:sunrise-sunset-for-modeline) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)


Why is the function not executing? If I invoke calendar before
mp:sunrise-sunset-for-modeline then it works without error. Is it possible
that i have to require some more dependencies? The debugger error message
does not seem to indicate this, but it seems likely to me.




Matthias


reply via email to

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