From: Drew Adams <drew.adams@oracle.com>
To: Dan Hitt <dan.hitt@gmail.com>,
Christopher Howard <christopher.howard@qlfiles.net>
Cc: help-gnu-emacs@gnu.org
Subject: RE: extending a mode
Date: Sun, 29 Oct 2017 00:00:54 -0700 (PDT) [thread overview]
Message-ID: <8dc75cf2-e788-4ed3-99b4-321a7342a546@default> (raw)
In-Reply-To: <CAOphizKzmUQ3TSd9aXf6J2SXK-8zSk8_MwF7BuOhB380+OCwdA@mail.gmail.com>
> > 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.
prev parent reply other threads:[~2017-10-29 7:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-29 1:43 extending a mode Christopher Howard
2017-10-29 3:35 ` Dan Hitt
2017-10-29 7:00 ` Drew Adams [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8dc75cf2-e788-4ed3-99b4-321a7342a546@default \
--to=drew.adams@oracle.com \
--cc=christopher.howard@qlfiles.net \
--cc=dan.hitt@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).