From 3ce82f979d5b229f1183107e0709f9fcc4385acc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 8 Jul 2009 02:46:23 +0000 Subject: [PATCH] Ed Reingold (calendar-current-date): Add an optional argument giving an offset from today. --- lisp/ChangeLog | 5 +++++ lisp/calendar/calendar.el | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 27d9f28702a..354580577c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 47bf62fa06a..4ec820dd20b 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1784,10 +1784,14 @@ the STRINGS are just concatenated and the result truncated." (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\". -- 2.11.4.GIT