From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giovanni Ridolfi Subject: Re: "Last workday of month" scheduling Date: Fri, 15 Oct 2010 15:39:19 +0200 Message-ID: <83k4ljini0.fsf@yahoo.it> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=59949 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6kVH-0006Wh-EK for emacs-orgmode@gnu.org; Fri, 15 Oct 2010 09:39:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6kVG-0001cR-7H for emacs-orgmode@gnu.org; Fri, 15 Oct 2010 09:39:23 -0400 Received: from slim-2c.inet.it ([213.92.5.123]:40418) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6kVF-0001bu-Rk for emacs-orgmode@gnu.org; Fri, 15 Oct 2010 09:39:22 -0400 In-Reply-To: ("Gustav =?utf-8?Q?Wikstr=C3=B6m=22's?= message of "Fri, 15 Oct 2010 09:00:25 +0200") 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: Gustav =?utf-8?Q?Wikstr=C3=B6m?= Cc: emacs-orgmode@gnu.org Gustav Wikstr=C3=B6m writes: Hi Gustav,=20 > Is there a way in Org-mode to schedule a task so it appears the last > workday (i.e. not Saturday or Sunday) of the month, each month? Yes, with a sexp diary entry ** a task SCHEDULED: <%%(diary-float [some-function])> To find how [some-function] could be written, you can be inspired by the one in Emacs manual: 38.15.9 Sexp Entries and the Fancy Diary Display Suppose you get paid on the 21st of the month if it is a weekday, and on the Friday before if the 21st is on a weekend. Here is how to write a sexp diary entry that matches those dates: &%%(let ((dayname (calendar-day-of-week date)) (day (cadr date))) (or (and (=3D day 21) (memq dayname '(1 2 3 4 5))) (and (memq day '(19 20)) (=3D dayname 5))) ) Pay check deposited Giovanni