emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] icalendar-import-file into org


From: Nick Dokos
Subject: Re: [O] icalendar-import-file into org
Date: Tue, 04 Jun 2013 09:07:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

AW <address@hidden> writes:

> I'd like to have an external calendar file displayed in org and was very glad 
> to find a hint in the manual. The name of the external calendar file is 
> "office.ics".
>
> So I wrote into my .emacs-file:
>
> (icalendar-import-file "office.ics" "Diary")
> (setq org-agenda-include-diary t)
>
> As you can imagine, that caused an import of "office.ics" _every_ time I 
> started 
> Emacs. So I ended with a huge calendar file full of (no, not stars)[1] 
> repetitions of "office.ics".
>

You can import the ics file into some temporary diary and
delete the temporary diary upon exit from emacs:

--8<---------------cut here---------------start------------->8---
(setq tmp-diary (make-temp-file "diary"))
(icalendar-import-file "/path/to/office.ics" tmp-diary)

;; make it the default...
(setq diary-file tmp-diary)
;; so that org-agenda can find it
(setq org-agenda-include-diary t)

;; delete the tmp diary on exit
(add-to-list 'kill-emacs-hook 
             (function
              (lambda ()
                (delete-file tmp-diary))))
--8<---------------cut here---------------end--------------->8---

That assumes that you don't have any other diary files
that you are interested in including. If you do, the basic
idea will still work but will require more fiddling.

Untested.
-- 
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]