From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Maier Subject: Last workday of the month Date: Sat, 30 Oct 2010 14:55:57 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=44087 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCGat-0001WS-RO for emacs-orgmode@gnu.org; Sat, 30 Oct 2010 14:56:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCGas-0000hh-MS for emacs-orgmode@gnu.org; Sat, 30 Oct 2010 14:55:59 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:43823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCGas-0000hV-Hs for emacs-orgmode@gnu.org; Sat, 30 Oct 2010 14:55:58 -0400 Received: by pwi1 with SMTP id 1so1867340pwi.0 for ; Sat, 30 Oct 2010 11:55:57 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I'm trying to come up with a sexp diary entry that shows my payday, which is the last weekday of the month, in my Org agenda. I've tried to adapt the example given in the Emacs manual and this is what I came up with: %%(let ((month (car date)) (day (cadr date)) (dayname (calendar-day-of-week date))) (or ;; months with 31 days (and (memq month '(1 3 5 7 8 10 12)) (or (and (= day 31) (memq dayname '(1 2 3 4 5))) (and (memq day '(29 30)) (= dayname 5)))) ;; months with 30 days (and (memq month '(4 6 9 11)) (or (and (= day 30) (memq dayname '(1 2 3 4 5))) (and (memq day '(28 29)) (= dayname 5)))) ;; February (the weird one) (and (= month 2) (or (and (memq day '(28 29)) (memq dayname '(1 2 3 4 5))) (and (memq day '(26 27 28)) (= dayname 5)))))) Chris' Paycheck Deposited It appears to work so far. However, I'm certain there's got to be a more concise way of coding this, but I can't seem to find any pre-existing calendar functions that might help. Am I missing something? To make this even better, is there some way to consult another file of diary entries containing all the holidays at my workplace, so the diary entry would show up on the last weekday of the month that is not a company holiday? Thanks! Chris