Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] mml2015: When rescaling key images, handle error conditions.
@ 2013-07-30  5:44 David Edmondson
  2013-08-01 14:27 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: David Edmondson @ 2013-07-30  5:44 UTC (permalink / raw)
  To: ding; +Cc: David Edmondson

`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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mml2015: When rescaling key images, handle error conditions.
  2013-07-30  5:44 [PATCH] mml2015: When rescaling key images, handle error conditions David Edmondson
@ 2013-08-01 14:27 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 14:27 UTC (permalink / raw)
  To: David Edmondson; +Cc: ding

David Edmondson <dme@dme.org> writes:

> `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).

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-01 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30  5:44 [PATCH] mml2015: When rescaling key images, handle error conditions David Edmondson
2013-08-01 14:27 ` Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).