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

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

Re: magic-mode-alist gets in the way


From: Stefan
Subject: Re: magic-mode-alist gets in the way
Date: Tue, 04 Jan 2005 14:13:39 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

> One thought: if you are going to insist on having a
> magic-mode-alist, then it may make sense to store the
> regular expressions for certain file contents in
> special variables, i.e. xml-magic-regexp,
> html-magic-regexp, sgml-magic-regexp. That way, one
> could put something like this in ~/.emacs:

> (setq magic-mode-alist (cons '(html-magic-regexp .
> nxml-mode) magic-mode-alist))

This got me thinking about how things should ideally work, regardless of
backward compatibility, and it seems that it would be good to add an layer
of indirection.  Basically I'd want auto-mode-alist and magic-mode-alist to
specify not major modes but "Content-Types" and then have another variable
map "Content-Types" to major modes.

For Perl and TeX modes, the mapping from "Content-Type" to major mode is
currently done via the `perl-mode' and `tex-mode' function cells which can
either point to resp. Perl or CPerl modes, or builtin TeX or AUCTeX modes.

Formalizing such an indirection would also be good for -*- mode -*- cookies,
since such a cookie should say "this is an HTML file" rather than "use
nxml-mode to edit this file".


        Stefan




reply via email to

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