From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mirko Newsgroups: gmane.emacs.help Subject: Re: how to get calendar- for an offset day Date: Mon, 22 Dec 2008 20:24:34 -0800 (PST) Organization: http://groups.google.com Message-ID: <755b860d-d1c3-4bca-9565-5886bb61e458@e6g2000vbe.googlegroups.com> References: <8563lhv5yt.fsf@emr.cs.iit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1230007553 32259 80.91.229.12 (23 Dec 2008 04:45:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Dec 2008 04:45:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 23 05:47:01 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LEzAa-00031u-1N for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Dec 2008 05:47:00 +0100 Original-Received: from localhost ([127.0.0.1]:33735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LEz9N-0002sX-4O for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Dec 2008 23:45:45 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!e6g2000vbe.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: 208.218.238.20 Original-X-Trace: posting.google.com 1230006275 5740 127.0.0.1 (23 Dec 2008 04:24:35 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 23 Dec 2008 04:24:35 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e6g2000vbe.googlegroups.com; posting-host=208.218.238.20; posting-account=yS7ZzQoAAACbDncxMo9UeCyhsLtcDWPM User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165582 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60913 Archived-At: On Dec 18, 10:49=A0am, reing...@emr.cs.iit.edu (Edward M. Reingold) wrote: > >>>>> "M" =3D=3D Mirko =A0 writes: > > =A0 =A0 M> Hi, For a personal log, I use the `calendar-current-date' func= tion > =A0 =A0 M> together with calendar-date-display-form to insert the current= date > =A0 =A0 M> into the diary. =A0But sometimes I am lazy, or I forget, and I= need to > =A0 =A0 M> insert yesterday's date into the calendar. > > =A0 =A0 M> I did not find anything in calendar.el (but I might have misse= d it). > =A0 =A0 M> Any other options? > > This suggests an improvement to calendar.el. =A0Change the function > calendar-current-date to have an optional OFFSET: > > (defun calendar-current-date (&optional offset) > =A0 "Return the current date in a list (month day year). > Optional OFFSET is number of days from current date." > =A0 (let* ((now (decode-time))) > =A0 =A0 (calendar-gregorian-from-absolute > =A0 =A0 =A0(+ (calendar-absolute-from-gregorian > =A0 =A0 =A0 =A0 =A0(list (nth 4 now) (nth 3 now) (nth 5 now))) > =A0 =A0 =A0 =A0 (if offset offset 0))))) > > -- > > Professor Edward M. Reingold =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Email: reing.= ..@iit.edu > Department of Computer Science =A0 =A0 =A0 =A0 =A0 =A0 =A0Voice: (312) 56= 7-3309 > Illinois Institute of Technology =A0 =A0 =A0 =A0 =A0 =A0Fax: =A0 (312) 56= 7-5067 > Stuart Building, 228F > 10 West 31st Street > Chicago, IL =A060616-3729 =A0U.S.A. Thanks. I'll give it a shot. Mirko