From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Should `auto-coding-functions' be mode-specific? Date: Tue, 02 Jan 2007 23:14:42 +0100 Message-ID: <459AD952.9040706@gmail.com> References: <87ejqd88iv.fsf@pacem.orebokech.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1167776119 28230 80.91.229.12 (2 Jan 2007 22:15:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Jan 2007 22:15:19 +0000 (UTC) Cc: Vincent Lefevre , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 02 23:15:17 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 1H1rud-00081U-T9 for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2007 23:15:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1rud-0003z2-3k for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2007 17:15:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H1ruQ-0003yG-BY for emacs-devel@gnu.org; Tue, 02 Jan 2007 17:15:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H1ruO-0003wx-KU for emacs-devel@gnu.org; Tue, 02 Jan 2007 17:15:01 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1ruO-0003wt-IT for emacs-devel@gnu.org; Tue, 02 Jan 2007 17:15:00 -0500 Original-Received: from [80.76.149.213] (helo=ch-smtp02.sth.basefarm.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H1ruO-0007eG-3X for emacs-devel@gnu.org; Tue, 02 Jan 2007 17:15:00 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:62423 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1H1ruM-0002wS-75; Tue, 02 Jan 2007 23:14:58 +0100 User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) Original-To: Romain Francoise In-Reply-To: <87ejqd88iv.fsf@pacem.orebokech.com> X-Antivirus: avast! (VPS 0666-1, 2006-12-31), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1H1ruM-0002wS-75. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1H1ruM-0002wS-75 0b2a2df7297527d2e40072ae0c11d5ad 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:64655 Archived-At: Romain Francoise wrote: > 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: > > | > | > | > | > | > | > > 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.) > > IIt seems clear to me that this must be mode specific. Just a silly example: Suppose someone saves something like the html-snippet above in a customization.