emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: files.el


From: Daniel Pfeiffer
Subject: Re: files.el
Date: Mon, 1 Nov 2004 08:56:43 +0100

Saluton,

Daniel Pfeiffer <address@hidden> skribis:

> Juri Linkov <address@hidden> skribis:
> 
> > How about adding a new user option for magic-string-regexp -> mode
> > mapping.
> 
> I had considered this, but didn't want to invest so much time.  It's also
> more complicated in the xml case, because xml-mode is only the default for
> those, unless a more specialized mode comes from the finame.
> 
> > The elements of such list could look, for example:
> > 
> >   ("^<\\?xml " . xml-mode)
> >   ("^<!DOCTYPE" . xml-mode)
> >   ("^.\\{,80\\}<html" . html-mode) ;; to look for <html within first 80
> >   chars
> 
> Things like echo "<html>..."?  You'd have to make sure that all preceding
> non-whitespace is contained in matching <...>, nested for comments.  Besides
> 80 is far too short, even without a comment, and watch out for case:
> 
> <?xml version="1.0" encoding="ISO-8859-15"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html>
> 
> Since html is currently the only candidate, maybe this could replace my file
> name checking.  Be sure to put the special cases first in the alist.  I'm
> done with my changes, so give it a shot!

Even if RMS is opposed to this, I don't think the complexity would be superior
to what we have now (except for a rather long html regexp).  On the contrary,
set-auto-mode would become shorter.  And the whole thing would be more
powerful, more Unix-like.

("\\(?:<?xml ...\\)?\\s *\\(?:<--...\\s *\\)*\\(?:<!DOCTYPE ...\\)?\\s
*\\(?:<--...\\s *\\)*<[Hh][Tt][Mm][Ll]" . html-mode)
("<?xml " . xml-mode)
("\\s *\\(?:<--...\\s *\\)*<!DOCTYPE " . xml-mode)
("%!" . ps-mode)

Reason I'm becoming more interested is that I've found dozens of a new kind of
conf file (also on windoze, where I thought this was cleaner: .ini) ending in
.lst. Only Adobe goes and puts Postscript into those.  But that's easily
recognized by the magic number :-)

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

-- 
lerne / learn / apprends / lär dig / ucz się    Esperanto:
                              http://lernu.net/




reply via email to

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