unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* SVG image type fixes
@ 2007-08-25 14:16 Juri Linkov
  2007-08-25 19:38 ` Including nXML (was: SVG image type fixes) Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Juri Linkov @ 2007-08-25 14:16 UTC (permalink / raw)
  To: emacs-devel

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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-08-26 22:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-25 14:16 SVG image type fixes Juri Linkov
2007-08-25 19:38 ` Including nXML (was: SVG image type fixes) Stefan Monnier
2007-08-25 19:55   ` Leo
2007-08-26  1:08   ` Richard Stallman
2007-08-26  9:33     ` Including nXML Lennart Borgman (gmail)
2007-08-26 22:46       ` Richard Stallman
2007-08-25 19:42 ` SVG image type fixes Stefan Monnier
2007-08-26  1:08 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).