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

Tomi Ollila tomi.ollila at iki.fi
Wed Nov 7 07:54:36 PST 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 fails and next method of
inserting the content is used (if any), usually providing less readable
output.

In this change the input calendar content is unfolded extending the
unfolding code used in `icalendar--get-unfolded-buffer` with single CRs
removal.
---

This obsoletes id:1349333712-18347-1-git-send-email-tomi.ollila at iki.fi
Commit message is changed to reflect change in pushed patch 
id:1350826509-12119-1-git-send-email-tomi.ollila at iki.fi
also, '\\r?' part in regexp was removed.

Note the difference how id:87d31artti.fsf at inf-8657.int-evry.fr
is inserted before and after this change.

 emacs/notmuch-show.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index d061367..d51345e 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\\|\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.8.0



More information about the notmuch mailing list