unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Matthias Pfeifer <mpfeifer77@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: How to use code from solar.el
Date: Fri, 25 Nov 2016 10:02:31 +0100	[thread overview]
Message-ID: <CAPzsW6jFYUSPZnYEas5Bupjjpa54Xm+0DOYO=9X3fyRj_uWEGg@mail.gmail.com> (raw)

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	other threads:[~2016-11-25  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25  9:02 Matthias Pfeifer [this message]
2016-11-25 13:13 ` How to use code from solar.el Stephen Berman
  -- strict thread matches above, loose matches on Subject: below --
2016-11-25 13:31 Matthias Pfeifer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPzsW6jFYUSPZnYEas5Bupjjpa54Xm+0DOYO=9X3fyRj_uWEGg@mail.gmail.com' \
    --to=mpfeifer77@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).