]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Neaten `notmuch-show-insert-bodypart-internal'.
authorDavid Edmondson <dme@dme.org>
Tue, 8 Mar 2016 17:12:58 +0000 (17:12 +0000)
committerDavid Bremner <david@tethera.net>
Sun, 27 Mar 2016 20:42:31 +0000 (17:42 -0300)
emacs/notmuch-show.el

index cba979df8a6343ac53e9f631b9d7a62ba0abe04f..7c3444931c0e6f96fca8e4200bf6f21e19860e2f 100644 (file)
@@ -848,21 +848,16 @@ will return nil if the CID is unknown or cannot be retrieved."
 ;; \f
 
 (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"