From: Richard Lawrence <richard.lawrence@uni-tuebingen.de>
To: David Rogers <davidandrewrogers@gmail.com>,
Org-mode list <emacs-orgmode@gnu.org>
Subject: Re: Turn Emacs holidays into Org appointments?
Date: Mon, 07 Feb 2022 21:41:39 +0100 [thread overview]
Message-ID: <87fsoutnng.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <s0eo83ilcdd.fsf@gmail.com>
Hi David and all,
David Rogers <davidandrewrogers@gmail.com> writes:
> Is there a way that I can use something like the Emacs holiday
> forms ... but from inside an Org-mode appointment timestamp
Yes, this should be possible.
> Here's a mock example of what I'm trying to do:
>
> * Easter
> <(holiday-easter-etc 0)>
> ** stuff for Easter
>
> * The Sunday after Easter
> <(holiday-easter-etc 7)>
> ** stuff for after Easter
Actually, you're pretty close already.
Org understands diary sexp entries in timestamps, and diary sexp entries
basically allow arbitrary elisp, so you should be able to use the diary
functions in combination with the holiday functions to do what you want.
See the 'Timestamps' entry in the Org manual, and the 'Special Diary
Entries' entry in the Emacs manual, for more.
Here is a quick and dirty proof of concept; see if it works for you:
* The Sunday after Easter
<%%(apply #'diary-date (caar (holiday-easter-etc 7)))>
The angle brackets tell Org this is a timestamp. The '%%' says that the
following sexp is a diary sexp. And the code inside it feeds the (M D Y)
date representation returned by holiday-easter-etc into diary-date.
You may need to fiddle with this a bit...holiday-easter-etc is a bit too
closely tied to the calendar (it depends on a couple of calendar
variables, displayed-year and displayed-month, that cannot be
dynamically bound). But you could create your own version that doesn't
have this limitation.
Hope that helps.
--
Best,
Richard
prev parent reply other threads:[~2022-02-07 20:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 19:12 Turn Emacs holidays into Org appointments? David Rogers
2022-02-07 20:41 ` Richard Lawrence [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsoutnng.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me \
--to=richard.lawrence@uni-tuebingen.de \
--cc=davidandrewrogers@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).