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

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

Re: auto-mode-alist, adding two modes


From: Johan Bockgård
Subject: Re: auto-mode-alist, adding two modes
Date: Thu, 11 Oct 2007 01:47:00 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux)

Edward O'Connor <hober0@gmail.com> writes:

>> I would like to get emacs to use longlines-mode *and* flyspell-mode
>> for all files ending in .txt
>
> You might want to define a derived mode in this sort of case.
>
> Something like this should do the trick. Untested, of course.
>
> (define-derived-mode gijs-text-mode text-mode "Gijs"
>   "Major mode for editing text files.")
>
> (add-to-list 'auto-mode-alist '("\\.txt\\'" . gijs-text-mode))


> (add-hook 'gijs-text-mode-hook 'longlines-mode)
> (add-hook 'gijs-text-mode-hook 'flyspell-mode)

Don't do that. This *toggles* {longlines,flyspell}-mode. If the parent
mode hook (text-mode-hook) turned it on, this will turn it off again.

-- 
Johan Bockgård


reply via email to

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