diff options
| author | Glenn Morris | 2009-07-08 02:46:23 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-07-08 02:46:23 +0000 |
| commit | 3ce82f979d5b229f1183107e0709f9fcc4385acc (patch) | |
| tree | a4d6ae6ff88110586515eeacd14d814cd518f59c | |
| parent | 4904e4628e2d8a4477db3b8012a8e16375b26292 (diff) | |
| download | emacs-3ce82f979d5b229f1183107e0709f9fcc4385acc.tar.gz emacs-3ce82f979d5b229f1183107e0709f9fcc4385acc.zip | |
Ed Reingold <reingold at emr.cs.iit.edu>
(calendar-current-date): Add an optional argument giving an offset from today.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2009-07-08 Ed Reingold <reingold@emr.cs.iit.edu> | ||
| 2 | |||
| 3 | * calendar/calendar.el (calendar-current-date): | ||
| 4 | Add an optional argument giving an offset from today. | ||
| 5 | |||
| 1 | 2009-07-08 Glenn Morris <rgm@gnu.org> | 6 | 2009-07-08 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * tutorial.el (tutorial--describe-nonstandard-key): | 8 | * 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." | |||
| 1784 | (t (set-buffer buffer) | 1784 | (t (set-buffer buffer) |
| 1785 | (bury-buffer)))))) | 1785 | (bury-buffer)))))) |
| 1786 | 1786 | ||
| 1787 | (defun calendar-current-date () | 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). |
| 1789 | Optional OFFSET is number of days from current date." | ||
| 1789 | (let ((now (decode-time))) | 1790 | (let ((now (decode-time))) |
| 1790 | (list (nth 4 now) (nth 3 now) (nth 5 now)))) | 1791 | (calendar-gregorian-from-absolute |
| 1792 | (+ (calendar-absolute-from-gregorian | ||
| 1793 | (list (nth 4 now) (nth 3 now) (nth 5 now))) | ||
| 1794 | (if offset offset 0))))) | ||
| 1791 | 1795 | ||
| 1792 | (defun calendar-column-to-segment () | 1796 | (defun calendar-column-to-segment () |
| 1793 | "Convert current column to calendar month \"segment\". | 1797 | "Convert current column to calendar month \"segment\". |