[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v |
Date: |
Tue, 01 Apr 2008 02:42:06 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Glenn Morris <gm> 08/04/01 02:42:05
Index: cal-mayan.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/cal-mayan.el,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- cal-mayan.el 16 Mar 2008 01:58:15 -0000 1.38
+++ cal-mayan.el 1 Apr 2008 02:42:05 -0000 1.39
@@ -28,28 +28,7 @@
;;; Commentary:
-;; This collection of functions implements the features of calendar.el and
-;; diary.el that deal with the Mayan calendar. It was written jointly by
-
-;; Stewart M. Clamen School of Computer Science
-;; address@hidden Carnegie Mellon University
-;; 5000 Forbes Avenue
-;; Pittsburgh, PA 15213
-
-;; and
-
-;; Edward M. Reingold Department of Computer Science
-;; (217) 333-6733 University of Illinois at Urbana-Champaign
-;; address@hidden 1304 West Springfield Avenue
-;; Urbana, Illinois 61801
-
-;; Technical details of the Mayan calendrical calculations can be found in
-;; ``Calendrical Calculations: The Millennium Edition'' by Edward M. Reingold
-;; and Nachum Dershowitz, Cambridge University Press (2001), and in
-;; ``Calendrical Calculations, Part II: Three Historical Calendars''
-;; by E. M. Reingold, N. Dershowitz, and S. M. Clamen,
-;; Software--Practice and Experience, Volume 23, Number 4 (April, 1993),
-;; pages 383-404.
+;; See calendar.el.
;;; Code:
@@ -96,20 +75,17 @@
(defun calendar-string-to-mayan-long-count (str)
"Given STR, a string of format \"%d.%d.%d.%d.%d\", return list of numbers."
- (let ((c (length str))
- (cc 0)
+ (let ((end 0)
rlc)
- (condition-case condition
+ (condition-case nil
(progn
- (while (< cc c)
- (let* ((start (string-match "[0-9]+" str cc))
- (end (match-end 0))
- (datum (read (substring str start end))))
- (setq rlc (cons datum rlc)
- cc end)))
+ ;; cf split-string.
+ (while (string-match "[0-9]+" str end)
+ (setq rlc (cons (string-to-number (match-string 0 str)) rlc)
+ end (match-end 0)))
(unless (= (length rlc) 5) (signal 'invalid-read-syntax nil)))
(invalid-read-syntax nil))
- (reverse rlc)))
+ (nreverse rlc)))
(defun calendar-mayan-haab-from-absolute (date)
"Convert absolute DATE into a Mayan haab date (a pair)."
@@ -361,18 +337,18 @@
"Move cursor to Mayan long count DATE.
Echo Mayan date unless NOECHO is non-nil."
(interactive
- (let (lc)
- (while (not lc)
- (let ((datum
+ (let (datum)
+ (while (not (setq datum
(calendar-string-to-mayan-long-count
- (read-string "Mayan long count (baktun.katun.tun.uinal.kin): "
+ (read-string
+ "Mayan long count (baktun.katun.tun.uinal.kin): "
(calendar-mayan-long-count-to-string
(calendar-mayan-long-count-from-absolute
(calendar-absolute-from-gregorian
- (calendar-current-date))))))))
- (if (calendar-mayan-long-count-common-era datum)
- (setq lc datum))))
- (list lc)))
+ (calendar-current-date))))))
+ datum (if (calendar-mayan-long-count-common-era datum)
+ (list datum)))))
+ datum))
(calendar-goto-date
(calendar-gregorian-from-absolute
(calendar-absolute-from-mayan-long-count date)))
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/07
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/07
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/08
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/13
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/13
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/14
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v, Glenn Morris, 2008/03/15
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-mayan.el,v,
Glenn Morris <=