[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: magic-mode-alist gets in the way
From: |
James J. Ramsey |
Subject: |
Re: magic-mode-alist gets in the way |
Date: |
Tue, 4 Jan 2005 08:00:32 -0800 (PST) |
--- Richard Stallman <address@hidden> wrote:
> I can't think of a good reason why the content
> should always take precedence
> over the file name.
>
> In actual practice, that is normally what we want.
Trouble is, when it *isn't* what is wanted, changing
the behavior is tricky. An example of the kind of
machinations involved in overriding the defaults is
shown here:
http://groups.yahoo.com/group/emacs-nxml-mode/message/893?threaded=1
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))
Considering that the value for html-magic-regexp would
be something like
(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
(comment-re (concat "\\(?:!--"
incomment-re "*-->\\s *<\\)")))
(concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<"
comment-re "*"
"\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *"
comment-re "*\\)?"
"[Hh][Tt][Mm][Ll]"))
having a pre-defined html-magic-regexp would be a big
help.
If you are going to insist on having a
magic-mode-alist, then it will *have* to be
documented, and you should try to make it easier for
it to be modified. It is a variable that will
inevitably need to be edited, just like
auto-mode-alist.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
- magic-mode-alist gets in the way, James J. Ramsey, 2005/01/01
- Re: magic-mode-alist gets in the way, Miles Bader, 2005/01/01
- Re: magic-mode-alist gets in the way, Stefan Monnier, 2005/01/03
- Re: magic-mode-alist gets in the way, Richard Stallman, 2005/01/03
- Re: magic-mode-alist gets in the way,
James J. Ramsey <=
- Re: magic-mode-alist gets in the way, Stefan, 2005/01/04
- Re: magic-mode-alist gets in the way, Richard Stallman, 2005/01/04
- Re: magic-mode-alist gets in the way, Richard Stallman, 2005/01/04
- Re: magic-mode-alist gets in the way, James J. Ramsey, 2005/01/04
- Re: magic-mode-alist gets in the way, Richard Stallman, 2005/01/05