help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: dns mode


From: Kevin Rodgers
Subject: Re: dns mode
Date: Thu, 06 May 2010 16:43:00 -0600
User-agent: Thunderbird 2.0.0.24 (Macintosh/20100228)

Dmitry Dzhus wrote:
Nachiket Gokhale wrote:
It appears that I cannot save files with the extension "zone" e.g.
"foobar.zone" because emacs has loaded something called dns-mode by
default. How do I turn this thing off? What change do I have to make
to my .emacs.d/init.el file?

Emacs associates file extensions and major modes by looking into
`auto-mode-alist` variable, you can clean all `.zone`-matching entries
from it if you don't want Emacs to turn on DNS mode when editing such files:

    (setq auto-mode-alist (delete '("\\.\\(soa\\|zone\\)\\'" . dns-mode) 
auto-mode-alist))
    (setq auto-mode-alist (delete '("\\.zone\\'" . zone-mode) auto-mode-alist))

Oddly enough, my emacs (22.3) -Q has 2 entries for dns-mode in auto-mode-alist:

("\\.soa\\'" . dns-mode)
("\\.\\(soa\\|zone\\)\\'" . dns-mode)

So I would do something like:

(let ((auto-dns))
  (while (setq auto-dns (rassq 'dns-mode auto-mode-alist))
    (setq auto-mode-alist (delq auto-dns auto-mode-alist))))

And similarly for zone-mode.  This also has the advantage of working
regardless of the regexp used to match the file name.

You may get more information by reading section 27.1 of GNU Emacs manual
(«How Major Modes are Chosen»).

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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