aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-01-30 00:30:02 +0000
committerRichard M. Stallman1994-01-30 00:30:02 +0000
commit45cb347be74fe60ff590dce5d238461850f948e8 (patch)
tree364489c6827900435fbf3d4da4ef2210ab2b17dc
parentadaeaa8e59ee767533a145400baf83da75ec4386 (diff)
downloademacs-45cb347be74fe60ff590dce5d238461850f948e8.tar.gz
emacs-45cb347be74fe60ff590dce5d238461850f948e8.zip
(calendar-mayan-date-string): New function.
(calendar-print-mayan-date, diary-mayan-date): Use it.
-rw-r--r--lisp/calendar/cal-mayan.el34
1 files changed, 17 insertions, 17 deletions
diff --git a/lisp/calendar/cal-mayan.el b/lisp/calendar/cal-mayan.el
index b4e4e2b3976..25e3c7dc2cb 100644
--- a/lisp/calendar/cal-mayan.el
+++ b/lisp/calendar/cal-mayan.el
@@ -328,19 +328,26 @@ Long count is a list (baktun katun tun uinal kin)"
328 (- ; days before absolute date 0 328 (- ; days before absolute date 0
329 calendar-mayan-days-before-absolute-zero))) 329 calendar-mayan-days-before-absolute-zero)))
330 330
331(defun calendar-mayan-date-string (&optional date)
332 "String of Mayan date of Gregorian DATE.
333Defaults to today's date if DATE is not given."
334 (let* ((d (calendar-absolute-from-gregorian
335 (or date (calendar-current-date))))
336 (tzolkin (calendar-mayan-tzolkin-from-absolute d))
337 (haab (calendar-mayan-haab-from-absolute d))
338 (long-count (calendar-mayan-long-count-from-absolute d)))
339 (format "Long count = %s; tzolkin = %s; haab = %s"
340 (calendar-mayan-long-count-to-string long-count)
341 (calendar-mayan-tzolkin-to-string tzolkin)
342 (calendar-mayan-haab-to-string haab))))
343
331(defun calendar-print-mayan-date () 344(defun calendar-print-mayan-date ()
332 "Show the Mayan long count, tzolkin, and haab equivalents of date." 345 "Show the Mayan long count, tzolkin, and haab equivalents of date."
333 (interactive) 346 (interactive)
334 (let* ((d (calendar-absolute-from-gregorian 347 (message "Mayan date: %s"
348 (calendar-mayan-date-string
335 (or (calendar-cursor-to-date) 349 (or (calendar-cursor-to-date)
336 (error "Cursor is not on a date!")))) 350 (error "Cursor is not on a date!")))))
337 (tzolkin (calendar-mayan-tzolkin-from-absolute d))
338 (haab (calendar-mayan-haab-from-absolute d))
339 (long-count (calendar-mayan-long-count-from-absolute d)))
340 (message "Mayan date: Long count = %s; tzolkin = %s; haab = %s"
341 (calendar-mayan-long-count-to-string long-count)
342 (calendar-mayan-tzolkin-to-string tzolkin)
343 (calendar-mayan-haab-to-string haab))))
344 351
345(defun calendar-goto-mayan-long-count-date (date &optional noecho) 352(defun calendar-goto-mayan-long-count-date (date &optional noecho)
346 "Move cursor to Mayan long count DATE. Echo Mayan date unless NOECHO is t." 353 "Move cursor to Mayan long count DATE. Echo Mayan date unless NOECHO is t."
@@ -372,14 +379,7 @@ Long count is a list (baktun katun tun uinal kin)"
372 379
373(defun diary-mayan-date () 380(defun diary-mayan-date ()
374 "Show the Mayan long count, haab, and tzolkin dates as a diary entry." 381 "Show the Mayan long count, haab, and tzolkin dates as a diary entry."
375 (let* ((d (calendar-absolute-from-gregorian date)) 382 (format "Mayan date: %s" (calendar-mayan-date-string date)))
376 (tzolkin (calendar-mayan-tzolkin-from-absolute d))
377 (haab (calendar-mayan-haab-from-absolute d))
378 (long-count (calendar-mayan-long-count-from-absolute d)))
379 (format "Mayan date: Long count = %s; tzolkin = %s; haab = %s"
380 (calendar-mayan-long-count-to-string long-count)
381 (calendar-mayan-tzolkin-to-string haab)
382 (calendar-mayan-haab-to-string tzolkin))))
383 383
384(provide 'cal-mayan) 384(provide 'cal-mayan)
385 385