emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/with-url 02136b4 1/2: Position cached images corre


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] scratch/with-url 02136b4 1/2: Position cached images correctly in the buffer
Date: Mon, 23 Jan 2017 17:05:21 +0000 (UTC)

branch: scratch/with-url
commit 02136b4e6cc5a3222ef450e551a2ef6fa2c5470a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Position cached images correctly in the buffer
---
 lisp/net/shr.el |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 902186f..fe6f11d 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1475,11 +1475,20 @@ The preference is a float determined from 
`shr-prefer-media-type'."
               (with-url-cached-p (shr-encode-url url)))
           (let ((buffer (current-buffer))
                 end)
-            (insert "-")
             (setq end (set-marker (make-marker) (point)))
-            (with-url ((shr-encode-url url) :cache t)
-              (shr-image-fetched buffer start end
-                                 (list :width width :height height)))))
+            (let ((data
+                   (with-url ((shr-encode-url url)
+                              :cache t
+                              :wait t)
+                     (when (url-okp)
+                       (shr-parse-image-data
+                        (intern (car
+                                 (mail-header-parse-content-type
+                                  (or (url-header 'content-type)
+                                      "text/plain")))
+                                obarray))))))
+              (funcall shr-put-image-function data alt
+                       (list :width width :height height)))))
          (t
           (when (image-type-available-p 'svg)
             (insert-image



reply via email to

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