summaryrefslogtreecommitdiff
path: root/lisp/gnus/shr.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-01-09 09:36:10 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2012-01-09 09:36:10 -0800
commit35cf62d95cdcd5323dcea4a5385942c342ff1d9c (patch)
tree90358cbb033a126c4d48793a80fd804b7baaca24 /lisp/gnus/shr.el
parent59815c02506eb39b61e672528ed03885749ba529 (diff)
parent7655cb66d86564e792b825f1a0e1a4de7d6e6db5 (diff)
Merge from trunk.
Diffstat (limited to 'lisp/gnus/shr.el')
-rw-r--r--lisp/gnus/shr.el59
1 files changed, 30 insertions, 29 deletions
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index f2d8f84356..969d893c2d 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -1,6 +1,6 @@
;;; shr.el --- Simple HTML Renderer
-;; Copyright (C) 2010-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: html
@@ -134,7 +134,8 @@ cid: URL as the argument.")
(shr-insert-document
(with-temp-buffer
(insert-file-contents file)
- (libxml-parse-html-region (point-min) (point-max)))))
+ (libxml-parse-html-region (point-min) (point-max))))
+ (goto-char (point-min)))
;;;###autoload
(defun shr-insert-document (dom)
@@ -534,33 +535,33 @@ the URL of the image to the kill buffer instead."
(insert alt)))
(defun shr-rescale-image (data)
- (if (or (not (fboundp 'imagemagick-types))
- (not (get-buffer-window (current-buffer))))
- (create-image data nil t
- :ascent 100)
- (let* ((image (create-image data nil t :ascent 100))
- (size (image-size image t))
- (width (car size))
- (height (cdr size))
- (edges (window-inside-pixel-edges
- (get-buffer-window (current-buffer))))
- (window-width (truncate (* shr-max-image-proportion
- (- (nth 2 edges) (nth 0 edges)))))
- (window-height (truncate (* shr-max-image-proportion
- (- (nth 3 edges) (nth 1 edges)))))
- scaled-image)
- (when (> height window-height)
- (setq image (or (create-image data 'imagemagick t
- :height window-height)
- image))
- (setq size (image-size image t)))
- (when (> (car size) window-width)
- (setq image (or
- (create-image data 'imagemagick t
- :width window-width
- :ascent 100)
- image)))
- image)))
+ (let ((image (create-image data nil t :ascent 100)))
+ (if (or (not (fboundp 'imagemagick-types))
+ (not (get-buffer-window (current-buffer))))
+ image
+ (let* ((size (image-size image t))
+ (width (car size))
+ (height (cdr size))
+ (edges (window-inside-pixel-edges
+ (get-buffer-window (current-buffer))))
+ (window-width (truncate (* shr-max-image-proportion
+ (- (nth 2 edges) (nth 0 edges)))))
+ (window-height (truncate (* shr-max-image-proportion
+ (- (nth 3 edges) (nth 1 edges)))))
+ scaled-image)
+ (when (> height window-height)
+ (setq image (or (create-image data 'imagemagick t
+ :height window-height
+ :ascent 100)
+ image))
+ (setq size (image-size image t)))
+ (when (> (car size) window-width)
+ (setq image (or
+ (create-image data 'imagemagick t
+ :width window-width
+ :ascent 100)
+ image)))
+ image))))
;; url-cache-extract autoloads url-cache.
(declare-function url-cache-create-filename "url-cache" (url))