From: Russell Adams <RLAdams@AdamsInfoServ.Com>
To: emacs-orgmode <firstname.lastname@example.org>
Subject: Ical import in Emacs 27.1 core packages
Date: Thu, 13 Aug 2020 15:45:38 +0200 [thread overview]
Message-ID: <20200813134538.GA19268@maokai> (raw)
I've just upgraded to Emacs 27.1 and the latest Org
(9.3.7-18-g093b47-elpa). While reviewing my init.el I found I was
still depending on org-import-icalendar.el to import ics files.
The link on Worg for this file is broken, and I could not find a good
source. It's not in ELPA or MELPA, so I felt it was a dead end.
Instead I discovered that Emacs Gnus already has an icalendar importer
which includes some Org functions! I'm not sure when they were
introduced, but I wanted to share because it's a built-in.
In my init.el:
;; Import ical files
'("#" "Ical capture target" plain
:immediate-finish t :empty-lines 1))
(setq gnus-icalendar-org-template-key "#")
(defun rla-import-ical-to-org-capture (filename)
The key is to have a predefined org-capture template created for
Gnus. There is a function to create one for you, but I preferred to
make one by hand which is just a plain Org file with each new event
appended to the end of the file. The Agenda.org file is also in my
Then I added a simple wrapper function to import an external file into
a buffer for Gnus to save to Org. I think Gnus called it with a buffer
which already contained the ical attachment from the mail message it
was currently viewing.
Now in Mutt if I receive a calendar invite, I can use mailcap to
import it into Org.
text/calendar; emacsclient -e '(rla-import-ical-to-org-capture "%s")' ; copiousoutput
application/ics; emacsclient -e '(rla-import-ical-to-org-capture "%s")' ; copiousoutput
Please let me know if this works for anyone else. It may be worth
documenting on Worg.
Russell Adams RLAdams@AdamsInfoServ.com
PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/
Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
reply other threads:[~2020-08-13 13:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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
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).