summaryrefslogtreecommitdiff
path: root/lisp/calendar/calendar.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2009-07-08 02:46:23 +0000
committerGlenn Morris <rgm@gnu.org>2009-07-08 02:46:23 +0000
commit3ce82f979d5b229f1183107e0709f9fcc4385acc (patch)
treea4d6ae6ff88110586515eeacd14d814cd518f59c /lisp/calendar/calendar.el
parent4904e4628e2d8a4477db3b8012a8e16375b26292 (diff)
downloademacs-3ce82f979d5b229f1183107e0709f9fcc4385acc.tar.gz
Ed Reingold <reingold at emr.cs.iit.edu>
(calendar-current-date): Add an optional argument giving an offset from today.
Diffstat (limited to 'lisp/calendar/calendar.el')
-rw-r--r--lisp/calendar/calendar.el10
1 files changed, 7 insertions, 3 deletions
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\".