all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* auto-mode-alist for minor modes?
@ 2003-09-11  5:23 David Vanderschel
  2003-09-11  6:58 ` Lute Kamstra
  0 siblings, 1 reply; 2+ messages in thread
From: David Vanderschel @ 2003-09-11  5:23 UTC (permalink / raw)


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.

Regards,
  David V.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: auto-mode-alist for minor modes?
  2003-09-11  5:23 auto-mode-alist for minor modes? David Vanderschel
@ 2003-09-11  6:58 ` Lute Kamstra
  0 siblings, 0 replies; 2+ messages in thread
From: Lute Kamstra @ 2003-09-11  6:58 UTC (permalink / raw)


"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")

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-11  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-11  5:23 auto-mode-alist for minor modes? David Vanderschel
2003-09-11  6:58 ` Lute Kamstra

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.