emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] shr-fontified f3dc41b 5/6: Use a single `with-window-excur


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] shr-fontified f3dc41b 5/6: Use a single `with-window-excursion' instead of two
Date: Sun, 08 Feb 2015 05:06:26 +0000

branch: shr-fontified
commit f3dc41b4e87d70efe878a978892a19ab76413bc7
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    Use a single `with-window-excursion' instead of two
---
 lisp/net/shr.el |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index dada6b0..89247f5 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1889,16 +1889,18 @@ The preference is a float determined from 
`shr-prefer-media-type'."
       (let ((shr-internal-width width)
            (shr-indentation 0))
        (shr-descend dom))
-      (unless fill
-       (setq natural-width
-             (or (dom-attr dom 'shr-td-cache-natural)
-                 (let ((natural (max (shr-pixel-buffer-width)
-                                     (shr-dom-max-natural-width dom 0))))
-                   (dom-set-attribute dom 'shr-td-cache-natural natural)
-                   natural))))
-      (let ((shr-internal-width width))
-       (shr-fold-lines (point-min) (point-max))
-       (setq max-width (shr-pixel-buffer-width)))
+      (save-window-excursion
+       (set-window-buffer nil (current-buffer))
+       (unless fill
+         (setq natural-width
+               (or (dom-attr dom 'shr-td-cache-natural)
+                   (let ((natural (max (shr-pixel-buffer-width)
+                                       (shr-dom-max-natural-width dom 0))))
+                     (dom-set-attribute dom 'shr-td-cache-natural natural)
+                     natural))))
+       (let ((shr-internal-width width))
+         (shr-fold-lines (point-min) (point-max))
+         (setq max-width (shr-pixel-buffer-width))))
       (goto-char (point-max))
       ;; Delete padding at the bottom of the TDs.
       (delete-region



reply via email to

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