From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: How to use code from solar.el Date: Fri, 25 Nov 2016 14:13:24 +0100 Message-ID: <87vavbbt3f.fsf@rub.de> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1480079649 7993 195.159.176.226 (25 Nov 2016 13:14:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 25 Nov 2016 13:14:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Matthias Pfeifer Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 25 14:13:58 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cAGKD-0000a0-Ps for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Nov 2016 14:13:57 +0100 Original-Received: from localhost ([::1]:46060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAGKH-0004fK-GV for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Nov 2016 08:14:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAGJp-0004f3-1Q for help-gnu-emacs@gnu.org; Fri, 25 Nov 2016 08:13:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cAGJl-0002at-2n for help-gnu-emacs@gnu.org; Fri, 25 Nov 2016 08:13:33 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:61002) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cAGJk-0002YB-Nf for help-gnu-emacs@gnu.org; Fri, 25 Nov 2016 08:13:28 -0500 Original-Received: from rosalinde ([89.245.102.72]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MCcOw-1c1yqN0Pqc-009PP2; Fri, 25 Nov 2016 14:13:25 +0100 In-Reply-To: (Matthias Pfeifer's message of "Fri, 25 Nov 2016 10:02:31 +0100") X-Provags-ID: V03:K0:WARt5fKo07mjQevPfLhc/qadkRsu7R8e2CeWh6pykRBljcj1MTH H/+9wtF0OJDOBxBhtYhxz5+ttWTxJAj3CkMvJ89HC7RZj0/XE1uXao050DgAfxojZ0GmKaw gwlJJAC18Sr7DNLAHR6Vtw/EmoXU7flgpGieUxVRr5Xj8ewjYfUl21OT+VesuDv8/8q1G4u dee2oVw3r1dSuuad3mfoQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:pbwmrno8Tao=:dMk+KEIEgWfOL7neVPvDLh TugBFzsTJjjHWlJJkofHN2Z+KNANISqrHup5uqF3oEZt5bipU55qNPn0gXyoMvwpJ0UUX+0xT MAtOpH4P0kPYtfroPGK9FNgkjZMH4U91rzKZQWuOmIadKkuy3RmyKgl4DNsZ8WR8Zy/XDT6T5 w6s3/3siKYkfEZJrwr8r5KVMWD3vRKgnb4Q0j6Pz9QIN0PyzDBx7pB50HiOvRSjfiSyoCrnXl H2/ekMMgKue+yvJlYerZMuHglk8U9qe7NYbbJI6QsRlZjxK0AC6+5LUB7gOyJny18rYvnzjkY 6HG3cVWXjL2GHV+1ol8+Tsde0o38TRbGs+Hfn0cjpjViUOEAlf2oMfd02zciBPRmbm9Qdo/w1 G1kzVpWMoIBs5VN9YzgcEi68WtGFFSj3FbUPzXcRWSOXpjaM9mWjeYcjuPEzYY2TRUpD9teUF sL9ZXCUumgI6lfC6mGCBzM6SbeRFiXOGq0xhK6dE/oKQ/rQK4brTv73ibaY81eaLiqrAWYvbs c7BOJcLQtlub72q/Tfwo9BhvS7IKhI1c8T52kFtM4wQpk8VDCHpBOnfXcv/N0IaiBLB09w/lu dfqGqFF7Z8+AkbpDtDVJ8Fx/hXarQcyh4RXcrWVAqp6kjpLrxzEuru+TpBcoL8fnzvNp5drk/ u6qveJen2nefNGK4X9vnqZwfWOqWrlqjVdlIo8qNT5RFqGOv1FpSmafnUvpK4Hc7vUdWsRnfT M4k87GTNwwE9LtAYvKshBmTm2JX6azCQtODD1To5LVzDqT8XUIbbXNndEj+zQYriaIFfWElL X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.19 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111802 Archived-At: On Fri, 25 Nov 2016 10:02:31 +0100 Matthias Pfeifer = wrote: > solar.el is an emacs lisp library that comes with emacs. It (defun)s the > function solar-sunrise-sunset that calculates sunrise, sunset and dayligh= t. > I was wanting to have this information available in the mode-line and add= ed > 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 "[=E2=86=91%s, =E2=86=93%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 "[=E2=86=91%s, = =E2=86=93%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. The error is raised because the value of the variable calendar-longitude is nil. Both this variable and also calendar-latitude need to be set before your function above is invoked. One way to do that is with `M-x customize-option' and making sure your customizations are evaluated before mp:sunrise-sunset-for-modeline is invoked in your init file. Steve Berman