* icalendar.el and gnus.
@ 2012-11-28 22:47 Uwe Brauer
2012-11-30 3:21 ` Dave Goldberg
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Brauer @ 2012-11-28 22:47 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 575 bytes --]
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.
The other question is not really gnus specific:
when I call icalendar-export-region the Location and
Organizer are not exported.
Thanks
Uwe Brauer
[-- Attachment #2: bug-icalendar --]
[-- Type: application/octet-stream, Size: 1881 bytes --]
Debugger entered--Lisp error: (wrong-type-argument stringp (#<buffer " *mm*<3>"> ("text/plain" (charset . "UTF-8")) 7bit nil nil nil nil nil))
get-file-buffer((#<buffer " *mm*<3>"> ("text/plain" (charset . "UTF-8")) 7bit nil nil nil nil nil))
find-buffer-visiting((#<buffer " *mm*<3>"> ("text/plain" (charset . "UTF-8")) 7bit nil nil nil nil nil))
icalendar--convert-ical-to-diary(((VCALENDAR nil (... ... ...) (... ...)) (VCALENDAR nil (... ... ...) (... ...))) (#<buffer " *mm*<3>"> ("text/plain" (charset . "UTF-8")) 7bit nil nil nil nil nil) nil nil)
icalendar-extract-ical-from-buffer((#<buffer " *mm*<3>"> ("text/plain" (charset . "UTF-8")) 7bit nil nil nil nil nil))
gnus-mime-part-function((#<buffer " *mm*<3>"> ("text/plain" (charset . "UTF-8")) 7bit nil nil nil nil nil))
mapcar(gnus-mime-part-function ((#<buffer " *mm*<3>"> ("text/plain" ...) 7bit nil nil nil nil nil) (#<buffer " *mm*<4>"> ("text/calendar" ... ...) 8bit nil nil nil nil nil)))
gnus-mime-part-function(("multipart/alternative" (#<buffer " *mm*<3>"> ("text/plain" ...) 7bit nil nil nil nil nil) (#<buffer " *mm*<4>"> ("text/calendar" ... ...) 8bit nil nil nil nil nil)))
mapcar(gnus-mime-part-function (("multipart/alternative" (#<buffer " *mm*<3>"> ... 7bit nil nil nil nil nil) (#<buffer " *mm*<4>"> ... 8bit nil nil nil nil nil)) (#<buffer " *mm*<5>"> ("application/ics" ...) 8bit nil ("attachment" ...) nil nil nil)))
gnus-mime-part-function(("multipart/mixed" ("multipart/alternative" (#<buffer " *mm*<3>"> ... 7bit nil nil nil nil nil) (#<buffer " *mm*<4>"> ... 8bit nil nil nil nil nil)) (#<buffer " *mm*<5>"> ("application/ics" ...) 8bit nil ("attachment" ...) nil nil nil)))
gnus-display-mime()
gnus-article-prepare-display()
gnus-article-prepare(9109 nil)
gnus-summary-display-article(9109)
gnus-summary-next-page(nil)
call-interactively(gnus-summary-next-page)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: icalendar.el and gnus.
2012-11-28 22:47 icalendar.el and gnus Uwe Brauer
@ 2012-11-30 3:21 ` Dave Goldberg
2012-11-30 14:24 ` coding problem UTF8 (was: icalendar.el and gnus.) Uwe Brauer
0 siblings, 1 reply; 4+ messages in thread
From: Dave Goldberg @ 2012-11-30 3:21 UTC (permalink / raw)
To: ding
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* coding problem UTF8 (was: icalendar.el and gnus.)
2012-11-30 3:21 ` Dave Goldberg
@ 2012-11-30 14:24 ` Uwe Brauer
2012-11-30 21:29 ` [SOLVED] (was: coding problem UTF8) Uwe Brauer
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Brauer @ 2012-11-30 14:24 UTC (permalink / raw)
To: ding
>> On Thu, 29 Nov 2012 22:21:39 -0500,
>> david.goldberg6@verizon.net (Dave Goldberg) wrote:
>> Hello
> (defun dsg-icalendar-handle-part (handle)
[snip]
> (setq gnus-article-mime-part-function 'dsg-icalendar-handle-part)
Thanks that works nicely, save the coding problem. That is
when use space to display the message, the minibuffer
displays.
Add appointment for "Seminario Matemática Aplicada" on 12 5 2012 at 11:00 to diary? (y or n) No
When I answer with y, the appointment is inserted but like
this:
12/5/2012 11:00-12:00 Seminario Matemática Aplicada
Desc: Jan Cholewa. Silesian, University, Katowice, Poland.
"On the equi-exponential attraction and rate of convergence of attractors"
Organizado por el Departamento de Matemática Aplicada
con la colaboración del Grupo de Investigación UCM
"Comportamiento Asintótico y Dinámica de Ecuaciones
Diferenciales" (CADEDIF).
View your event at http://www.google.com/calendar/event?action=VIEW&eid=cGdnaGVsNDVobGxrNXF2MW81azcyOG9oaXMgb3ViQG1hdC51Y20uZXM&tok=MjEjb3ViLm91Yi5vdWJAZ21haWwuY29tZTcyYzhjZTg5YmUwNTBkYzVjMjZiNDMzZjM2YzFkNzYwNGZmZjg3ZQ&ctz=Europe/Madrid&hl=en.
Location: Seminario Alberto Dou (aula 209)
Organizer: mailto:oub.oub.oub@gmail.com
I hope the bad encoded UTF8 chars reach the group
I have á etc instead of à
So I have to run
(decode-coding-region start end 'utf-8 nil)
When I answer the question with NO and then call the
icalendar-import-buffer manually the coding is fine!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [SOLVED] (was: coding problem UTF8)
2012-11-30 14:24 ` coding problem UTF8 (was: icalendar.el and gnus.) Uwe Brauer
@ 2012-11-30 21:29 ` Uwe Brauer
0 siblings, 0 replies; 4+ messages in thread
From: Uwe Brauer @ 2012-11-30 21:29 UTC (permalink / raw)
To: ding
> I hope the bad encoded UTF8 chars reach the group
> I have á etc instead of à
> So I have to run
> (decode-coding-region start end 'utf-8 nil)
The following modification works for me:
(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))
(decode-coding-region (point-min) (point-max) 'utf-8 nil)
(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))))))
Uwe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-30 21:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-28 22:47 icalendar.el and gnus Uwe Brauer
2012-11-30 3:21 ` Dave Goldberg
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
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).