From: david.goldberg6@verizon.net (Dave Goldberg)
To: ding@gnus.org
Subject: Re: icalendar.el and gnus.
Date: Thu, 29 Nov 2012 22:21:39 -0500 [thread overview]
Message-ID: <8438zrbwsc.fsf@davestoy.homelinux.org> (raw)
In-Reply-To: <87obih4a6q.fsf@mat.ucm.es> (Uwe Brauer's message of "Wed, 28 Nov 2012 23:47:09 +0100")
> Hello
> I have 2 problems with icalendar.el (I contacted the author,
> but since he did not reply yet, I thought maybe someone else
> has some experience).
> The first problem concerns how to automatically call the
> icalendar import function (which imports an icalendar event
> to the diary) when opening a message.
> I used
> (setq gnus-article-mime-part-function 'icalendar-import-buffer)
> but then I obtain an error which I attach.
I use the following. The only thing I remember about it was the need to deal with uuencoded calendar entries; I don't recall any other error. Don't use it verbatim. I have hardcoded destination file names in it.
(defun dsg-icalendar-handle-part (handle)
(when (equal (car (mm-handle-type handle)) "text/calendar")
(with-temp-buffer
(insert (mm-get-part handle))
(if (equal (mm-handle-encoding handle) 'uuencode)
(uudecode-decode-region-internal (point-min) (point-max)))
(goto-char (point-min))
(let* ((e
(car (icalendar--all-events (icalendar--read-element nil nil))))
(subject (icalendar--convert-string-for-import
(or (icalendar--get-event-property e 'SUMMARY)
"No Subject")))
(dtstart (icalendar--get-event-property e 'DTSTART))
(dtstart-dec (icalendar--decode-isodatetime dtstart))
(start-d (icalendar--datetime-to-diary-date dtstart-dec))
(start-t (icalendar--datetime-to-colontime dtstart-dec))
(repq (icalendar--get-event-property e 'RRULE)))
(if (y-or-n-p
(format
"Add %s for \"%s\" on %s at %s to diary? "
(if repq "repeating event" "appointment")
subject start-d start-t))
(icalendar-import-buffer
(expand-file-name (if repq "~/repeating-diary"
"~/ical-diary")) t nil))))))
(setq gnus-article-mime-part-function 'dsg-icalendar-handle-part)
--
Dave Goldberg
david.goldberg6@verizon.net
next prev parent reply other threads:[~2012-11-30 3:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-28 22:47 Uwe Brauer
2012-11-30 3:21 ` Dave Goldberg [this message]
2012-11-30 14:24 ` coding problem UTF8 (was: icalendar.el and gnus.) Uwe Brauer
2012-11-30 21:29 ` [SOLVED] (was: coding problem UTF8) Uwe Brauer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8438zrbwsc.fsf@davestoy.homelinux.org \
--to=david.goldberg6@verizon.net \
--cc=ding@gnus.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.
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 NNTP newsgroup(s).