From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E2C676DE1401 for ; Tue, 8 Mar 2016 09:13:08 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.141 X-Spam-Level: X-Spam-Status: No, score=-0.141 tagged_above=-999 required=5 tests=[AWL=-0.074, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JqKq9Z7nJzQp for ; Tue, 8 Mar 2016 09:13:07 -0800 (PST) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id CC0B26DE1006 for ; Tue, 8 Mar 2016 09:13:06 -0800 (PST) Received: by mail-wm0-f65.google.com with SMTP id p65so5345034wmp.1 for ; Tue, 08 Mar 2016 09:13:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=KJEei7sQakby4keHh2jgIWB4Ki1uq8SAK2PIrYc1xsc=; b=aPuDm2aeCXfXNIXXb2507U5I73p09dcLIZgj0DJyW7NsLvTlkjInHvHaLBpJhU8s47 pJp31JqWP12rMdZV+o2uCWp1rICM/Rpwor22JswXnCemKs0TIuarG8kXFXAK7cgBe5k0 jYOfvQhfcGXlP1QJKi3ZjvUt7gNFSQKEKV+cOErQ/sVhDkebW+M/sL7eK6TIb9ArP17z lDGWmhn0/qETuM7RqizDP44CpYVThhOZOcSz1YEjcFZADAjC6rmsApbCuqetKm+gsoZ4 6B6TR4swaPTmjMwubB05+nMj+X8HmO2ZKVZGSgqC6O0+hGl2FHzMY7HrXT+aWsf9Fb93 iKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=KJEei7sQakby4keHh2jgIWB4Ki1uq8SAK2PIrYc1xsc=; b=Zb5k/AS6YbdF+APzaQfjRBjsDOVuajAfqfsdGiIC+JivcJ7w9vC1pLaC8rfU1uED5l 4qFKdK/vZIdca+Fmr2SLB6Gz2kerTPl/MXyYYP0UZ17THcYMPBjpMlgzpXNQ7CpKUS5T otasiUz/EGV4eeDQFAmF861bPn7VCLtw7n3u0f4UEc6TDThidLmgQmiZA0DY5mtQrZ0P nHQfG6Ua4+DV+kOLH2hG7+SLfjn4ouO+Rjp9Tl8+pvcSLy/mIcdih6PjypDX1jjcsApQ /xe4uHQznUR54lDaxS1HsOFCao1rCzo8080JhEpGvYQqiAbbdPko7v7izRGvrDtBvSY/ BxIg== X-Gm-Message-State: AD7BkJLUzaI0B7YWV54Fj5zVnY7p0yrSYM9+8HVwRXZQezeE3cEcnkM8jH52qnQ/yO9Dzw== X-Received: by 10.194.83.134 with SMTP id q6mr29769965wjy.131.1457457185410; Tue, 08 Mar 2016 09:13:05 -0800 (PST) Received: from disaster-area.hh.sledj.net ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) by smtp.gmail.com with ESMTPSA id j18sm19966565wmd.2.2016.03.08.09.13.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Mar 2016 09:13:04 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 233c1941 for ; Tue, 8 Mar 2016 17:12:59 +0000 (UTC) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v1 2/3] emacs: Neaten `notmuch-show-insert-bodypart-internal'. Date: Tue, 8 Mar 2016 17:12:58 +0000 Message-Id: <1457457179-4707-3-git-send-email-dme@dme.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457457179-4707-1-git-send-email-dme@dme.org> References: <1457457179-4707-1-git-send-email-dme@dme.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2016 17:13:09 -0000 --- emacs/notmuch-show.el | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 6e268f9..f739987 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" -- 2.1.4