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

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

Re: adding hook to auto-mode-alist load


From: Lute Kamstra
Subject: Re: adding hook to auto-mode-alist load
Date: Fri, 22 Aug 2003 08:41:18 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Todd Wylie <address@hidden> writes:

> I recently changed my dot-file to automatically invoke
> paragraph-indent-text-mode for files of type *.plan like so:
>
> (setq auto-mode-alist (cons '("\.plan$" . paragraph-indent-text-mode)
> auto-mode-alist))
>
> But, I'd also like to load auto-fill-mode just for this type of
> file. Can I add a text-mode-hook for this setup?

auto-mode-alist can be used to associate a certain type of file with a
major mode.  Every major mode has a hook variable that can be used to
customize that major mode.  In this case you can do

(add-hook 'paragraph-indent-text-mode-hook (lambda () (auto-fill-mode 1)))

to automatically start the auto-fill minor mode whenever you start the
paragraph-indent-text major mode.  If you want auto-fill-mode started
only for .plan files and not for other files that are put in
paragraph-indent-text-mode, then you could start auto-fill-mode
conditionally (e.g., write a function to do this and put this function
on paragraph-indent-text-mode-hook).

  Lute.

-- 
(spook) => "Telex ASDIC Vickie Weaver"
(insert-file-contents "~/.signature") => (error "`~/.signature' too rude")


reply via email to

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