]> git.eshelyaron.com Git - emacs.git/commitdiff
Ed Reingold <reingold at emr.cs.iit.edu>
authorGlenn Morris <rgm@gnu.org>
Wed, 8 Jul 2009 02:46:23 +0000 (02:46 +0000)
committerGlenn Morris <rgm@gnu.org>
Wed, 8 Jul 2009 02:46:23 +0000 (02:46 +0000)
(calendar-current-date): Add an optional argument giving an offset from today.

lisp/ChangeLog
lisp/calendar/calendar.el

index 27d9f28702a6d4773ff1e768d90b695d00e26bf5..354580577c595340fd5219d7831d7471ebe9609d 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-08  Ed Reingold  <reingold@emr.cs.iit.edu>
+
+       * calendar/calendar.el (calendar-current-date):
+       Add an optional argument giving an offset from today.
+
 2009-07-08  Glenn Morris  <rgm@gnu.org>
 
        * tutorial.el (tutorial--describe-nonstandard-key):
index 47bf62fa06a91426c400c5497bb2d444ad4e8161..4ec820dd20b3eb6dd131caeb6d6ab791a8f4fbd5 100644 (file)
@@ -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\".