From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4Mg/DeVENV/ILwAA0tVLHw (envelope-from ) for ; Thu, 13 Aug 2020 13:49:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mE0vCeVENV8eeAAAB5/wlQ (envelope-from ) for ; Thu, 13 Aug 2020 13:49:25 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B0AF3940215 for ; Thu, 13 Aug 2020 13:49:23 +0000 (UTC) Received: from localhost ([::1]:60426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Dbd-0001AA-W7 for larch@yhetil.org; Thu, 13 Aug 2020 09:49:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Db8-00019w-FK for emacs-orgmode@gnu.org; Thu, 13 Aug 2020 09:48:50 -0400 Received: from se16.route25.eu ([185.95.31.95]:37284) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Db4-0005Hn-OS for emacs-orgmode@gnu.org; Thu, 13 Aug 2020 09:48:49 -0400 Date: Thu, 13 Aug 2020 15:45:38 +0200 From: Russell Adams To: emacs-orgmode Subject: Ical import in Emacs 27.1 core packages Message-ID: <20200813134538.GA19268@maokai> Mail-Followup-To: emacs-orgmode MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Originating-IP: 185.87.184.57 X-SpamExperts-Domain: out.pcextreme.nl X-SpamExperts-Username: 185.87.184.57 X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.15) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0X2OOYwfFINEXkW0Te3GMuqpSDasLI4SayDByyq9LIhVUZbR67CQ7/vm /hHDJU4RXkTNWdUk1Ol2OGx3IfrIJKywOmJyM1qr8uRnWBrbSAGDLZy6c0DmV/7RK6letuHor9Q5 3pMmTXeVbblO3cSIiVD7E/CO/MtR/XjEgoUlABgVJODXbtOodkPED+RkHjVGH9gpfPe2lDQBFQc5 pWKjU8U1TnR+f0U9cu064nZcMieLAqdkk6hppCDsqsBwLjHur1XxB26GtR7aQdGQ3RxVouvcHykr Pyl3nQdByUhCbiQvaHwJ2eESrUp0Iw/gSJ3HqMuR600P9eQ3vodupN36MrkzGQZS068e3EYTgNAB jZkD8TzPF4eG61o+cxFZrUIXowfXJosMX5ZQSlYSVlCDu2na8Lc2iK0mXNgodhRh0E6+UMVFei1G 2PrSIU9EwioS70yFBF2moUWeHNDS4qZDIDBdjx85xQq9VD42UbTRudBo31/E3ahF5MMcDI7KdpjQ KULbtCr8aoTjHIUEuG3LCVsCW2UOyugPPaOGK1ZclZhyJ1oAKHx1qHjvOGXm6QB+mk6ZTzCPKsFf twxbkg5OTEJBSZDxFdMdjhWKQRs1y634ml6J02QLTAyUTKV7I0jE4h9ZHqYlazF4Aep3JB627Axc knlh2e1/rezJYM7rptWnYu8C5mJ57ZG9g9QfbBpIF2o+aAI+IDjKMqLo+QDcwOuH+to72M/QpS+e gX0iIQ5z0z6bhalFEM/pjPCQA+BAliarbcyhnYf9GTlerAzRHZN69grz8ej5dy2YYel31/MJ2qMS 6ZNyfuvjIC4vGSfho7JcS6pVhiZJ7ABSPwypegdRXxKF5tPxTxfD0dMN+t5ZJWGWNNNyiNca2a3Z JdzTSfoPFZIShBSdpVJW5HbjQTAnC1PYnSgc+uNcEhwDf0aVA+O/xvrkPTGnkei6PbzPB13wAj1Q 9I3Ii/NI8GPErnjxJG7yzcfoHGlmY2l6KDJ6KdL65BimP4HoDlSIsZTwUZze41SyeXTE+1fVMg+Y M1KwDH7YITzl6JgvROCog9ka X-Report-Abuse-To: spam@semaster01.route25.eu Received-SPF: pass client-ip=185.95.31.95; envelope-from=rladams@adamsinfoserv.com; helo=se16.route25.eu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 09:48:41 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.51 X-TUID: qJ5cMEvctjRr Hello Org-ers! I've just upgraded to Emacs 27.1 and the latest Org (9.3.7-18-g093b47-elpa). While reviewing my init.el I found I was still depending on org-import-icalendar.el to import ics files. The link on Worg for this file is broken, and I could not find a good source. It's not in ELPA or MELPA, so I felt it was a dead end. Instead I discovered that Emacs Gnus already has an icalendar importer which includes some Org functions! I'm not sure when they were introduced, but I wanted to share because it's a built-in. In my init.el: #+begin_src lisp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Ical ;; Import ical files (require 'gnus-icalendar) (add-to-list 'org-capture-templates '("#" "Ical capture target" plain (file "~/doc/OrgFiles/Agenda.org") "%i" :immediate-finish t :empty-lines 1)) (setq gnus-icalendar-org-template-key "#") (defun rla-import-ical-to-org-capture (filename) (with-temp-buffer (insert-file-contents filename) (gnus-icalendar:org-event-save (gnus-icalendar-event-from-buffer (current-buffer)) nil))) #+end_src The key is to have a predefined org-capture template created for Gnus. There is a function to create one for you, but I preferred to make one by hand which is just a plain Org file with each new event appended to the end of the file. The Agenda.org file is also in my agenda list. Then I added a simple wrapper function to import an external file into a buffer for Gnus to save to Org. I think Gnus called it with a buffer which already contained the ical attachment from the mail message it was currently viewing. Now in Mutt if I receive a calendar invite, I can use mailcap to import it into Org. #+begin_src text text/calendar; emacsclient -e '(rla-import-ical-to-org-capture "%s")' ; copiousoutput application/ics; emacsclient -e '(rla-import-ical-to-org-capture "%s")' ; copiousoutput #+end_src Please let me know if this works for anyone else. It may be worth documenting on Worg. ------------------------------------------------------------------ Russell Adams RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3