# HG changeset patch # User Glenn Morris # Date 1247021291 0 # Node ID 06bd6035d548567a29235aad16b28e23d4a80929 # Parent 564ef05eedbcc0a4605314fe6e10b4b1a2eedd37 (calendar-current-date): Rework previous change. diff -r 564ef05eedbc -r 06bd6035d548 lisp/ChangeLog --- a/lisp/ChangeLog Wed Jul 08 02:46:23 2009 +0000 +++ b/lisp/ChangeLog Wed Jul 08 02:48:11 2009 +0000 @@ -1,3 +1,7 @@ +2009-07-08 Glenn Morris + + * calendar/calendar.el (calendar-current-date): Rework previous change. + 2009-07-08 Ed Reingold * calendar/calendar.el (calendar-current-date): diff -r 564ef05eedbc -r 06bd6035d548 lisp/calendar/calendar.el --- a/lisp/calendar/calendar.el Wed Jul 08 02:46:23 2009 +0000 +++ b/lisp/calendar/calendar.el Wed Jul 08 02:48:11 2009 +0000 @@ -1786,12 +1786,13 @@ (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\".