From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Magolske Newsgroups: gmane.emacs.help Subject: Re: Challenges around displaying phase of moon in calfw Date: Sat, 3 Jun 2017 19:13:38 -0700 Message-ID: <20170604021338.GA26566@s70206.gridserver.com> References: <20170528081730.GA17308@s70206.gridserver.com> <20170601052912.GB15070@s70206.gridserver.com> 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 1496542370 3055 195.159.176.226 (4 Jun 2017 02:12:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 4 Jun 2017 02:12:50 +0000 (UTC) User-Agent: Mutt/1.5.23 (2014-03-12) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 04 04:12:42 2017 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 1dHL22-0000QC-Fu for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Jun 2017 04:12:42 +0200 Original-Received: from localhost ([::1]:55513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHL27-0002PV-MV for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Jun 2017 22:12:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHL1Y-0002N8-U0 for help-gnu-emacs@gnu.org; Sat, 03 Jun 2017 22:12:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHL1T-0002ll-U3 for help-gnu-emacs@gnu.org; Sat, 03 Jun 2017 22:12:12 -0400 Original-Received: from mail6.webfaction.com ([74.55.86.74]:36696 helo=smtp.webfaction.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dHL1T-0002ha-Lo for help-gnu-emacs@gnu.org; Sat, 03 Jun 2017 22:12:07 -0400 Original-Received: from localhost (142-254-78-28.dsl.dynamic.fusionbroadband.com [142.254.78.28]) by smtp.webfaction.com (Postfix) with ESMTP id 3F7FA59B568F for ; Sun, 4 Jun 2017 02:12:02 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20170601052912.GB15070@s70206.gridserver.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 74.55.86.74 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:113350 Archived-At: Ok, hacked together a workaround... * John Magolske [170601 00:32]: > * John Magolske [170528 02:05]: >=20 > > [...] the lunar phases show up in calfw, but for some > > reason the time is displayed twice, like so: > >=20 > > 19:48 =E2=97=90 q1=E2=86=91 7:48pm (PDT) > > 14:40 =E2=97=8F Full 2:40pm (PDT) > > 12:46 =E2=97=AF New 12:46pm (PDT) > > [...] > > I'm wondering if this issue may be related to this post on emacs-devel: >=20 > calendar/diary/appt: diary-lunar-phases should not create appointments > [...] > https://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00329.html > no resolution...picked up again a few years later: > https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01347.html I see this does appear to be the same issue mentioned in the emacs-devel posts as well (thanks to an off-list exchange with Toto). Apparently with time shown, an appointment is created out of the diary entry. So I edited the output of lunar.el to show these times substituting =E2=88=B6 (RATIO, U+2236) for : (COLON, U+003A), a for am, and p for pm. This way they aren't recognized at "times" and the time doesn't show up twice in calfw. Also got rid of the parenthesis around time zones to keep things concise. Below is the modified version of lunar.el as placed in my init file, displays in calfw like so: =E2=97=90 q1=E2=86=91 7:48p PDT =E2=97=8F Full 2:40p PDT =E2=97=AF New 12:46p PDT Cheers, John ---- (with-eval-after-load 'lunar (defun diary-lunar-phases (&optional mark) "Moon phases diary entry. An optional parameter MARK specifies a face or single-character string to use when highlighting the day in the calendar. Note: edited from lunar.el, changed the part that calls out hour of l= unar phase substituting =E2=88=B6 (RATIO, U+2236) for : (COLON, U+003A), a for= am, p for pm so that lunar phase times aren't recognized as timestamps. Otherwise appo= intment will be created out of these diary entries and times will show up twice i= n calfw. Also removed the parenthesis around timezone to shorten what's displayed.= " (let* ((index (lunar-index date)) (phase (lunar-phase index))) (while (calendar-date-compare phase (list date)) (setq index (1+ index) phase (lunar-phase index))) (if (calendar-date-equal (car phase) date) ;; (cons mark (lunar-phase-name (nth 2 phase))))))) (cons mark (concat=20 (lunar-phase-name (nth 2 phase)) " " (replace-regexp-in-string ":" "=E2=88=B6" (replace-regexp-in-string "am" "a" (replace-regexp-in-string "pm" "p" (replace-regexp-in-string "(" "" (replace-regexp-in-string ")" "" (cadr phase)))))) )))))) --=20 John Magolske http://b79.net/contact