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 4I8hHusiomWfdwEAkFu2QA (envelope-from ) for ; Sat, 13 Jan 2024 06:43:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cLS4GOsiomUd4AAA62LTzQ (envelope-from ) for ; Sat, 13 Jan 2024 06:43:07 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lVgz32F3; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705124586; 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=6ZYtQJmbeDUhkJhlXxSfttls7ig/bbvnAEMY6fSEx6g=; b=g7eMSAoAW4P3E65q0ZZqp2yINSJLdfKGxDM65Iw6stuUux1uOZPPJuiSqCDcr3LP8ziHAr Ej5NADYhSS6/jOoStGAVTwqVNty3CqcEBWytOz5xD2p3Q1A2WWo2BV0pfBG2he0ASeWM8E upB1LBmbt1b21mVDDAn0yW0dmrbPnFK9TI61Iv4vH0EVFr35Ju6kIQwsbGM+53jeVS+CLV 2FDjJt00IsLd49vLfy4cK761RhEWn10IcEUAJTXSHtYW4DwLdePBpRVKHJIevP8b+Y0sCG /HwUI3B0x8o4zkhqT5fWrVtXILNLJzhVGIU5Y2/XsHtZBzrVjXsyN5Mx9Y+8RQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lVgz32F3; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705124586; a=rsa-sha256; cv=none; b=GMAAx/sdBRGooqOlxyBasKKgb49M4Z/zb71+kDL940sTS/tkOYZUhbUzL6j2MhOiPWqxHH whCx7GIa3BeT8FrcgrG8jkInXHcgILPsV35IAdnPfpRGvhrwEz9XyOTh2pCFvPTi4KrDbR /0zQ7EPA89HoviVwHQ5A6uhJbsjSNDxZkk0YgrMZkdb3yWyYA7lBEtXI4+6FxkPBSNTBKa l3xUDdBVJ8riDpMzusB60VSyfBiiOcXVTWt0qd50Rtms0XfPdndbF5uCaZ6c4cesUReqK2 qKMbbMVkTgjnsZXd1T6Z+WgPkxzqcR31rbuq24a/pV+dwsff60j8gdb+igJl+w== 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 49BE444C26 for ; Sat, 13 Jan 2024 06:43:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOWmR-0005da-55; Sat, 13 Jan 2024 00:42:03 -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 1rOWmP-0005d7-28 for emacs-orgmode@gnu.org; Sat, 13 Jan 2024 00:42:01 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOWmM-0007xi-HK for emacs-orgmode@gnu.org; Sat, 13 Jan 2024 00:42:00 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6db1bbfe67cso424683b3a.1 for ; Fri, 12 Jan 2024 21:41:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705124517; x=1705729317; darn=gnu.org; h=mime-version:user-agent:message-id:date:mail-followup-to:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6ZYtQJmbeDUhkJhlXxSfttls7ig/bbvnAEMY6fSEx6g=; b=lVgz32F3V33LesqPoekNcc/JZ6qwgZ26uwoN3ntd5t+YjJL6g/W3EUYLiXCbGm71f4 6JM91QmhOtGUj0BW20zo0XbU65OxVyl5KpPeHnOXFd2x4K0Wa+VZO6sb2TsUtfa8qeoV W+LkA5bzFEiOusk7GVIKoTm+3tw+twfxJpcCVtnS6sbu5BdEqYF3OtgrZcUpQje3+Dbf C70PWuVqJZZcDBhk2+0S/ecSVG9b5gyuUQKeec38/OnNJ8P09+c9RIMGJbQ+2Do3YQk8 1lMGRan3YO6p18Gebo6Xw8JVciarprapfTZlxFNsZmPOys2bNZBhZxgxLt4hHGJsibn0 3F1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705124517; x=1705729317; h=mime-version:user-agent:message-id:date:mail-followup-to:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ZYtQJmbeDUhkJhlXxSfttls7ig/bbvnAEMY6fSEx6g=; b=Pe319e9EvNFt2O4DyMsp0ys+U+oTbth/CcG80hF3ULgP+8R+BIHXLdqkTtvN0oI9iY C4YVcfqcWW8UlZ/Cqq5Bk0CBRouz64afj07cdY8XvgeJTwKEN+GHGXuGxn29cy2pkMkk f4bvybLCgAliVbCgPAatxhuys8dbCZf3wFUyhXBwcBSdzfkLHAusRe0geSKKzdxAhGih ALOLAKMtwojERacbehiKCLShgStIkihxOQcJtBfYUmOGX3wZtcAQH1Mo5Pp7Ljd9070n 1WHzc0SMz7kbzYXzHZ+YX7sTFiIKVfHCGq+YQmFFNcbKycOcCHvKQD4FtDTPnwGGSmSi zrbA== X-Gm-Message-State: AOJu0YwPqLfN2tq4Y6uh8AFvB7nU1cbUYAlPF6fyxMPKQPexw56RA21Z 1aJj3pbbNrkkob1rX38LMVM2ylurGYE= X-Google-Smtp-Source: AGHT+IFyJl92iDnY26zzOavJgstjCZXFuyxtJYF8JnYWtZNNX34zsjoi94EE7JwdT90LGOlKqJzi6w== X-Received: by 2002:a05:6a20:12cb:b0:196:d709:4cfc with SMTP id v11-20020a056a2012cb00b00196d7094cfcmr4423927pzg.6.1705124516857; Fri, 12 Jan 2024 21:41:56 -0800 (PST) Received: from localhost ([209.52.88.83]) by smtp.gmail.com with ESMTPSA id bn11-20020a056a00324b00b006d9aa4b65fasm4146182pfb.98.2024.01.12.21.41.56 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Jan 2024 21:41:56 -0800 (PST) From: David Rogers To: Ihor Radchenko Cc: Org-mode list Subject: Re: Diary sexp and comparing dates, agenda In-Reply-To: <87jzoenomm.fsf@localhost> (Ihor Radchenko's message of "Fri, 12 Jan 2024 23:00:33 +0000") References: <87jzoenomm.fsf@localhost> Mail-Followup-To: Ihor Radchenko , Org-mode list Date: Fri, 12 Jan 2024 21:41:42 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=davidandrewrogers@gmail.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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-Spam-Score: 0.78 X-Migadu-Queue-Id: 49BE444C26 X-Spam-Score: 0.78 X-Migadu-Scanner: mx11.migadu.com X-TUID: 2XVrYNcthsqX Ihor Radchenko writes: > 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. Thank you! It seems that `calendar-nth-named-absday' wants the year after the month, and then an (optional) day of the month to count from. Since I hoped to keep re-using this material every year without re-entering the calculations, I've tried the following: In my init file, I've added these two short definitions: (defun mf-beginning-of-advent (displayed-year) (calendar-nth-named-absday -4 0 12 displayed-year 24)) (defun mf-days-from-advent () (- (calendar-absolute-from-gregorian date) (mf-beginning-of-advent (calendar-extract-year date)))) And my Org file has this: * Example 1 <%%(and (= 245 (mf-days-from-easter)) (<= (mf-days-from-advent) -1))> This setup seems to work so far. Does it look reasonable to you? -- David