Merge branch 'master' of https://git.gnus.org/gnus
[gnus] / lisp / gnus-html.el
index 0f8ba83..bfbdc41 100644 (file)
@@ -37,7 +37,7 @@
 (require 'url-cache)
 (require 'xml)
 (require 'browse-url)
-(require 'help-fns)
+(eval-and-compile (unless (featurep 'xemacs) (require 'help-fns)))
 
 (defcustom gnus-html-image-cache-ttl (days-to-time 7)
   "Time used to determine if we should use images from the cache."
@@ -282,7 +282,7 @@ Use ALT-TEXT for the image string."
          (setq url (match-string 1 parameters))
           (gnus-message 8 "gnus-html-wash-tags: fetching link URL %s" url)
          (gnus-article-add-button start end
-                                  'browse-url url
+                                  'browse-url (mm-url-decode-entities-string url)
                                   url)
          (let ((overlay (gnus-make-overlay start end)))
            (gnus-overlay-put overlay 'evaporate t)
@@ -367,7 +367,10 @@ Use ALT-TEXT for the image string."
   (let ((args (list (car image)
                    'gnus-html-image-fetched
                    (list buffer image))))
-    (when (> (length (help-function-arglist 'url-retrieve)) 4)
+    (when (> (length (if (featurep 'xemacs)
+                        (split-string (function-arglist 'url-retrieve))
+                      (help-function-arglist 'url-retrieve)))
+            4)
       (setq args (nconc args (list t))))
     (apply #'url-retrieve args)))
 
@@ -431,17 +434,19 @@ Return a string with image data."
                                  (= (car size) 30)
                                  (= (cdr size) 30))))
                   ;; Good image, add it!
-                  (let ((image (gnus-html-rescale-image
+                  (let ((image (gnus-rescale-image
                                 image
-                                ;; (width . height)
-                                (cons
-                                 ;; Aimed width
-                                 (truncate
-                                  (* gnus-max-image-proportion
-                                     (- (nth 2 edges) (nth 0 edges))))
-                                 ;; Aimed height
-                                 (truncate (* gnus-max-image-proportion
-                                              (- (nth 3 edges) (nth 1 edges))))))))
+                                (let ((edges (gnus-window-inside-pixel-edges
+                                              (get-buffer-window (current-buffer)))))
+                                  ;; (width . height)
+                                  (cons
+                                   ;; Aimed width
+                                   (truncate
+                                    (* gnus-max-image-proportion
+                                       (- (nth 2 edges) (nth 0 edges))))
+                                   ;; Aimed height
+                                   (truncate (* gnus-max-image-proportion
+                                                (- (nth 3 edges) (nth 1 edges)))))))))
                     (delete-region start end)
                     (gnus-put-image image alt-text 'external)
                     (gnus-put-text-property start (point) 'help-echo alt-text)