emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master eac4e34a2c 2/2: Simplify eww--rescale-images code


From: Lars Ingebrigtsen
Subject: master eac4e34a2c 2/2: Simplify eww--rescale-images code
Date: Wed, 28 Sep 2022 07:28:14 -0400 (EDT)

branch: master
commit eac4e34a2c0fd3b7a7e2c1205f452dc65db3fd9d
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Simplify eww--rescale-images code
    
    * lisp/net/eww.el (eww--rescale-images): Simplify code.
---
 lisp/net/eww.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 624958915a..414de931c4 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1189,18 +1189,17 @@ the like."
 (defun eww--rescale-images ()
   (let ((scaling (if text-scale-mode
                      (+ 1 (* text-scale-mode-amount 0.1))
-                   1))
-        match)
+                   1)))
     (save-excursion
       (goto-char (point-min))
-      (while (setq match (text-property-search-forward 'display))
+      (while-let ((match (text-property-search-forward
+                          'display nil (lambda (_ value) (imagep value)))))
         (let ((image (prop-match-value match)))
-          (when (imagep image)
-            (unless (image-property image :original-scale)
-              (setf (image-property image :original-scale)
-                    (or (image-property image :scale) 1)))
-            (setf (image-property image :scale)
-                  (* (image-property image :original-scale) scaling))))))))
+          (unless (image-property image :original-scale)
+            (setf (image-property image :original-scale)
+                  (or (image-property image :scale) 1)))
+          (setf (image-property image :scale)
+                (* (image-property image :original-scale) scaling)))))))
 
 (defun eww--url-at-point ()
   "`thing-at-point' provider function."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]