Mercurial > emacs
comparison lisp/calendar/calendar.el @ 103770:564ef05eedbc
Ed Reingold <reingold at emr.cs.iit.edu>
(calendar-current-date): Add an optional argument giving an offset from today.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 08 Jul 2009 02:46:23 +0000 |
parents | 3206ad427d3c |
children | 06bd6035d548 |
comparison
equal
deleted
inserted
replaced
103769:39e38bc3d6d0 | 103770:564ef05eedbc |
---|---|
1782 ((not (and (select-window window) (one-window-p window))) | 1782 ((not (and (select-window window) (one-window-p window))) |
1783 (delete-window window)) | 1783 (delete-window window)) |
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\". |
1794 The left-most month returns 0, the next right 1, and so on." | 1798 The left-most month returns 0, the next right 1, and so on." |
1795 (let ((col (max 0 (+ (current-column) | 1799 (let ((col (max 0 (+ (current-column) |