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