bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#14423: 24.3; Gnus gratuitously loads image libraries in w32 text-mod


From: Ted Zlatanov
Subject: bug#14423: 24.3; Gnus gratuitously loads image libraries in w32 text-mode Emacs
Date: Wed, 05 Jun 2013 11:18:21 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

On Sun, 19 May 2013 22:46:44 +0300 Eli Zaretskii <eliz@gnu.org> wrote: 

EZ> Many Gnus features use the function gnus-image-type-available-p, which
EZ> does this:

EZ>    (defun gnus-image-type-available-p (type)
EZ>      (and (fboundp 'image-type-available-p)
EZ>       (image-type-available-p type)
EZ>       (if (fboundp 'display-images-p)
EZ>           (display-images-p)
EZ>         t)))

EZ> Because this calls image-type-available-p before testing the display
EZ> for image support (by calling display-images-p), a text-mode session
EZ> on MS-Windows will load image libraries that cannot be possibly useful
EZ> in a non-GUI session.  (The MS-Windows build of Emacs loads image DLL
EZ> shared libraries on demand, and that happens inside the call to
EZ> image-type-available-p.)  This useless library load both slows down
EZ> loading certain Gnus packages, and unnecessarily bloats the memory
EZ> footprint of the Emacs process.

EZ> To avoid this adverse effect, gnus-image-type-available-p should test
EZ> the result of calling display-images-p _before_ it checks whether the
EZ> specific image type can be supported.

That seems like a very trivial fix.  Does the patch below do it?  Or
should I make this check the very first thing?

Thanks
Ted

diff --git a/lisp/gnus-ems.el b/lisp/gnus-ems.el
index 4d9b579..f9ef70f 100644
--- a/lisp/gnus-ems.el
+++ b/lisp/gnus-ems.el
@@ -165,10 +165,10 @@
 
 (defun gnus-image-type-available-p (type)
   (and (fboundp 'image-type-available-p)
-       (image-type-available-p type)
        (if (fboundp 'display-images-p)
           (display-images-p)
-        t)))
+        t)
+       (image-type-available-p type)))
 
 (defun gnus-create-image (file &optional type data-p &rest props)
   (let ((face (plist-get props :face)))





reply via email to

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