unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should `auto-coding-functions' be mode-specific?
@ 2007-01-02 20:43 Romain Francoise
  2007-01-02 22:14 ` Lennart Borgman (gmail)
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Romain Francoise @ 2007-01-02 20:43 UTC (permalink / raw)
  Cc: Vincent Lefevre

I received a bug report from a Debian user (CC'd) who was surprised
to see that Emacs 22 opens one of his utf-8-encoded files as ASCII,
because it contains the following HTML snippet near the top:

| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
| <HTML><HEAD>
| <META http-equiv=Content-Type content="text/html; charset=us-ascii">
| </HEAD>
| <BODY>
| </BODY></HTML>

The file itself is not an HTML file, but Emacs still uses the
encoding specified in the HTML code to set the encoding.  (This is
caused by `sgml-html-meta-auto-coding-function', which is present by
default in the list of `auto-coding-functions' -- the functions are
tried in the first 1K or last 3K bytes of the buffer.)

I replied that the encoding can be forced using a -*- coding: .. -*-
cookie, but the submitter argues that the functions to get the
encoding from the file's contents should only be enabled in modes
where the content of the buffer is supposed to match -- i.e. don't
use the META header function in buffers that aren't in html-mode (or
equivalent).

What do people think?

(See http://bugs.debian.org/404236 for the discussion.)

-- 
Romain Francoise <romain@orebokech.com> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter

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

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

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-02 20:43 Should `auto-coding-functions' be mode-specific? Romain Francoise
2007-01-02 22:14 ` Lennart Borgman (gmail)
2007-01-03  0:54 ` Kevin Ryde
2007-01-03  3:34 ` Richard Stallman
2007-01-03 12:09   ` Vincent Lefevre
2007-01-04  2:31     ` Richard Stallman
2007-01-04  4:14       ` Kenichi Handa
2007-01-04 19:02         ` Romain Francoise
2007-01-04 22:33         ` Richard Stallman
2007-01-05 18:04           ` Romain Francoise
2007-01-03  5:26 ` Kevin Rodgers
2007-01-03 14:18   ` Ralf Mattes
2007-01-04  8:44   ` Romain Francoise
2007-01-06 23:33     ` Juri Linkov
2007-01-07 13:47       ` Romain Francoise
2007-01-07 16:22         ` Juri Linkov
2007-01-08 19:46           ` Romain Francoise

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).