From: Lars Ingebrigtsen Date: Thu, 26 Sep 2019 13:47:06 +0000 (+0200) Subject: Fix recent gnus-rescale-image change X-Git-Tag: emacs-27.0.90~1427 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8e46cf4ba8c1992f52059cf530f5919f9fc33305;p=emacs.git Fix recent gnus-rescale-image change * lisp/gnus/gnus-util.el (gnus-rescale-image): Don't bug out on non-graphical Emacs versions. --- diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index dc779d04874..3cf364fff8b 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1610,15 +1610,17 @@ empty directories from OLD-PATH." "Rescale IMAGE to SIZE if possible. SIZE is in format (WIDTH . HEIGHT). Return a new image. Sizes are in pixels." - (let ((new-width (car size)) - (new-height (cdr size))) - (when (> (cdr (image-size image t)) new-height) - (setq image (create-image (plist-get (cdr image) :data) nil t - :max-height new-height))) - (when (> (car (image-size image t)) new-width) - (setq image (create-image (plist-get (cdr image) :data) nil t - :max-width new-width))) - image)) + (if (not (display-graphic-p)) + image + (let ((new-width (car size)) + (new-height (cdr size))) + (when (> (cdr (image-size image t)) new-height) + (setq image (create-image (plist-get (cdr image) :data) nil t + :max-height new-height))) + (when (> (car (image-size image t)) new-width) + (setq image (create-image (plist-get (cdr image) :data) nil t + :max-width new-width))) + image))) (defun gnus-recursive-directory-files (dir) "Return all regular files below DIR.