aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmondson <dme@dme.org>2016-03-08 17:12:58 +0000
committerDavid Bremner <david@tethera.net>2016-03-27 17:42:31 -0300
commit742b566cac5bae98d612bff306f08d45d4e27614 (patch)
treed64cb853c049aa3f79d1fd67407bc678d3a8ff42
parentcb4e90e476572f52517ccb2dd04872c243710e9c (diff)
emacs: Neaten `notmuch-show-insert-bodypart-internal'.
-rw-r--r--emacs/notmuch-show.el25
1 files changed, 10 insertions, 15 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index cba979df..7c344493 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -848,21 +848,16 @@ will return nil if the CID is unknown or cannot be retrieved."
;;
(defun notmuch-show-insert-bodypart-internal (msg part content-type nth depth button)
- (let ((handlers (notmuch-show-handlers-for content-type)))
- ;; Run the content handlers until one of them returns a non-nil
- ;; value.
- (while (and handlers
- (not (condition-case err
- (funcall (car handlers) msg part content-type nth depth button)
- ;; Specifying `debug' here lets the debugger
- ;; run if `debug-on-error' is non-nil.
- ((debug error)
- (progn
- (insert "!!! Bodypart insert error: ")
- (insert (error-message-string err))
- (insert " !!!\n") nil)))))
- (setq handlers (cdr handlers))))
- t)
+ ;; Run the handlers until one of them succeeds.
+ (loop for handler in (notmuch-show-handlers-for content-type)
+ until (condition-case err
+ (funcall handler msg part content-type nth depth button)
+ ;; Specifying `debug' here lets the debugger run if
+ ;; `debug-on-error' is non-nil.
+ ((debug error)
+ (insert "!!! Bodypart handler `" (prin1-to-string handler) "' threw an error:\n"
+ "!!! " (error-message-string err) "\n")
+ nil))))
(defun notmuch-show-create-part-overlays (button beg end)
"Add an overlay to the part between BEG and END"