From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83557 Path: news.gmane.org!not-for-mail From: David Edmondson Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] mml2015: When rescaling key images, handle error conditions. Date: Tue, 30 Jul 2013 06:44:22 +0100 Message-ID: <1375163062-15830-1-git-send-email-dme@dme.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1375163228 13596 80.91.229.3 (30 Jul 2013 05:47:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Jul 2013 05:47:08 +0000 (UTC) Cc: David Edmondson To: ding@gnus.org Original-X-From: ding-owner+M31815@lists.math.uh.edu Tue Jul 30 07:47:09 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V42m4-0000RM-9O for ding-account@gmane.org; Tue, 30 Jul 2013 07:47:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1V42jw-0004D8-2g; Tue, 30 Jul 2013 00:44:56 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1V42jk-0004Cp-Qh for ding@lists.math.uh.edu; Tue, 30 Jul 2013 00:44:44 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1V42jh-0006jh-V1 for ding@lists.math.uh.edu; Tue, 30 Jul 2013 00:44:43 -0500 Original-Received: from disaster-area.hh.sledj.net ([81.149.164.25]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1V42jf-0004G3-0T for ding@gnus.org; Tue, 30 Jul 2013 07:44:39 +0200 Original-Received: from hotblack-desiato.hh.sledj.net (hotblack-desiato.hh.sledj.net [IPv6:2a01:348:1a2:1:a288:b4ff:fe8a:77d8]) by disaster-area.hh.sledj.net (Postfix) with ESMTPSA id 0FCA65001E7; Tue, 30 Jul 2013 06:44:33 +0100 (BST) Original-Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id C68A6100FB5; Tue, 30 Jul 2013 06:44:31 +0100 (BST) X-Mailer: git-send-email 1.7.10.4 X-Spam-Score: -2.0 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83557 Archived-At: `gnus-rescale-image' typically throws an error when run on a tty frame, even though the resulting image would never be used. Catch the error and handle appropriately (by ignoring it). --- lisp/mml2015.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/mml2015.el b/lisp/mml2015.el index 2c2187a..3efa5c2 100644 --- a/lisp/mml2015.el +++ b/lisp/mml2015.el @@ -885,17 +885,19 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (defun mml2015-epg-key-image-to-string (key-id) "Return a string with the image of a key, if any" - (let* ((result "") - (key-image (mml2015-epg-key-image key-id))) - (when key-image - (setq result " ") - (put-text-property - 1 2 'display - (gnus-rescale-image key-image - (cons mml2015-maximum-key-image-dimension - mml2015-maximum-key-image-dimension)) - result)) - result)) + (let ((key-image (mml2015-epg-key-image key-id))) + (if (not key-image) + "" + (condition-case error + (let ((result " ")) + (put-text-property + 1 2 'display + (gnus-rescale-image key-image + (cons mml2015-maximum-key-image-dimension + mml2015-maximum-key-image-dimension)) + result) + result) + (error ""))))) (defun mml2015-epg-signature-to-string (signature) (concat (epg-signature-to-string signature) -- 1.7.10.4