From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Romain Francoise Newsgroups: gmane.emacs.devel Subject: Should `auto-coding-functions' be mode-specific? Date: Tue, 02 Jan 2007 21:43:04 +0100 Organization: orebokech dot com Message-ID: <87ejqd88iv.fsf@pacem.orebokech.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1167770686 8837 80.91.229.12 (2 Jan 2007 20:44:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Jan 2007 20:44:46 +0000 (UTC) Cc: Vincent Lefevre Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 02 21:44: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 1H1qUl-0006KO-Oq for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2007 21:44:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1qUY-00032o-LL for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2007 15:44:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H1qSl-00028O-G8 for emacs-devel@gnu.org; Tue, 02 Jan 2007 15:42:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H1qSj-00027i-V7 for emacs-devel@gnu.org; Tue, 02 Jan 2007 15:42:23 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1qSj-00027d-Nm for emacs-devel@gnu.org; Tue, 02 Jan 2007 15:42:21 -0500 Original-Received: from [82.67.41.165] (helo=yeast.orebokech.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H1qSi-0004L9-Us for emacs-devel@gnu.org; Tue, 02 Jan 2007 15:42:21 -0500 Original-Received: from pacem.orebokech.com (pacem.orebokech.com [192.168.1.3]) by yeast.orebokech.com (Postfix) with ESMTP id 36F1712C3B; Tue, 2 Jan 2007 21:42:20 +0100 (CET) Original-Received: by pacem.orebokech.com (Postfix, from userid 1000) id 97E6D5269A; Tue, 2 Jan 2007 21:43:04 +0100 (CET) Original-To: emacs-devel@gnu.org X-Face: }9mYu,e_@+e!`Z-P5kVXa3\_b:hdJ"B)ww[&=b<2=awG:GOIM 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:64643 Archived-At: 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.) -- Romain Francoise | The sea! the sea! the open it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the | ever free! --Bryan W. Procter 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.devel Subject: Re: Should `auto-coding-functions' be mode-specific? Date: Wed, 03 Jan 2007 11:54:59 +1100 Message-ID: <87d55x2al8.fsf@zip.com.au> References: <87ejqd88iv.fsf@pacem.orebokech.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1167785738 18153 80.91.229.12 (3 Jan 2007 00:55:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Jan 2007 00:55:38 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 03 01:55:35 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 1H1uPe-0001f6-Uf for ged-emacs-devel@m.gmane.org; Wed, 03 Jan 2007 01:55:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1uPe-0000cy-EA for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2007 19:55:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H1uPP-0000bz-NV for emacs-devel@gnu.org; Tue, 02 Jan 2007 19:55:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H1uPN-0000a3-HF for emacs-devel@gnu.org; Tue, 02 Jan 2007 19:55:11 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1uPN-0000Zw-AG for emacs-devel@gnu.org; Tue, 02 Jan 2007 19:55:09 -0500 Original-Received: from [61.8.2.231] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H1uPM-0004cc-NG for emacs-devel@gnu.org; Tue, 02 Jan 2007 19:55:09 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id AA19D6E01C for ; Wed, 3 Jan 2007 11:55:01 +1100 (EST) Original-Received: from localhost (ppp2AB5.dyn.pacific.net.au [61.8.42.181]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id DFF278C04 for ; Wed, 3 Jan 2007 11:55:02 +1100 (EST) Original-Received: from gg by localhost with local (Exim 4.63) (envelope-from ) id 1H1uPE-0003ad-Ch for emacs-devel@gnu.org; Wed, 03 Jan 2007 11:55:00 +1100 Original-To: emacs-devel@gnu.org In-Reply-To: <87ejqd88iv.fsf@pacem.orebokech.com> (Romain Francoise's message of "Tue, 02 Jan 2007 21:43:04 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) 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:64667 Archived-At: Romain Francoise writes: > > i.e. don't use the META header function in buffers that aren't in > html-mode (or equivalent). When this came up a while ago about .po and gutenberg .txt, I thought a filename could be bound/offered to the auto-coding-functions funcs, so they could limit themselves if they felt the need. Maybe the html one could just check the text starts with "" (perhaps after a