emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/with-url b6d6172 7/8: Don't move point around when


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] scratch/with-url b6d6172 7/8: Don't move point around when inserting images
Date: Sun, 22 Jan 2017 22:25:23 +0000 (UTC)

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

    Don't move point around when inserting images
---
 lisp/net/shr.el |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 8581033..902186f 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -39,6 +39,7 @@
 (require 'svg)
 (require 'image)
 (require 'with-url)
+(require 'mail-parse)
 
 (defgroup shr nil
   "Simple HTML Renderer"
@@ -932,17 +933,18 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
                            (or (url-header 'content-type) "text/plain")))
                          obarray))))
       (with-current-buffer buffer
-        (let ((alt (buffer-substring start end))
-              (properties (text-properties-at start))
-              (inhibit-read-only t))
-          (delete-region start end)
-          (goto-char start)
-          (funcall shr-put-image-function data alt flags)
-          (while properties
-            (let ((type (pop properties))
-                  (value (pop properties)))
-              (unless (memq type '(display image-size))
-                (put-text-property start (point) type value)))))))))
+        (save-excursion
+          (let ((alt (buffer-substring start end))
+                (properties (text-properties-at start))
+                (inhibit-read-only t))
+            (delete-region start end)
+            (goto-char start)
+            (funcall shr-put-image-function data alt flags)
+            (while properties
+              (let ((type (pop properties))
+                    (value (pop properties)))
+                (unless (memq type '(display image-size))
+                  (put-text-property start (point) type value))))))))))
 
 (defun shr-image-from-data (data)
   "Return an image from the data: URI content DATA."



reply via email to

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