[Top][All Lists]

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

[Emacs-bug-tracker] bug#8190: closed (Minor improvement for diary-yahrze

From: GNU bug Tracking System
Subject: [Emacs-bug-tracker] bug#8190: closed (Minor improvement for diary-yahrzeit)
Date: Mon, 07 Mar 2011 07:48:01 +0000

Your message dated Mon, 07 Mar 2011 02:47:43 -0500
with message-id <address@hidden>
and subject line Re: Minor improvement for diary-yahrzeit
has caused the GNU bug report #8190,
regarding Minor improvement for diary-yahrzeit
to be marked as done.

(If you believe you have received this mail in error, please contact

8190: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8190
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Minor improvement for diary-yahrzeit Date: Sun, 6 Mar 2011 13:50:48 -0600
The code below includes the one day correction needed if the death is
after local sunset.  This change makes the code parallel to the code
for diary-hebrew-birthday that I sent last week.

(defun diary-yahrzeit
  (death-month death-day death-year &optional after-sunset)
  "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.
Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed
to be the name of the person.  Date of death is on the *civil* calendar;
although the date of death is specified by the civil calendar, the proper
Hebrew calendar yahrzeit is determined.  NOTE: If the death occurred after
local sunset on the given civil date, the following civil date corresponds to
the Hebrew date of death--the optional parameter AFTER-SUNSET does this
correction when t.  If `european-calendar-style' is t, the order of the
parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR."
  (let* ((h-date (calendar-hebrew-from-absolute
                  (+ (calendar-absolute-from-gregorian
                      (if european-calendar-style
                          (list death-day death-month death-year)
                        (list death-month death-day death-year)))
                     (if after-sunset 1 0))))
         (h-month (extract-calendar-month h-date))
         (h-day (extract-calendar-day h-date))
         (h-year (extract-calendar-year h-date))
         (d (calendar-absolute-from-gregorian date))
         (yr (extract-calendar-year (calendar-hebrew-from-absolute d)))
         (diff (- yr h-year))
         (y (hebrew-calendar-yahrzeit h-date yr)))
    (if (and (> diff 0) (or (= y d) (= y (1+ d))))
        (format "Yahrzeit of %s%s: %d%s anniversary"
                (if (= y d) "" " (evening)")
                (cond ((= (% diff 10) 1) "st")
                      ((= (% diff 10) 2) "nd")
                      ((= (% diff 10) 3) "rd")
                      (t "th"))))))

--- End Message ---
--- Begin Message --- Subject: Re: Minor improvement for diary-yahrzeit Date: Mon, 07 Mar 2011 02:47:43 -0500 User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
Version: 24.1

Applied; thanks.

--- End Message ---

reply via email to

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