[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hangs when reading DTD

From: Daniel Pfeiffer
Subject: Re: hangs when reading DTD
Date: Sat, 13 Nov 2004 00:20:10 +0100


Juri Linkov <address@hidden> skribis:

> Stefan <address@hidden> writes:
> > PS: A regexp is really not the best tool here.

I was reluctant to detect html with a regexp.  But it allowed having a general
purpose mechanism, rather than hard coding XML into `set-auto-mode'.  This was
needed for acroread, which has conf files in postscript format, that the file
name got wrong.

To be honest, apart from the few cases I put in, VRML may be the only other
candidate, if it ever gets its own mode.  Most files with magic are at least
partially binary.  There is one other, spar-mode by yours truly, for a simple
text only archive mode — not very widespread though.

> But perhaps you are right that a regexp is inefficient here.

True, if the file is xml/sgml, and there are many initial comments, it can
look pretty far into the buffer.  But in that case we are have a good chance
to have a match anyways.  If the buffer doesn't start with \s *<, this regexp
shouldn't hurt much.

I had also considered something like
("(<?xml...)?\s *(?:<!--...)*\s *(<?xml...)?\s *(?:<!--...)*\s *(?:<html)?"
 (3 . html-mode)

> A function might do a better job, and `set-auto-mode' should be
> improved to support this.

What could a function do other than my regexp?  Just looking for "<html" is
definitely not enough.  The only alternative I see is my old mechanism, where
files with xml/sgml magic nevertheless have their file name scanned, to see if
it's a xml submode.

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

lerne / learn / apprends / lär dig / ucz się    Esperanto:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]