[PATCH 1/1] notmuch-show.el: extended icalendar unfolding with single CR removal

Tomi Ollila tomi.ollila at iki.fi
Wed Oct 3 23:55:12 PDT 2012


In case text/calendar content contained "folded" data (i.e. line
continues to next line which begins with whitespace...

or

The text/calendar content is inside separate (application/octet-stream)
content and the text/calendar entry there contains carriage returns...

... The parsing of text/calendar content failed so badly that in
addition to just not showing the calendar content the rest of content
handling of the thread aborted.

In this change the input calendar content is unfolded extending the
unfolding code used in `icalendar--get-unfolded-buffer` with single CRs
removal.
---
 emacs/notmuch-show.el |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 86130ce..2a07e28 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -750,6 +750,11 @@ message at DEPTH in the current thread."
 	    (goto-char (point-min))
 	    (let ((file (make-temp-file "notmuch-ical"))
 		  result)
+	      ;; `icalendar--get-unfolded-buffer' unfolds with "\r?\n[ \t]".
+	      ;; This unfolding extends that by removing other CRs too.
+	      (while (re-search-forward "\\(\r\\|\r?\n[ \t]\\)" nil t)
+		(replace-match "" nil nil))
+	      (goto-char (point-min))
 	      (icalendar--convert-ical-to-diary
 	       (icalendar--read-element nil nil)
 	       file t)
-- 
1.7.1



More information about the notmuch mailing list