[Top][All Lists]

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

Re: display word wrapping

From: Kim F. Storm
Subject: Re: display word wrapping
Date: 07 Jun 2004 15:34:18 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Juanma Barranquero <address@hidden> writes:

> I've finally gone the full length and made image loading delayed till
> the type is needed, so
>   (image-type-available-p 'jpeg)
> will load only jpeg, if not yet available.  That way, most of my runs of
> Emacs on Windows will never load any image library at all (so, less
> memory footprint).


> It has the nice side effect that it eliminates the need for any special
> handling of t in image-library-alist, so it's in fact simpler that the
> previous incarnation of the patch.

But you can improve it even further, see below.
> +DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 
> 0,
> +       doc: /* Initialize image library implementing image type TYPE.

  Returns non-nil if TYPE is a supported image type.

> +Image types pbm and xbm are prebuilt; other types are loaded here.
> +Libraries to load are specified in alist LIBRARIES (usually, the value
> +of `image-library-alist', which see.  */)
> +  (type, libraries)
> +{
> +  if (NILP (Fmemq (type, Vimage_types)))
> +    {

Replace by:

     if (!NILP (Fmemq (type, Vimage_types)))
       return Qt;


> +    }
> +
> +  return Vimage_types;
> +}

Replace by:

    return Fmemq (type, Vimage_types);

to redo lookup after initializing the image type.

Alternatively, you could let define_image_type return Qt or Qnil
depending on whether the type was added to Vimage_types, 
and then write the code like this:

+#if defined (HAVE_PNG) || defined (MAC_OS)
+      IF_LIB_AVAILABLE(Qpng, init_png_functions)
+        return define_image_type (&png_type);

and then just return Qnil if you fall through to the
end of the function.

> @@ -112,6 +123,6 @@
>    "Value is non-nil if image type TYPE is available.
>  Image types are symbols like `xbm' or `jpeg'."
> -  (and (boundp 'image-types) (not (null (memq type image-types)))))
> -
> +  (and (fboundp 'init-image-library)
> +       (memq type (init-image-library type image-library-alist))))

Replace by:

> +  (and (fboundp 'init-image-library)
> +       (init-image-library type image-library-alist))

However, one problem with the dynamic loading is that for image
formats that fails to load, you will try to load them again every
time you test for the availablity of that image type.

Maybe Vimage_types should be changed to an alist

        ((png . t) (jpeg . nil) ...)

storing the results of the type lookups already performed.

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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