--- /dev/null
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 90229431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 8 Nov 2012 04:08:03 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Zz9mlEeI3xkC for <notmuch@notmuchmail.org>;\r
+ Thu, 8 Nov 2012 04:08:02 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 76886431FB6\r
+ for <notmuch@notmuchmail.org>; Thu, 8 Nov 2012 04:08:02 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 684E610009E; Thu, 8 Nov 2012 14:08:02 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 1/2] notmuch-show.el: import calendar data with public\r
+ function after CR removal\r
+Date: Thu, 8 Nov 2012 14:07:59 +0200\r
+Message-Id: <1352376480-29961-2-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <1352376480-29961-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1352376480-29961-1-git-send-email-tomi.ollila@iki.fi>\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 08 Nov 2012 12:08:03 -0000\r
+\r
+notmuch-get-bodypart-content provides raw data to its caller so\r
+that it can be stored verbatim whenever needed. icalendar functions\r
+expect Emacs to do EOL conversion for the data given to these. Therefore\r
+it the CRLF -> LF conversion is now done explicitly.\r
+\r
+The calls to private functions icalendar--convert-ical-to-diary and\r
+icalendar--read-element are replaced with call to public function\r
+icalendar-import-buffer.\r
+---\r
+ emacs/notmuch-show.el | 8 +++++---\r
+ 1 file changed, 5 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index d061367..e3977cc 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -747,12 +747,14 @@ message at DEPTH in the current thread."\r
+ (notmuch-show-insert-part-header nth declared-type content-type (plist-get part :filename))\r
+ (insert (with-temp-buffer\r
+ (insert (notmuch-get-bodypart-content msg part nth notmuch-show-process-crypto))\r
++ ;; notmuch-get-bodypart-content provides "raw", non-converted\r
++ ;; data. Replace CRLF with LF before icalendar can use it.\r
+ (goto-char (point-min))\r
++ (while (re-search-forward "\r\n" nil t)\r
++ (replace-match "\n" nil nil))\r
+ (let ((file (make-temp-file "notmuch-ical"))\r
+ result)\r
+- (icalendar--convert-ical-to-diary\r
+- (icalendar--read-element nil nil)\r
+- file t)\r
++ (icalendar-import-buffer file t)\r
+ (set-buffer (get-file-buffer file))\r
+ (setq result (buffer-substring (point-min) (point-max)))\r
+ (set-buffer-modified-p nil)\r
+-- \r
+1.8.0\r
+\r