[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: auto-mode-alist, adding two modes
From: |
Joost Kremers |
Subject: |
Re: auto-mode-alist, adding two modes |
Date: |
8 Oct 2007 18:20:15 GMT |
User-agent: |
slrn/0.9.8.1 (Linux) |
Gijs Hillenius wrote:
> I do *not* want to add both of these minor modes to text-mode, for
> this messes up other applications, such as my dear gnus.
>
> So, I settled on
>
> (add-to-list 'auto-mode-alist '("\\.txt\\'" . longlines-mode ))
however, this is just plain wrong. auto-mode-alist is for *major* modes,
and longlines-mode is not a major mode. while it may work right now,
chances are it'll come back to bite you at some point in the future, and
may then be all the harder to debug, because you're doing something that's
not intended.
> (add-hook 'longlines-mode-hook 'flyspell-mode)
>
> The latter of which, if I understand it correctly, adds a fly-spell
> wherever I have longlines-mode. Which is something I can live with,
> for now.
yes, that is what it does.
if you don't want to add longlines-mode and flyspell-mode to
text-mode-hook, there is always the possibility to create a derived major
mode, which is easier than you might think:
(define-derived-mode my-text-mode
text-mode "Text"
"Modified text-mode, includes longlines-mode and flyspell-mode"
(longlines-mode 1)
(flyspell-mode 1))
then:
(add-to-list 'auto-mode-alist '("\\.txt\'" . my-text-mode))
this should do what you want without messing up gnus.
HTH
--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)