# HG changeset patch # User Glenn Morris # Date 1247021183 0 # Node ID 564ef05eedbcc0a4605314fe6e10b4b1a2eedd37 # Parent 39e38bc3d6d0b269341520fc3bb452968691b38d Ed Reingold (calendar-current-date): Add an optional argument giving an offset from today. diff -r 39e38bc3d6d0 -r 564ef05eedbc lisp/ChangeLog --- a/lisp/ChangeLog Wed Jul 08 02:38:11 2009 +0000 +++ b/lisp/ChangeLog Wed Jul 08 02:46:23 2009 +0000 @@ -1,3 +1,8 @@ +2009-07-08 Ed Reingold + + * calendar/calendar.el (calendar-current-date): + Add an optional argument giving an offset from today. + 2009-07-08 Glenn Morris * tutorial.el (tutorial--describe-nonstandard-key): diff -r 39e38bc3d6d0 -r 564ef05eedbc lisp/calendar/calendar.el --- a/lisp/calendar/calendar.el Wed Jul 08 02:38:11 2009 +0000 +++ b/lisp/calendar/calendar.el Wed Jul 08 02:46:23 2009 +0000 @@ -1784,10 +1784,14 @@ (t (set-buffer buffer) (bury-buffer)))))) -(defun calendar-current-date () - "Return the current date in a list (month day year)." +(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))) - (list (nth 4 now) (nth 3 now) (nth 5 now)))) + (calendar-gregorian-from-absolute + (+ (calendar-absolute-from-gregorian + (list (nth 4 now) (nth 3 now) (nth 5 now))) + (if offset offset 0))))) (defun calendar-column-to-segment () "Convert current column to calendar month \"segment\".