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

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

New set-auto-mode (Was: Wrong mode chosen)


From: Daniel Pfeiffer
Subject: New set-auto-mode (Was: Wrong mode chosen)
Date: Sat, 23 Oct 2004 20:56:14 +0200

Saluton,

Richard Stallman <address@hidden> skribis:

>     My specific wish on this one is simply for the interpreter to have a
>     higher precedence, at least if the executable bit is set.
> 
>     The other kind of exception is for files like /etc/fonts/fonts.conf
>     which starts out with <?xml ...  This is the clearest indication that
>     this file, whatever its filename may be, is an XML file.  Starting with
>     <!DOCTYPE ... does the same thing.  In both cases further insight into
>     the file might show it to be HTML.
> 
> These both seem like useful changes.  Would you like to write a patch
> to do this?

Ok, -*- mode still has the highest priority, next comes
interpreter-mode-alist, next comes checking if it starts with an XML
declaration (this is remembered for later) and auto-mode-alist comes last.

That way scripts come up in the right mode, no matter what lies the file name
tells.

If the buffer looks like XML and auto-mode-alist found a mode that is known to
be xml-ish (currently only html-mode) that mode is used, else xml-mode.  This
is so that stuff.xml.pl (Polish, not Perl) or /etc/fonts/fonts.conf (if we
have conf-mode) still come up in xml-mode.  And XHTML, which is HTML with XML
syntax, still comes up in html-mode.

Despite the extra feature, reordering these tests, and using assoc-default has
actually slightly simplified this function.  It passes all my tests, but
nevertheless, it is so fundamental, that I would like some feedback!  Simply
load the attachment (which redefines the function) and find many files!

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/

Attachment: files-patch.el
Description: Binary data


reply via email to

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