From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AOHRCxTEoWXhswAAkFu2QA (envelope-from ) for ; Fri, 12 Jan 2024 23:58:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id qL2dBhTEoWUsHQAA62LTzQ (envelope-from ) for ; Fri, 12 Jan 2024 23:58:28 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=hli8luAO; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705100307; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Yz0tsBo0/1pDl/wqy4RZcgsuROah0xETYShL4kWphX0=; b=WPt+RcW0ootUsC+CUPxioqrlQe11gXcEjRsqdg/5MPr0PduWS6At1nQwOy2ZkMCXXAje4F iVjeoMtgynrHe4VmPq5PrpieS/cwHp4QjKMzMUmjW2X6zsWkEflLJ74B+R7ojyPk64DznW njGVtY4N+OLhkQh8qQUM0dKwF7AEvZcwEdGIxEtb6znAXELix1RB7yEs1KJO/hy3S/UFHS zaIt99DY4Hk0kuNlCmqK35rhcR5U8rnSpnZ7SV8AUjPVjxwQ55t+6VPHmmHh5BagTO00yC 8r5+xtb/Qgf5fsyugaU4OrQ7NMTh+gld3Psst1zpdWlw7fxqyYIjF+WGRaG2Fg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705100307; a=rsa-sha256; cv=none; b=PyWLXLPkmVIKc+DG7nq83+dnvVF1bBZyD6lxsd7u8VwA0Suuzl691sG/SFzzIWMtde4pIy a/7rUgGKiiGKTT+LWcHIWPx6v1fFsIDzjd7Si7DqJEPTysHiy7SVxQB53X2mWWsgAO5rgl fzharT4yBfGx5heFA8gZ/Gazjk3LwKrIGMTgmgjestjX3v8nrHObLf2KQjRwv6I5ISdFB7 nndHThCL6hOH8KQwpFVQOuh1WTPm4nzY9UCBFt2piiDROABSbKQqAdu5I60TVqVbhiCfdk tdRPbcmzdXMgHUyNHgtJhmICQQ2JoGO+pnY5a5x5jP+4ipo+iq4jUuKn9V1CiA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=hli8luAO; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DE125DC3A for ; Fri, 12 Jan 2024 23:58:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOQSz-0006K0-4o; Fri, 12 Jan 2024 17:57:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOQSw-0006Jl-PX for emacs-orgmode@gnu.org; Fri, 12 Jan 2024 17:57:31 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOQSu-0001zb-Cl for emacs-orgmode@gnu.org; Fri, 12 Jan 2024 17:57:30 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id C748A240101 for ; Fri, 12 Jan 2024 23:57:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705100244; bh=nGfBpyQKQDDrgXOaTCZ6TqneWrbe6lped5hPMmmMI9U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=hli8luAOUedYm+8a+Oyvu5kbuL3TBGjZzNSMIHSeAF4rSvrslSZ0Z5dkKCMtu3u02 5m9lyC1OzBBgm4MMVVNkq+jSgWjzp11McBi2rDVwluNRuDG/AR/P8EExzkqwmUhezc 83swC+tOt1nqvtao4jjnHgGNu0JS0cwLBLXB6L7p0VyP8G0tmOGtwmIp+3dEegbCM0 51HBWGmrtMpiYlKBW/MO1H6k3eRQwCxh2D0ZlqB+XMSXAI/Yq6wwMShpVIlA+YcQ2h l8V5v0mjtuSyJ3G9jEyx3nFOWNzzZPtmYC8sGtG33o7RIhFZ/OqIBGgJVOO1snfinD 9mERm9iiDAk6Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TBcPJ1xFFz6tvs; Fri, 12 Jan 2024 23:57:24 +0100 (CET) From: Ihor Radchenko To: David Rogers Cc: Org-mode list Subject: Re: Diary sexp and comparing dates, agenda In-Reply-To: References: Date: Fri, 12 Jan 2024 23:00:33 +0000 Message-ID: <87jzoenomm.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -2.09 X-Spam-Score: -2.09 X-Migadu-Queue-Id: DE125DC3A X-TUID: obusQkUw7u59 David Rogers writes: > * Example 1 > <%%(= 245 (mf-days-from-easter))> > > because "mf-days-from-easter" is defined in my init file, along > with the definition of Easter itself. This does what it looks like > it should do; this year, Example 1 is shown on December 1. > > And I can do > > * Example 2 > <%%(and (diary-float 1 0 5 7) (<= (mf-days-from-easter) -56))> > > to say "five Sundays after January 6th, but only if Easter is > still 8 weeks away or more". > > But Example 1 isn't quite finished, because that date is too close > to Christmas. I can easily show a diary sexp defining when "too > close to Christmas" is: > > <%%(diary-float 12 0 -4 24)> > > So I want to combine these ideas, to say "Show Example 1 in the > agenda 245 days after Easter each year, but only if it's earlier > than the fourth Sunday before Christmas". You don't need diary-float - it returns true/false whether current DATE fits the arguments. Instead, you can make use of `calendar-nth-named-absday'. For example, <%%(and (= 245 (mf-days-from-easter)) (< (calendar-absolute-from-gregorian date) (calendar-nth-named-absday -4 0 12 24)))> Diary sexps are nothing but ordinary Elisp, with an extra twist that during evaluation `date' variable is bound to current calendar date. When they return nil, DATE does not match. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at