From: Juri Linkov <juri@jurta.org>
To: emacs-devel@gnu.org
Subject: SVG image type fixes
Date: Sat, 25 Aug 2007 17:16:36 +0300 [thread overview]
Message-ID: <87tzqnbsin.fsf@jurta.org> (raw)
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/
next reply other threads:[~2007-08-25 14:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-25 14:16 Juri Linkov [this message]
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
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=87tzqnbsin.fsf@jurta.org \
--to=juri@jurta.org \
--cc=emacs-devel@gnu.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.