all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Subject: Re: Image cache
Date: Tue, 14 Feb 2006 03:48:17 +0200	[thread overview]
Message-ID: <87fymmfuok.fsf@jurta.org> (raw)
In-Reply-To: <87bqxiuno6.fsf@jurta.org> (Juri Linkov's message of "Wed, 08 Feb 2006 11:23:29 +0200")

> 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	other threads:[~2006-02-14  1:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07 10:52 Image cache Juri Linkov
2006-02-07 17:21 ` Chong Yidong
2006-02-08  7:22   ` Mathias Dahl
2006-02-08  9:23   ` Juri Linkov
2006-02-14  1:48     ` Juri Linkov [this message]
2006-02-07 20:59 ` Stefan Monnier
2006-02-09 17:48   ` Richard M. Stallman
2006-02-09 19:18     ` Juri Linkov
2006-02-09 22:12       ` Chong Yidong
2006-02-09 22:51       ` Mathias Dahl
2006-02-10  0:10       ` Miles Bader
2006-02-10 23:02       ` Richard M. Stallman
2006-02-10 23:21         ` Miles Bader
2006-02-11  1:18           ` Juri Linkov
2006-02-11  2:14           ` Chong Yidong
2006-02-11 21:59             ` Miles Bader
2006-02-12  0:47           ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2008-12-15  1:26 Memory leak in keyboard variables? Kenichi Handa
2008-12-15  3:16 ` Chong Yidong
2008-12-15  4:06   ` image cache (was: Memory leak in keyboard variables?) Stefan Monnier
2008-12-15  4:12     ` Eli Zaretskii
2008-12-15 15:19       ` image cache Stefan Monnier
2008-12-15 16:08         ` Chong Yidong
2008-12-15 20:09           ` Stefan Monnier
2008-12-16  1:41           ` Miles Bader
2008-12-16  4:56             ` Chetan Pandya
2008-12-16  7:02               ` Chetan Pandya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fymmfuok.fsf@jurta.org \
    --to=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.