Fix up typo in rescaling.
[gnus] / lisp / gnus-html.el
index aa6d8fe..a503859 100644 (file)
@@ -82,9 +82,12 @@ fit these criteria."
            (when (and charset
                       (setq charset (mm-charset-to-coding-system charset))
                       (not (eq charset 'ascii)))
-             (mm-decode-coding-region (point-min) (point-max) charset))
+             (insert (prog1
+                         (mm-decode-coding-string (buffer-string) charset)
+                       (erase-buffer)
+                       (mm-enable-multibyte))))
            (call-process-region (point-min) (point-max)
-                                "w3m" 
+                                "w3m"
                                 nil article-buffer nil
                                 "-halfdump"
                                 "-no-cookie"
@@ -104,6 +107,9 @@ fit these criteria."
   (let (tag parameters string start end images url)
     (mm-url-decode-entities)
     (goto-char (point-min))
+    (while (re-search-forward "<pre_int> *</pre_int>\n" nil t)
+      (replace-match "" t t))
+    (goto-char (point-min))
     (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t)
       (setq tag (match-string 1)
            parameters (match-string 2)
@@ -249,7 +255,7 @@ fit these criteria."
                           (= (car (image-size image t)) 30)
                           (= (cdr (image-size image t)) 30))))
            (progn
-             (gnus-put-image (gnus-html-rescale-image image)
+             (gnus-put-image (gnus-html-rescale-image image file)
                              (gnus-string-or string "*"))
              t)
          (insert string)
@@ -259,7 +265,7 @@ fit these criteria."
                            (gnus-string-or string "*")))
          nil)))))
 
-(defun gnus-html-rescale-image (image)
+(defun gnus-html-rescale-image (image file)
   (if (or (not (fboundp 'imagemagick-types))
          (not (get-buffer-window (current-buffer))))
       image
@@ -271,14 +277,16 @@ fit these criteria."
           (window-height (truncate (* gnus-max-image-proportion
                                       (- (nth 3 edges) (nth 1 edges)))))
           scaled-image)
-      (or
-       (cond ((> height window-height)
-             (create-image file 'imagemagick nil
-                           :height window-height))
-            ((> width window-width)
-             (create-image file 'imagemagick nil
-                           :width window-width)))
-       image))))
+      (when (> height window-height)
+       (setq image (or (create-image file 'imagemagick nil
+                                     :height window-height)
+                       image)))
+      (when (> (car (image-size image t)) window-width)
+       (setq image (or
+                    (create-image file 'imagemagick nil
+                                  :width window-width)
+                    image)))
+      image)))
 
 (defun gnus-html-prune-cache ()
   (let ((total-size 0)
@@ -298,7 +306,6 @@ fit these criteria."
          (decf total-size (cadr file))
          (delete-file (nth 2 file)))))))
 
-
 (defun gnus-html-image-url-blocked-p (url blocked-images)
 "Find out if URL is blocked by BLOCKED-IMAGES."
   (let ((ret (and blocked-images
@@ -325,7 +332,7 @@ fit these criteria."
                 (push (gnus-html-image-id url) urls)
                 (push "-o" urls)))))
        (let ((process
-              (apply 'start-process 
+              (apply 'start-process
                      "images" nil "curl"
                      "-s" "--create-dirs"
                      "--location"