emacs-devel
[Top][All Lists]
Advanced

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

Re: Image cache


From: Juri Linkov
Subject: Re: Image cache
Date: Tue, 14 Feb 2006 03:48:17 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> Your change also has another undesirable effect: if doesn't handle the
> situation when Emacs can't read the image.  It visits the image file in
> text mode but thinks that it is in image mode (i.e. hides the cursor and
> prints a wrong message in the echo area).  Before your change handling this
> situation in image-mode.el was not nice either: with debug-on-error=t
> it signalled an error "Cannot determine image type", and with
> debug-on-error=nil this error was not reported at all.

This is due to the inability of create-image to determine the image type.
I noticed an unused function image-type-from-file-name in image.el that
looks like it was created specially for the function create-image.
I think the following patch does what was planned initially to do with
this function.  With this patch, JPEG files that `image-jpeg-p' fails to
recognize still get displayed in the image-mode's buffer correctly.

Index: lisp/image.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/image.el,v
retrieving revision 1.55
diff -c -r1.55 image.el
*** lisp/image.el       6 Feb 2006 14:33:34 -0000       1.55
--- lisp/image.el       14 Feb 2006 01:45:20 -0000
***************
*** 210,220 ****
    (cond ((null data-p)
         ;; FILE-OR-DATA is a file name.
         (unless (or type
!                    (setq type (image-type-from-file-header file-or-data)))
!          (let ((extension (file-name-extension file-or-data)))
!            (unless extension
!              (error "Cannot determine image type"))
!            (setq type (intern extension)))))
        (t
         ;; FILE-OR-DATA contains image data.
         (unless type
--- 223,231 ----
    (cond ((null data-p)
         ;; FILE-OR-DATA is a file name.
         (unless (or type
!                    (setq type (image-type-from-file-header file-or-data))
!                    (setq type (image-type-from-file-name file-or-data)))
!          (error "Cannot determine image type")))
        (t
         ;; FILE-OR-DATA contains image data.
         (unless type

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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