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

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

Re: auto-mode-alist for minor modes?


From: Lute Kamstra
Subject: Re: auto-mode-alist for minor modes?
Date: Thu, 11 Sep 2003 08:58:39 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

"David Vanderschel" <DJV1@Austin.RR.com> writes:

> Though the naming for the auto-mode-alist variable is neutral, the
> documentation for auto-mode-alist only talks about _major_ modes.  I
> would like to use it to invoke a _minor_ mode when a file with a
> given extension is loaded.  I have tried this, and it seems to work.
> Is there some subtle way I am going to get myself in trouble doing
> this?
>
> It seems to me that set-auto-mode does not know whether the function
> associated with the extension is a major mode starter or a minor
> mode starter.  It is just going to call it once the buffer is set
> up.  That is all I want.  But I know there are numerous potential
> 'gotchas' in emacs, so I seek reassurance or, if necessary,
> correction.

In my understanding, auto-mode-alist is searched for a filename match
and then the corresponding function is called.  The only problem you
may run into is that you want to set both a major mode and a minor
mode for some type of file.  Two entries in the alist won't do because
only the first match is used.  In this case you can best start the
major mode using auto-mode-alist and the minor mode using the major
mode's hook variable.  Alternatively, you could define a function that
starts the major mode as well as the minor mode and put this function
in auto-mode-alist.

  Lute.

-- 
(spook) => "CID Glock MD2"
(insert-file-contents "~/.signature") => (error "`~/.signature' too rude")


reply via email to

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