(gnus-request-marks): Call *-request-marks instead of the older request-update-info.
[gnus] / lisp / gnus-util.el
index 50292f4..d298c71 100644 (file)
@@ -1,7 +1,6 @@
 ;;; gnus-util.el --- utility functions for Gnus
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -39,6 +38,8 @@
 (eval-when-compile
   (require 'cl))
 
+(require 'time-date)
+
 (defcustom gnus-completing-read-function 'gnus-emacs-completing-read
   "Function use to do completing read."
   :version "24.1"
@@ -332,10 +333,11 @@ Symbols are also allowed; their print names are used instead."
        (and (= (car fdate) (car date))
             (> (nth 1 fdate) (nth 1 date))))))
 
+;; Every version of Emacs Gnus supports has built-in float-time.
+;; The featurep test silences an irritating compiler warning.
 (eval-and-compile
   (if (or (featurep 'emacs)
-         (and (fboundp 'float-time)
-              (subrp (symbol-function 'float-time))))
+         (fboundp 'float-time))
       (defalias 'gnus-float-time 'float-time)
     (defun gnus-float-time (&optional time)
       "Convert time value TIME to a floating point number.
@@ -1983,16 +1985,21 @@ empty directories from OLD-PATH."
   "Rescale IMAGE to SIZE if possible.
 SIZE is in format (WIDTH . HEIGHT). Return a new image.
 Sizes are in pixels."
-  (when (fboundp 'imagemagick-types)
+  (if (or (not (fboundp 'imagemagick-types))
+         (not (get-buffer-window (current-buffer))))
+      image
     (let ((new-width (car size))
           (new-height (cdr size)))
-      (unless (= (cdr (image-size image t)) new-height)
-        (setcdr image (plist-put (cdr image) :type 'imagemagick))
-        (setcdr image (plist-put (cdr image) :height new-height)))
-      (unless (= (car (image-size image t)) new-width)
-        (setcdr image (plist-put (cdr image) :type 'imagemagick))
-        (setcdr image (plist-put (cdr image) :width new-width)))))
-  image)
+      (when (> (cdr (image-size image t)) new-height)
+        (setq image (or (create-image (plist-get (cdr image) :data) 'imagemagick t
+                                      :height new-height)
+                        image)))
+      (when (> (car (image-size image t)) new-width)
+        (setq image (or
+                   (create-image (plist-get (cdr image) :data) 'imagemagick t
+                                 :width new-width)
+                   image)))
+      image)))
 
 (defun gnus-list-memq-of-list (elements list)
   "Return non-nil if any of the members of ELEMENTS are in LIST."