summaryrefslogtreecommitdiff
path: root/lisp/=diary-lib.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-01-30 00:26:04 +0000
committerRichard M. Stallman <rms@gnu.org>1994-01-30 00:26:04 +0000
commit3edb0cfa755ef4ebeefc86b36df680cade6a0dcf (patch)
treee7b2d68c678300fdd6b348681323ce39f1e430cf /lisp/=diary-lib.el
parent40ca95829be1a57ad2ffa391853ce4142e12845c (diff)
downloademacs-3edb0cfa755ef4ebeefc86b36df680cade6a0dcf.tar.gz
(diary-day-of-year, diary-iso-date, diary-islamic-date,
diary-hebrew-date, diary-julian-date, diary-astro-day-number): Use new functions from calendar.el.
Diffstat (limited to 'lisp/=diary-lib.el')
-rw-r--r--lisp/=diary-lib.el44
1 files changed, 12 insertions, 32 deletions
diff --git a/lisp/=diary-lib.el b/lisp/=diary-lib.el
index c7b79f42478..2ca7ed9cc26 100644
--- a/lisp/=diary-lib.el
+++ b/lisp/=diary-lib.el
@@ -1331,53 +1331,33 @@ ending of that number (that is, `st', `nd', `rd' or `th', as appropriate."
(defun diary-day-of-year ()
"Day of year and number of days remaining in the year of date diary entry."
- (let* ((year (extract-calendar-year date))
- (day (calendar-day-number date))
- (days-remaining (- (calendar-day-number (list 12 31 year)) day)))
- (format "Day %d of %d; %d day%s remaining in the year"
- day year days-remaining (if (= days-remaining 1) "" "s"))))
+ (calendar-day-of-year-string date))
(defun diary-iso-date ()
"ISO calendar equivalent of date diary entry."
- (let ((day (% (calendar-absolute-from-gregorian date) 7))
- (iso-date (calendar-iso-from-absolute
- (calendar-absolute-from-gregorian date))))
- (format "ISO date: Day %s of week %d of %d."
- (if (zerop day) 7 day)
- (extract-calendar-month iso-date)
- (extract-calendar-year iso-date))))
+ (format "ISO date: %s" (calendar-iso-date-string date)))
(defun diary-islamic-date ()
"Islamic calendar equivalent of date diary entry."
- (let* ((i-date (calendar-islamic-from-absolute
- (calendar-absolute-from-gregorian date)))
- (calendar-month-name-array calendar-islamic-month-name-array))
- (if (>= (extract-calendar-year i-date) 1)
- (format "Islamic date: %s" (calendar-date-string i-date nil t)))))
+ (let ((i (calendar-islamic-date-string
+ (or (calendar-cursor-to-date)
+ (error "Cursor is not on a date!")))))
+ (if (string-equal i "")
+ "Date is pre-Islamic"
+ (format "Islamic date (until sunset): %s" i))))
(defun diary-hebrew-date ()
"Hebrew calendar equivalent of date diary entry."
- (let* ((h-date (calendar-hebrew-from-absolute
- (calendar-absolute-from-gregorian date)))
- (calendar-month-name-array
- (if (hebrew-calendar-leap-year-p
- (extract-calendar-year h-date))
- calendar-hebrew-month-name-array-leap-year
- calendar-hebrew-month-name-array-common-year)))
- (format "Hebrew date: %s" (calendar-date-string h-date nil t))))
+ (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date)))
(defun diary-julian-date ()
"Julian calendar equivalent of date diary entry."
- (format "Julian date: %s"
- (calendar-date-string
- (calendar-julian-from-absolute
- (calendar-absolute-from-gregorian date)))
- nil t))
+ (format "Julian date: %s" (calendar-julian-date-string date)))
(defun diary-astro-day-number ()
"Astronomical (Julian) day number diary entry."
- (format "Astronomical (Julian) day number %d"
- (+ 1721425 (calendar-absolute-from-gregorian date))))
+ (format "Astronomical (Julian) day number %s"
+ (calendar-astro-date-string date)))
(defun diary-omer ()
"Omer count diary entry.