aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-04-04 07:14:38 +0000
committerGlenn Morris2008-04-04 07:14:38 +0000
commit216a3e253c6ba8ff66ec5dedd9f5094f6240a371 (patch)
tree4552c6d9abfcc748a3deb2428fb2412f68ba1461
parent88c4ca186c0f35bd07d12321bed872d2d7e3145a (diff)
downloademacs-216a3e253c6ba8ff66ec5dedd9f5094f6240a371.tar.gz
emacs-216a3e253c6ba8ff66ec5dedd9f5094f6240a371.zip
(calendar-iso-to-absolute): Rename calendar-absolute-from-iso.
Update callers, keep old name as alias. (calendar-iso-print-date): Rename calendar-print-iso-date. Update callers, keep old name as alias. (calendar-iso-goto-date): Rename calendar-goto-iso-date. Keep old name as alias. (calendar-iso-goto-week): Rename calendar-goto-iso-week. Keep old name as alias.
-rw-r--r--lisp/calendar/cal-iso.el36
1 files changed, 24 insertions, 12 deletions
diff --git a/lisp/calendar/cal-iso.el b/lisp/calendar/cal-iso.el
index e7aa4667081..32685337bed 100644
--- a/lisp/calendar/cal-iso.el
+++ b/lisp/calendar/cal-iso.el
@@ -33,7 +33,7 @@
33 33
34(require 'calendar) 34(require 'calendar)
35 35
36(defun calendar-absolute-from-iso (date) 36(defun calendar-iso-to-absolute (date)
37 "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE. 37 "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE.
38The `ISO year' corresponds approximately to the Gregorian year, but 38The `ISO year' corresponds approximately to the Gregorian year, but
39weeks start on Monday and end on Sunday. The first week of the ISO year is 39weeks start on Monday and end on Sunday. The first week of the ISO year is
@@ -49,6 +49,9 @@ Sunday). The Gregorian date Sunday, December 31, 1 BC is imaginary."
49 (* 7 (1- (extract-calendar-month date))) 49 (* 7 (1- (extract-calendar-month date)))
50 (if (zerop day) 6 (1- day))))) 50 (if (zerop day) 6 (1- day)))))
51 51
52(define-obsolete-function-alias 'calendar-absolute-from-iso
53 'calendar-iso-to-absolute "23.1")
54
52(defun calendar-iso-from-absolute (date) 55(defun calendar-iso-from-absolute (date)
53 "Compute the `ISO commercial date' corresponding to the absolute DATE. 56 "Compute the `ISO commercial date' corresponding to the absolute DATE.
54The ISO year corresponds approximately to the Gregorian year, but weeks 57The ISO year corresponds approximately to the Gregorian year, but weeks
@@ -62,11 +65,11 @@ date Sunday, December 31, 1 BC."
62 (calendar-gregorian-from-absolute (- date 3)))) 65 (calendar-gregorian-from-absolute (- date 3))))
63 (year (+ approx 66 (year (+ approx
64 (calendar-sum y approx 67 (calendar-sum y approx
65 (>= date (calendar-absolute-from-iso 68 (>= date (calendar-iso-to-absolute
66 (list 1 1 (1+ y)))) 69 (list 1 1 (1+ y))))
67 1)))) 70 1))))
68 (list 71 (list
69 (1+ (/ (- date (calendar-absolute-from-iso (list 1 1 year))) 7)) 72 (1+ (/ (- date (calendar-iso-to-absolute (list 1 1 year))) 7))
70 (% date 7) 73 (% date 7)
71 year))) 74 year)))
72 75
@@ -83,12 +86,15 @@ date Sunday, December 31, 1 BC."
83 (extract-calendar-year iso-date)))) 86 (extract-calendar-year iso-date))))
84 87
85;;;###cal-autoload 88;;;###cal-autoload
86(defun calendar-print-iso-date () 89(defun calendar-iso-print-date ()
87 "Show equivalent ISO date for the date under the cursor." 90 "Show equivalent ISO date for the date under the cursor."
88 (interactive) 91 (interactive)
89 (message "ISO date: %s" 92 (message "ISO date: %s"
90 (calendar-iso-date-string (calendar-cursor-to-date t)))) 93 (calendar-iso-date-string (calendar-cursor-to-date t))))
91 94
95(define-obsolete-function-alias 'calendar-print-iso-date
96 'calendar-iso-print-date "23.1")
97
92(defun calendar-iso-read-date (&optional dayflag) 98(defun calendar-iso-read-date (&optional dayflag)
93 "Interactively read the arguments for an ISO date command. 99 "Interactively read the arguments for an ISO date command.
94Reads a year and week, and if DAYFLAG is non-nil a day (otherwise 100Reads a year and week, and if DAYFLAG is non-nil a day (otherwise
@@ -113,25 +119,31 @@ taken to be 1)."
113 1))) 119 1)))
114 (list (list week day year)))) 120 (list (list week day year))))
115 121
116(define-obsolete-function-alias 122(define-obsolete-function-alias 'calendar-iso-read-args
117 'calendar-iso-read-args 'calendar-iso-read-date "23.1") 123 'calendar-iso-read-date "23.1")
118 124
119;;;###cal-autoload 125;;;###cal-autoload
120(defun calendar-goto-iso-date (date &optional noecho) 126(defun calendar-iso-goto-date (date &optional noecho)
121 "Move cursor to ISO DATE; echo ISO date unless NOECHO is non-nil." 127 "Move cursor to ISO DATE; echo ISO date unless NOECHO is non-nil."
122 (interactive (calendar-iso-read-date t)) 128 (interactive (calendar-iso-read-date t))
123 (calendar-goto-date (calendar-gregorian-from-absolute 129 (calendar-goto-date (calendar-gregorian-from-absolute
124 (calendar-absolute-from-iso date))) 130 (calendar-iso-to-absolute date)))
125 (or noecho (calendar-print-iso-date))) 131 (or noecho (calendar-iso-print-date)))
132
133(define-obsolete-function-alias 'calendar-goto-iso-date
134 'calendar-iso-goto-date "23.1")
126 135
127;;;###cal-autoload 136;;;###cal-autoload
128(defun calendar-goto-iso-week (date &optional noecho) 137(defun calendar-iso-goto-week (date &optional noecho)
129 "Move cursor to ISO DATE; echo ISO date unless NOECHO is non-nil. 138 "Move cursor to ISO DATE; echo ISO date unless NOECHO is non-nil.
130Interactively, goes to the first day of the specified week." 139Interactively, goes to the first day of the specified week."
131 (interactive (calendar-iso-read-date)) 140 (interactive (calendar-iso-read-date))
132 (calendar-goto-date (calendar-gregorian-from-absolute 141 (calendar-goto-date (calendar-gregorian-from-absolute
133 (calendar-absolute-from-iso date))) 142 (calendar-iso-to-absolute date)))
134 (or noecho (calendar-print-iso-date))) 143 (or noecho (calendar-iso-print-date)))
144
145(define-obsolete-function-alias 'calendar-goto-iso-week
146 'calendar-iso-goto-week "23.1")
135 147
136(defvar date) 148(defvar date)
137 149