[Top][All Lists]

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

RE: extending a mode

From: Drew Adams
Subject: RE: extending a mode
Date: Sun, 29 Oct 2017 00:00:54 -0700 (PDT)

> > I wrote a simple command that I use when in Org mode...
> > however, this causes the command to be available under
> > other modes as well.
> But you should be able to run a piece of code with your add-hook that
> will bind the command to some keys, and this binding will only be
> available in a particular mode.

As Dan said, you can bind the command to a key in the
mode's keymap.  If the command is appropriate only for
the mode then you can also change its code so that if
it is ever invoked outside the mode (usually tested
using `derived-mode-p') then it does nothing, or it
shows a message saying it is only for the mode, or it
raises an error saying the same thing.

reply via email to

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