From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: reingold@emr.cs.iit.edu (Edward M. Reingold) Newsgroups: gmane.emacs.help Subject: Re: diary sexp question Date: 12 Dec 2005 20:31:45 -0600 Organization: Illinois Institute of Technology Message-ID: <85fyoxk9ri.fsf@emr.cs.iit.edu> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1134441375 10047 80.91.229.2 (13 Dec 2005 02:36:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Dec 2005 02:36:15 +0000 (UTC) Cc: bxf4@yahoo.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 13 03:36:08 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Em00I-0008H9-J1 for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Dec 2005 03:34:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Em00o-0007fm-A7 for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Dec 2005 21:35:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news.illinois.net!news.iit.edu!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 64 Original-NNTP-Posting-Host: emr.cs.iit.edu Original-X-Trace: condor2.cns.iit.edu 1134441107 27353 216.47.142.126 (13 Dec 2005 02:31:47 GMT) Original-X-Complaints-To: usenet@news.iit.edu Original-NNTP-Posting-Date: Tue, 13 Dec 2005 02:31:47 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:136305 Original-To: help-gnu-emacs@gnu.org 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:31923 Archived-At: >>>>> "b" == bxf4 writes: b> Hello, First, I'm not very knowledgeable about emacs lisp, but I'm b> working on it. I'm trying to create some weekly meetings (class times) b> in my diary and I'd like them to appear every TWThF through the end of b> the quarter. There are some examples in the documentation, but none have all the bells and whistles you ask for. The following applies to the last weekday of the month: &%%(let* ((month (extract-calendar-month date)) (day (extract-calendar-day date)) (year (extract-calendar-year date)) (last (calendar-last-day-of-month month year)) (dayname (calendar-day-of-week date))) (or (and (= day last) (memq dayname '(1 2 3 4 5))) (and (or (= day (1- last)) (= day (- last 2))) (= dayname 5)))) 8am Print pay stub b> I'd like a sexp that took the following arguments: - weekdays - times - b> range of dates for the appointments The following example uses the time and date, along with an optional parameter: (defmacro squash (month day year time &optional court) (` (squash-internal (, month) (, day) (, year) (quote (, time)) (, court)))) (defun squash-internal (month day year time &optional court) "Squash date with court reservation the day before." (let* ((d (if european-calendar-style month day)) (m (if european-calendar-style day month)) (game-date (list m d year)) (reservation-date (calendar-gregorian-from-absolute (- (calendar-absolute-from-gregorian game-date) (if (zerop (calendar-day-of-week game-date)) 2 1)))) (calendar-date-display-form '(month "/" day))) (if (calendar-date-equal date game-date) ;; Game on date (format "%s Squash (%s)" time entry) (if (and court (calendar-date-equal date reservation-date)) ;; Reserve court the day before (format "8am Reserve court at SPAC (491-4300, option 4): %s %s" time (calendar-date-string game-date)))))) If you can be more specific about what you are trying to do, I can be of more help. -- Professor Edward M. Reingold Email: reingold@iit.edu Chairman, Department of Computer Science Voice: (312) 567-3309 Illinois Institute of Technology Assistant: (312) 567-5152 Stuart Building Fax: (312) 567-5067 10 West 31st Street, Suite 236 Chicago, IL 60616-3729 U.S.A.