From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Image cache Date: Tue, 14 Feb 2006 03:48:17 +0200 Organization: JURTA Message-ID: <87fymmfuok.fsf@jurta.org> References: <87bqxjjwii.fsf_-_@jurta.org> <87mzh3krtx.fsf@stupidchicken.com> <87bqxiuno6.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1139893635 31122 80.91.229.2 (14 Feb 2006 05:07:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2006 05:07:15 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 14 06:07:14 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F8sP3-0007gQ-KF for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2006 06:07:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F8sP2-0004dK-L5 for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2006 00:07:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F8sOE-00049q-8h for emacs-devel@gnu.org; Tue, 14 Feb 2006 00:06:14 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F8sOD-00048T-CA for emacs-devel@gnu.org; Tue, 14 Feb 2006 00:06:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F8sOD-00048C-6N for emacs-devel@gnu.org; Tue, 14 Feb 2006 00:06:13 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F8sSo-0004h4-FO for emacs-devel@gnu.org; Tue, 14 Feb 2006 00:10:58 -0500 Original-Received: from mail.neti.ee (80-235-33-157-dsl.mus.estpak.ee [80.235.33.157]) by Relayhost2.neti.ee (Postfix) with ESMTP id 1F7E86288 for ; Tue, 14 Feb 2006 07:06:10 +0200 (EET) Original-To: emacs-devel@gnu.org In-Reply-To: <87bqxiuno6.fsf@jurta.org> (Juri Linkov's message of "Wed, 08 Feb 2006 11:23:29 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:50511 Archived-At: > 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/