From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tim O'Callaghan" Subject: Re: iCal Import - updated code & Bug report Date: Wed, 20 Jun 2007 00:52:28 +0200 Message-ID: <3d6808890706191552n30e3bc2er7c5701f0f38559ac@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I0mZT-0000kE-KE for emacs-orgmode@gnu.org; Tue, 19 Jun 2007 18:53:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I0mZQ-0000jy-67 for emacs-orgmode@gnu.org; Tue, 19 Jun 2007 18:53:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0mZQ-0000jv-0s for emacs-orgmode@gnu.org; Tue, 19 Jun 2007 18:53:08 -0400 Received: from wr-out-0506.google.com ([64.233.184.225]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I0mZL-0000FH-QL for emacs-orgmode@gnu.org; Tue, 19 Jun 2007 18:53:06 -0400 Received: by wr-out-0506.google.com with SMTP id 55so1417257wri for ; Tue, 19 Jun 2007 15:52:29 -0700 (PDT) Content-Disposition: inline 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: emacs-orgmode Another Xemacs bug i think, If the org file does not contain a line with a headline, such as those generated by the code. It causes the error: "(1) (error/warning) Error in `post-command-hook' (setting hook to nil): (wrong-type-argument integer-or-marker-p nil)" The previous code assumes the ical export worked, below fixes that. Tim. ---- code ---- (defun toc:goggle-to-org () "get a google calendar and convert it into org dates" (interactive) (with-temp-buffer (let* ((glist google-ical-org-list)) ;; iterate through list (while (setq entry (pop glist)) (setq google-ical-url (car entry) local-ical-file (nth 1 entry) local-date-file (nth 2 entry)) ;; Delete the diary local files (if (file-exists-p local-ical-file) (delete-file local-ical-file)) (if (file-exists-p local-date-file) (delete-file local-date-file)) ;; Get ical file (w3-download-url google-ical-url (expand-file-name local-ical-file)) ;; convert to diary without leading & (icalendar-import-file local-ical-file local-date-file t) ;; iCalendar leaves the buffers open (if (find-buffer-visiting local-date-file) (kill-buffer (find-buffer-visiting local-date-file))) (if (find-buffer-visiting local-ical-file) (kill-buffer (find-buffer-visiting local-ical-file))) )))) --- code ---