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: SVG image type fixes Date: Sat, 25 Aug 2007 17:16:36 +0300 Organization: JURTA Message-ID: <87tzqnbsin.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1188057286 17697 80.91.229.12 (25 Aug 2007 15:54:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 25 Aug 2007 15:54:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 25 17:54:43 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IOxyF-0005gV-E3 for ged-emacs-devel@m.gmane.org; Sat, 25 Aug 2007 17:54:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IOxyE-0008C5-MS for ged-emacs-devel@m.gmane.org; Sat, 25 Aug 2007 11:54:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IOxyB-0008Bn-ER for emacs-devel@gnu.org; Sat, 25 Aug 2007 11:54:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IOxy9-0008BQ-SN for emacs-devel@gnu.org; Sat, 25 Aug 2007 11:54:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IOxy9-0008BM-Hi for emacs-devel@gnu.org; Sat, 25 Aug 2007 11:54:37 -0400 Original-Received: from relay01.kiev.sovam.com ([62.64.120.200]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IOwge-0004ZA-4s for emacs-devel@gnu.org; Sat, 25 Aug 2007 10:32:28 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1IOwgT-0006cf-BW for emacs-devel@gnu.org; Sat, 25 Aug 2007 17:32:25 +0300 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-Scanner-Signature: 4fe2b897d4d72954524b6b73d18f8617 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1404 [August 24 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 10 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release X-Detected-Kernel: FreeBSD 4.8-5.1 (or MacOS X 10.2-10.3) 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:77130 Archived-At: 1. Currently visiting a non-SVG XML file fails with errors from the image library and memory overflow. That's because the regexp in `image-type-header-regexps' detecting the SVG image type of too lax and recognizes non-SVG XML files as SVG. I fixed this regexp to be like regexps that detect XML formats in `magic-fallback-mode-alist'. This is still not ideal since it can't recognize some SVG types (e.g. when DOCTYPE contains ENTITY definitions). Instead of trying to improve an already overly complex regexp, it's better to use one function `xmltok-forward-prolog' from the nXML package - another argument to add this nice package to Emacs! 2. Since SVG is a text-based image format, it should be possible to use XML mode to edit it. I fixed image-mode.el to associate the file extension .svg with xml-mode and image-mode-maybe, exactly like this is done for another text-based image format .xpm. But like .xpm, now visiting .svg puts the file in text image mode that shows the source of the image. This is bad even for .xpm and for any text-based image format, because viewing image is more frequent action than editing it. This is as inconvenient as if a Web browser displayed the source HTML code initially, and only after typing a special key like C-c C-c it rendered it as a HTML page. Is it OK to change image-mode.el to display text-based image files as an image initially instead as text? 3. Added support for the compressed .svgz format. These files get decompressed by gzip with the help of jka-cmpr. 4. Currently it's difficult to see if Emacs recognized the image type correctly when it can't display an image. Another need to know the image type is when Emacs uses content-based recognition on a file without extension. To make sure of this, I propose to add image type in square brackets to the image-mode indicator on the mode line like: Image[svg] 5. The node `(elisp)Images' now should mention the image format `svg'. But before adding it, I propose to split this large node (it's so large that a menu in the end of this node is not visible after visiting this node), and to move text starting with `The supported image formats include ...' to a new node `Image formats'. -- Juri Linkov http://www.jurta.org/emacs/