X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=489e32c8bcafc1a9a3ef467ff45c8f098884f83d;hb=5505d55515594025fe319c5150fdb360b0ffcd60;hp=5b3e70eedb01bc28a7cf13b9b0142433c43f5b86;hpb=87a05adba3b2f4b57f0efb138b0a601d3eb48ade;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5b3e70ee..489e32c8 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -203,9 +203,10 @@ For example, if you wanted to remove an \"unread\" tag and add a (let ((id (notmuch-show-get-message-id))) (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*")))) (with-current-buffer buf - (call-process notmuch-command nil t nil "show" "--format=raw" id) - ,@body) - (kill-buffer buf))))) + (let ((coding-system-for-read 'no-conversion)) + (call-process notmuch-command nil t nil "show" "--format=raw" id) + ,@body) + (kill-buffer buf)))))) (defun notmuch-show-turn-on-visual-line-mode () "Enable Visual Line mode." @@ -747,17 +748,22 @@ 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) - (set-buffer (get-file-buffer file)) - (setq result (buffer-substring (point-min) (point-max))) - (set-buffer-modified-p nil) - (kill-buffer (current-buffer)) - (delete-file file) + (unwind-protect + (progn + (unless (icalendar-import-buffer file t) + (error "Icalendar import error. See *icalendar-errors* for more information")) + (set-buffer (get-file-buffer file)) + (setq result (buffer-substring (point-min) (point-max))) + (set-buffer-modified-p nil) + (kill-buffer (current-buffer))) + (delete-file file)) result))) t)