mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
notmuch-show.el: handle the case where icalendar-import-buffer returns nil
icalendar-import-buffer can fail by an error signal (which have been witnessed) but according to its docstring it can also return nil when failing (it returns t when succeeding). Now that the error is caught by the caller of notmuch-show-inset-part-* functions in case icalendar-import-buffer returns nil an explicit error is signaled and unwind-protect takes care of deleting the temporary file (just in case, it is usually not written to the fs yet).
This commit is contained in:
parent
60b5bff53d
commit
0a21fb98b2
1 changed files with 9 additions and 6 deletions
|
@ -754,12 +754,15 @@ message at DEPTH in the current thread."
|
||||||
(replace-match "\n" nil nil))
|
(replace-match "\n" nil nil))
|
||||||
(let ((file (make-temp-file "notmuch-ical"))
|
(let ((file (make-temp-file "notmuch-ical"))
|
||||||
result)
|
result)
|
||||||
(icalendar-import-buffer file t)
|
(unwind-protect
|
||||||
(set-buffer (get-file-buffer file))
|
(progn
|
||||||
(setq result (buffer-substring (point-min) (point-max)))
|
(unless (icalendar-import-buffer file t)
|
||||||
(set-buffer-modified-p nil)
|
(error "Icalendar import error. See *icalendar-errors* for more information"))
|
||||||
(kill-buffer (current-buffer))
|
(set-buffer (get-file-buffer file))
|
||||||
(delete-file file)
|
(setq result (buffer-substring (point-min) (point-max)))
|
||||||
|
(set-buffer-modified-p nil)
|
||||||
|
(kill-buffer (current-buffer)))
|
||||||
|
(delete-file file))
|
||||||
result)))
|
result)))
|
||||||
t)
|
t)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue