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

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

magic-mode-alist barely documented


From: Ralf Angeli
Subject: magic-mode-alist barely documented
Date: Sat, 02 Apr 2005 09:04:14 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

Trying to set up nxml-mode I was bitten by `magic-mode-alist'.  The
installation instructions of the mode tell you to change
`auto-mode-alist' in order to load the mode for the specified file
endings.  This works fine with new files but fails on some existing
files I have.  The problem is that `auto-mode-alist' gets overruled by
`magic-mode-alist' which activates html-mode for these files.

For checking this, you can start Emacs with `emacs -Q', execute the
statement

(add-to-list 'auto-mode-alist '("\\.html\\'" . foo-mode))

and open a new .html file.  This should tell you that foo-mode is not
available.  Now create a file, e.g. test.html, and copy

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
          "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">

into it.  When you open the file you will get the built-in XHTML mode.

I had to debug `set-auto-mode' to find this out.  So you could blame
the package authors for not including information about a feature of a
to-be-released Emacs.  Nevertheless I would have expected that at
least the Emacs manual tells me about `magic-mode-alist'.  The doc
string of the variable is very scarce and you cannot expect an average
user altering it and its quite complex regular expressions in order
for it to do what he wants it to.  So, it would be nice to have some
description about `magic-mode-list' in (info "(emacs)Choosing Modes").


In GNU Emacs 22.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.6.2)
 of 2005-03-30 on neutrino
Distributor `The XFree86 Project, Inc', version 11.0.40300001
configured using `configure '--with-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  mouse-wheel-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  line-number-mode: t

Recent input:
C-x C-f t e s t . h C-g C-x C-f t e s t . h t m l <return> 
<down> <down> <down> <down> <down> <down> <left> C-x 
C-e C-x k <return> C-x C-f M-p <return> C-x k <return> 
C-x C-f t e s t 2 . h t m l <return> C-g M-x r e p 
o r t - e m a <tab> <return>

Recent messages:
(emacs -Q)
Loading disp-table...done
Loading image...done
Quit
Loading sgml-mode...done
(("\\.html\\'" . foo-mode) ("\\.py\\'" . python-mode) ("\\.mixal\\'" . 
mixal-mode) ("\\.lds" . ld-script-mode) ("\\.x[bp]m\\'" . image-mode-maybe) 
("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode) ("\\.gif\\'" . 
image-mode) ("\\.png\\'" . image-mode) ("\\.jpe?g\\'" . image-mode) 
("\\.[Pp][Rr][Oo]\\'" . idlwave-mode) ("/\\.gdbinit" . gdb-script-mode) ...)
(New file)
File mode specification error: (void-function foo-mode)
Quit
Loading emacsbug...done




reply via email to

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