emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pete Phillips <pete@smtl.co.uk>
To: Philipp Raschdorff <p.raschdorff@macnews.de>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Emacs-Calendar export to iCal/vcal
Date: Wed, 23 Aug 2006 23:15:21 +0100	[thread overview]
Message-ID: <11708.1156371321@lap1.smtl.co.uk> (raw)
In-Reply-To: Message from Philipp Raschdorff <p.raschdorff@macnews.de> of "Wed, 23 Aug 2006 22:46:59 +0200." <78B08AAF-5557-4770-AE7D-42DF67B2A0AB@macnews.de>

Hi Philipp

>>>>> "Philipp" == Philipp Raschdorff <p.raschdorff@macnews.de> writes:

    Philipp> realized that there is one thing missing for me:
    Philipp> synchronizing emacs-todos / appointments to iCal (Mac OS X
    Philipp> 10.4)

    Philipp> To make it easier: I really would like to have it one way:
    Philipp> Adding data from emacs to an iCal-file.

    Philipp> What do you think? Are you using the
    Philipp> emacs-calendar-functions and how to you synchronize to
    Philipp> other applications?

It just so happens that I have been playing around with this myself in
the last few days.

I'm not sure whether you want to sync the org-mode dated items, or items
from the emacs diary/calendar files - your last sentence tends to
suggest the latter, so...

I needed to be able to export my emacs diary file to an icalendar file
(which I assume Mac iCal supports ?) so that I could copy it to our
Intranet (our lab staff can then point SunBird or Evolution to the file
on the Intranet and see my appointments).

Now I use CVS emacs, which comes with icalendar.el - if you can't find
this on your system, you can google for it.  You need this for the ical
export function.

The basic command line version is this:

/usr/local/emacs-cvs/bin/emacs -batch  --eval "(icalendar-export-file \"/home/pete/diary\"  \"/home/pete/diary.ics\")" 

The 'diary' file is the file you edit in emacs (you may call it
something else of course) and the 'diary.ics' file is the exported
icalendar file.

A word of warning - I'd advise setting up a shellscript to do all the
work for you, as you need to make sure you remove the diary.ics file
first, otherwise it appends the dates to it each time you run it. This
means that you will end up with multiple entries for the same
appointment (in some applications which aren't fussy about the files
they slurp in), or it just won't import in others - Google calendar
being one. I couldn't understand how it worked once, and then Google
Calendar just kept complaining and aborting.  It was only when I saw the
ics file getting bigger each time that it dawned on me ....... :-(

So, to enable you to read it in iCal (I am a Mac ignoramus - excuse me
here) you will either need to be able to copy it to the Mac partition
from your GNU Linux/UNIX partition, or to copy the file to a web server
which you can access from your Mac iCal.

Making another assumption, I assume you can point iCal to a disk file to
import, or to add another calendar to your setup ?  With sunbird and
evolution, you can have multiple calendars, and toggle them on and off.

My shell script is appended. Hope this helps.

Now of course, it could be that you are using emacs under some M$
product or Mac O/S, in which case the shellscript itself will only be of
use to you in giving you an idea how to do what you need. I have no idea
whether you can do similar things under thos O/Ss.

Note - my application only pulls out appointments I have tagged
with :SMTL:, so my personal appointments stay private.  This is an added
level of complexity - you can delete the appropriate lines.

Final point - if I have misunderstood, and you need to get dated items
from your org-mode file, you will need to use something like this:

  /usr/local/emacs-cvs/bin/emacs  -batch  --eval "(org-export-icalendar-combine-agenda-files)"

Or one of the other org-mode icalendar export functions.  I managed to
get this to work once, but it doesn't create the file ~/org.ics for me
anymore. I'm sure Carsten will be able to sort this for you anyway, if
this is what you need.

All the best,
Pete

---------------sync-icalendar-to-apache.sh----------------------
#!/bin/sh

#####################################################################
# FUNCTION: grab all my SMTL appointments from my emacs diary file, #
# export to ical, then copy to SMTL Intranet server.                #
#####################################################################

################
### IMPORTANT###
#########################################################################
# This script needs to be run *after* running ssh-add at login, so that #
# the ssh transfers will occur without human intervention.              #
#########################################################################

###########################################################################
# I use my ~/.xinitrc to run ssh-add and then run an 'at' job to schedule #
# it to run at 3:30 every morning:                                        #
#                                                                         #
#    xterm -bg red -e ssh-add $HOME/.ssh/id_dsa                           #
#    echo /home/pete/bin/sync-icalendar-to-apache.sh | at 3:30            #
#                                                                         #
# 1 -  takes my ~/diary file (maintained in emacs)                        #
# 2 - greps out the SMTL only appointments into another emacs diary file, #
# 3 - then uses the icalendar export function to export to ical format.   #
# 4 - copies to our internal Intranet server file system                  #
#                                                                         #
###########################################################################

####################
# SET UP VARIABLES #
####################
DIARY_COMPLETE=/home/pete/diary
DIARY_SMTL=/home/pete/pete.smtl
ICAL_SMTL=/home/pete/pete.ics
ICAL_INTRANET=/data/htdocs/Calendars/pete.ics

##############################
# Must remove the old copies #
##############################
rm $ICAL_COMPLETE
rm $ICAL_SMTL

#################################################################################
# filter out all SMTL stuff only. the smtl file will only be SMTL appointments. #
#################################################################################
egrep ":SMTL:" < $DIARY_COMPLETE | sed 's/\:SMTL\://g' > $DIARY_SMTL

##############################
# export to icalendar format #
##############################
/usr/local/emacs-cvs/bin/emacs -batch  --eval "(icalendar-export-file \"$DIARY_SMTL\"  \"$ICAL_SMTL\")"

#########################################################################
# Now copy to the correct directory on the internal file server so that #
# users can point sunbird/evolution to:                                 #
# http://intranet.smtl.co.uk/Calendars/pete.ics                         #
#########################################################################
scp $ICAL_SMTL intranet.smtl.co.uk:$ICAL_INTRANET

#################################################
# Finally, set up another job for the next day. #
#################################################
echo /home/pete/bin/sync-icalendar-to-apache.sh | at 03:30

  parent reply	other threads:[~2006-08-23 22:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23 20:46 Emacs-Calendar export to iCal/vcal Philipp Raschdorff
2006-08-23 21:36 ` Carsten Dominik
2006-08-23 21:53   ` Piotr Zielinski
2006-08-23 22:45   ` Philipp Raschdorff
2006-08-24  6:36     ` Carsten Dominik
2006-08-23 22:15 ` Pete Phillips [this message]
2006-09-01 15:50 ` Carsten Dominik

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=11708.1156371321@lap1.smtl.co.uk \
    --to=pete@smtl.co.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=p.raschdorff@macnews.de \
    /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).