aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <[email protected]>2009-07-08 02:48:11 +0000
committerGlenn Morris <[email protected]>2009-07-08 02:48:11 +0000
commit7ef5b8b271f05ff987e0a2ed498ba25cfa586739 (patch)
tree9cff9424c77de2fa54758c908388825cef106647 /lisp/calendar
parent3ce82f979d5b229f1183107e0709f9fcc4385acc (diff)
(calendar-current-date): Rework previous change.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/calendar.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 4ec820dd20..d601cf6a22 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1786,12 +1786,13 @@ the STRINGS are just concatenated and the result truncated."
(defun calendar-current-date (&optional offset)
"Return the current date in a list (month day year).
-Optional OFFSET is number of days from current date."
- (let ((now (decode-time)))
- (calendar-gregorian-from-absolute
- (+ (calendar-absolute-from-gregorian
- (list (nth 4 now) (nth 3 now) (nth 5 now)))
- (if offset offset 0)))))
+Optional integer OFFSET is a number of days from the current date."
+ (let* ((now (decode-time))
+ (now (list (nth 4 now) (nth 3 now) (nth 5 now))))
+ (if (zerop (or offset 0))
+ now
+ (calendar-gregorian-from-absolute
+ (+ offset (calendar-absolute-from-gregorian now))))))
(defun calendar-column-to-segment ()
"Convert current column to calendar month \"segment\".