Subject: bug#14423: 24.3; Gnus gratuitously loads image libraries in w32 text-mode Emacs

From: Eli Zaretskii <[email-masked]>
Date: Sun, 19 May 2013 22:46:44 +0300

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

   (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)))

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

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

Thanks.

In GNU Emacs 24.3.1 (i386-mingw-nt5.1.2600)
 of 2013-03-11 on HOME-C4E4A596F7
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (3.4) --cflags -Id:/usr/include/libxml2'

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1255
  default enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  flyspell-mode: t
  desktop-save-mode: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  line-number-mode: t
  auto-fill-function: mail-mode-auto-fill
  abbrev-mode: t

Recent input:
SPC <backspace> <backspace> y SPC u s e r s SPC o f 
SPC i t SPC h e r e . M-q <up> <C-right> <C-right> 
<C-right> <C-right> <C-right> SPC o n SPC W i n d o 
w s M-q <down> SPC SPC W h y SPC h a v e SPC a SPC 
p a r t i a l SPC s o l u t i o n SPC w h e n SPC y 
o u SPC c a n SPC h a v e SPC a SPC c o m p l e t e 
SPC o n e ? <down> <return> <C-home> <down> <down> 
<C-right> <C-right> <C-right> <C-right> <M-left> <C-end> 
C-c C-s <switch-frame> d p p <M-home> <C-end> <M-end> 
<switch-frame> <help-echo> <help-echo> <help-echo> 
<switch-frame> M-1 g <up> <up> <return> SPC o <return> 
C-x C-s <switch-frame> <help-echo> <help-echo> <help-echo> 
<switch-frame> <help-echo> <switch-frame> <switch-frame> 
M-1 g <up> <up> <return> d d r <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <down> 
<C-right> <C-right> <C-right> <C-right> <C-right> <C-left> 
<M-backspace> <M-backspace> <M-backspace> <C-end> C-c 
C-y C-x C-x C-SPC <down> <down> C-w <down> <down> <down> 
<down> C-SPC <next> <down> C-w <down> <down> <down> 
<down> <down> <C-right> <C-right> <C-right> <C-right> 
<C-right> <down> <C-left> <C-left> <left> <left> <left> 
<left> <left> <left> <C-end> C-w <return> <return> 
I t SPC s h o u l d SPC b e SPC p o s s i b l e , SPC 
b u t SPC I S-SPC s h o u l d SPC t r y . <return> 
<C-home> C-c C-s <switch-frame> <help-echo> <switch-frame> 
<help-echo> <help-echo> <help-echo> <switch-frame> 
C-x C-s <help-echo> <help-echo> <switch-frame> <help-echo> 
<switch-frame> M-1 g <up> <return> d d C-x C-s <switch-frame> 
<switch-frame> <switch-frame> M-x r e p o r t - e m 
<tab> <return>

Recent messages:
Wrote d:/usr/eli/rmail/INBOX [2 times]
Getting mail from d:/usr/eli/data/mail.new...
Counting new messages...done (2)
Saving file d:/usr/eli/rmail/INBOX...
Wrote d:/usr/eli/rmail/INBOX [2 times]
Computing summary lines...done
2 new messages read
No following nondeleted message
Saving file d:/usr/eli/rmail/INBOX...
Wrote d:/usr/eli/rmail/INBOX [2 times]

Load-path shadows:
None found.

Features:
(shadow emacsbug shell pp descr-text mule-util ebuff-menu electric
bug-reference misearch multi-isearch add-log network-stream starttls
tls mail-extr smtpmail auth-source eieio password-cache dabbrev
mailalias sendmail rmailout help-mode autoconf autoconf-mode perl-mode
vc-git tcl conf-mode generic arc-mode archive-mode diff-mode dired-x
cl-macs gv dired vc-cvs sh-script smie executable face-remap org-wl
org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs
org-html org-exp ob-exp org-exp-blocks org-agenda org-info org-gnus
gnus-util org-docview org-bibtex bibtex org-bbdb org byte-opt warnings
bytecomp byte-compile cconv advice help-fns advice-preload ob-tangle
ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys
org-pcomplete pcomplete comint ansi-color ring org-list org-faces
org-entities org-version ob-emacs-lisp ob org-compat org-macs ob-eval
org-loaddefs find-func cal-menu calendar cal-loaddefs noutline outline
easy-mmode jka-compr cc-awk make-mode autorevert flyspell info vc-bzr
cc-langs cl cl-lib cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs qp rmailsum rmailmm
message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils desktop server
filecache mairix cus-edit easymenu cus-start cus-load wid-edit
saveplace midnight ispell generic-x paren battery time time-date
tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process w32 multi-tty
emacs)