]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-show.el
notmuch-show.el: handle the case where icalendar-import-buffer returns nil
[notmuch] / emacs / notmuch-show.el
index ac7e644f623da76bd784ce95a9d2cd994c466c28..24db4c70aac6ebb9c4b73a5f12dd74e784bf8058 100644 (file)
@@ -754,12 +754,15 @@ message at DEPTH in the current thread."
              (replace-match "\n" nil nil))
            (let ((file (make-temp-file "notmuch-ical"))
                  result)
-             (icalendar-import-buffer 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)