]> git.eshelyaron.com Git - emacs.git/commitdiff
(calendar-current-date): Rework previous change.
authorGlenn Morris <rgm@gnu.org>
Wed, 8 Jul 2009 02:48:11 +0000 (02:48 +0000)
committerGlenn Morris <rgm@gnu.org>
Wed, 8 Jul 2009 02:48:11 +0000 (02:48 +0000)
lisp/ChangeLog
lisp/calendar/calendar.el

index 354580577c595340fd5219d7831d7471ebe9609d..14c922845cb85d6812e7643d02d51b06326abf16 100644 (file)
@@ -1,3 +1,7 @@
+2009-07-08  Glenn Morris  <rgm@gnu.org>
+
+       * calendar/calendar.el (calendar-current-date): Rework previous change.
+
 2009-07-08  Ed Reingold  <reingold@emr.cs.iit.edu>
 
        * calendar/calendar.el (calendar-current-date):
index 4ec820dd20b3eb6dd131caeb6d6ab791a8f4fbd5..d601cf6a22c6706fad778a4043afba9d9dd64aff 100644 (file)
@@ -1786,12 +1786,13 @@ the STRINGS are just concatenated and the result truncated."
 
 (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\".