From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: auto-detecting encoding for XML Date: Mon, 20 May 2002 10:23:11 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200205201423.g4KENCL27469@rum.cs.yale.edu> References: <1021775271.29752.2282.camel@space-ghost> <200205192313.g4JNDmk24770@rum.cs.yale.edu> <1021878296.16796.2926.camel@space-ghost> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1021904657 10527 127.0.0.1 (20 May 2002 14:24:17 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 20 May 2002 14:24:17 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 179o5A-0002jb-00 for ; Mon, 20 May 2002 16:24:16 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 179oJ9-0008Uf-00 for ; Mon, 20 May 2002 16:38:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 179o5U-0007nc-00; Mon, 20 May 2002 10:24:36 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 179o48-0007k2-00; Mon, 20 May 2002 10:23:12 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g4KENCL27469; Mon, 20 May 2002 10:23:12 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Colin Walters Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4174 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4174 > On Sun, 2002-05-19 at 19:13, Stefan Monnier wrote: > > > * international/mule.el (auto-coding-functions): New variable. > > > > Why not extend auto-coding-regexp-alist so it can associate a regexp > > to a function (rather than a coding-system) ? > > Hm. It seems cleaner to just have the function do the searching in the > first place, instead of in this case matching against a regexp, then > callling a function which will probably have to do the same searching... No, it could just use the match-data directly. I was thinking of it the other way: the function will most likely need to do a regexp search anyway, so why not include it with the auto-coding-regexp-alist. Also the "specify a coding-system or a function returning a coding-system" thing is already used in file-coding-system-alist so it seemed natural enough. > > Or why not do what po.el does (i.e. use file-coding-system-alist) ? > > Admittedly, the file-coding-system-alist approach is pretty > > hairy/heavy-weight. > > Well, it also has the disadvantage in this case that it depends on file > extensions; XML tends to be used as an encoding for other types of > files, which use their own extension. So using file names as a way to > detect XML is probably a bad approach. That's why it would be better to link it to major-modes. > > Note that these are always associated with a mode, so > > it would be good if the implementation also was mode-specific so > > that it automatically works if you open an xml file called > > foo.myxmlextension (as long as "\\.myxmlextension\\'" is in the > > auto-mode-alist). > Yes. It's very tricky though. Yes, I know it's tricky. But maybe we can come up with something clever. In the mean time, I agree that extending auto-coding-regexp-alist is maybe the best approach. Stefan