From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "D. D. Brierton" Newsgroups: gmane.emacs.help Subject: Suggestions? Better filetype sniffing -- XHTML vs. HTML Date: Tue, 24 Feb 2004 14:56:38 +0000 Organization: DZR Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1077634960 23625 80.91.224.253 (24 Feb 2004 15:02:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 15:02:40 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 24 16:02:15 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ave4c-0008Ee-00 for ; Tue, 24 Feb 2004 16:02:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Ave4V-0007Kc-Ie for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2004 10:02:07 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!landlord!stones.force9.net.POSTED!not-for-mail User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Original-Newsgroups: gnu.emacs.help Original-Lines: 81 Original-NNTP-Posting-Host: 212.159.101.92 Original-X-Complaints-To: abuse@plus.net.uk Original-X-Trace: stones.force9.net 1077634497 212.159.101.92 (Tue, 24 Feb 2004 14:54:57 GMT) Original-NNTP-Posting-Date: Tue, 24 Feb 2004 14:54:57 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:121187 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17138 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17138 I'd like to be able to have emacs autodetect whether a file is an HTML file or an XHTML file. Standardly, file extension is not enough for this as HTML and XHTML files tend to have the same file extensions. I have to edit a lot of files created by other people, and they are often hopelessly invalid, so I have no hope of perfectly differentiating XHTML from HTML. However, there are some good clues to go on: If a file ends in one of the following: \.inc$ \.php[34]?$ \.[sjp]?html?$ Then (in my case) it is *either* HTML *or* XHTML. If a file with one of the above extensions has very near the beginning one or both of: