aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-07-08 02:48:11 +0000
committerGlenn Morris2009-07-08 02:48:11 +0000
commit7ef5b8b271f05ff987e0a2ed498ba25cfa586739 (patch)
tree9cff9424c77de2fa54758c908388825cef106647
parent3ce82f979d5b229f1183107e0709f9fcc4385acc (diff)
downloademacs-7ef5b8b271f05ff987e0a2ed498ba25cfa586739.tar.gz
emacs-7ef5b8b271f05ff987e0a2ed498ba25cfa586739.zip
(calendar-current-date): Rework previous change.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/calendar/calendar.el13
2 files changed, 11 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 354580577c5..14c922845cb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12009-07-08 Glenn Morris <rgm@gnu.org>
2
3 * calendar/calendar.el (calendar-current-date): Rework previous change.
4
12009-07-08 Ed Reingold <reingold@emr.cs.iit.edu> 52009-07-08 Ed Reingold <reingold@emr.cs.iit.edu>
2 6
3 * calendar/calendar.el (calendar-current-date): 7 * calendar/calendar.el (calendar-current-date):
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 4ec820dd20b..d601cf6a22c 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1786,12 +1786,13 @@ the STRINGS are just concatenated and the result truncated."
1786 1786
1787(defun calendar-current-date (&optional offset) 1787(defun calendar-current-date (&optional offset)
1788 "Return the current date in a list (month day year). 1788 "Return the current date in a list (month day year).
1789Optional OFFSET is number of days from current date." 1789Optional integer OFFSET is a number of days from the current date."
1790 (let ((now (decode-time))) 1790 (let* ((now (decode-time))
1791 (calendar-gregorian-from-absolute 1791 (now (list (nth 4 now) (nth 3 now) (nth 5 now))))
1792 (+ (calendar-absolute-from-gregorian 1792 (if (zerop (or offset 0))
1793 (list (nth 4 now) (nth 3 now) (nth 5 now))) 1793 now
1794 (if offset offset 0))))) 1794 (calendar-gregorian-from-absolute
1795 (+ offset (calendar-absolute-from-gregorian now))))))
1795 1796
1796(defun calendar-column-to-segment () 1797(defun calendar-column-to-segment ()
1797 "Convert current column to calendar month \"segment\". 1798 "Convert current column to calendar month \"segment\".