From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pete Phillips Subject: Re: Emacs-Calendar export to iCal/vcal Date: Wed, 23 Aug 2006 23:15:21 +0100 Message-ID: <11708.1156371321@lap1.smtl.co.uk> References: <78B08AAF-5557-4770-AE7D-42DF67B2A0AB@macnews.de> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GG10c-0000k9-Lv for emacs-orgmode@gnu.org; Wed, 23 Aug 2006 18:15:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GG10Y-0000jT-A5 for emacs-orgmode@gnu.org; Wed, 23 Aug 2006 18:15:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GG10Y-0000jQ-3R for emacs-orgmode@gnu.org; Wed, 23 Aug 2006 18:15:34 -0400 Received: from [193.131.77.174] (helo=mailhost.smtl.co.uk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GG18S-00088N-RP for emacs-orgmode@gnu.org; Wed, 23 Aug 2006 18:23:45 -0400 In-Reply-To: Message from Philipp Raschdorff of "Wed, 23 Aug 2006 22:46:59 +0200." <78B08AAF-5557-4770-AE7D-42DF67B2A0AB@macnews.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Philipp Raschdorff Cc: emacs-orgmode Hi Philipp >>>>> "Philipp" == Philipp Raschdorff 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