all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Hitt <dan.hitt@gmail.com>
To: Christopher Howard <christopher.howard@qlfiles.net>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: extending a mode
Date: Sat, 28 Oct 2017 20:35:23 -0700	[thread overview]
Message-ID: <CAOphizKzmUQ3TSd9aXf6J2SXK-8zSk8_MwF7BuOhB380+OCwdA@mail.gmail.com> (raw)
In-Reply-To: <1509241395.11482.8.camel@qlfiles.net>

On Sat, Oct 28, 2017 at 6:43 PM, Christopher Howard
<christopher.howard@qlfiles.net> wrote:
> Hi, I wrote a simple command that I use when in Org mode, and probably
> will write a few more in the course of time. I'm not sure if anybody
> else besides me would ever use them. However, I want emacs to load
> those commands when it enters Org mode. What is the simplest and/or
> best way to do this? One trick I learned was that I could (add-hook)
> and 'org-mode-hook with a defun in it; however, this causes the command
> to be available under other modes as well.
>
> --
> https://answersingenesis.org/


Hi Christopher,

As soon as the defun is executed, i think that will make the function
available everywhere (dynamic scope vs. lexical scope).

So i think that much is expected.

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.

But maybe i'm missing your point?

If you post the add-hook think you've done, i think somebody around
here will figure it out though.

dan



  reply	other threads:[~2017-10-29  3:35 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 [this message]
2017-10-29  7:00   ` Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOphizKzmUQ3TSd9aXf6J2SXK-8zSk8_MwF7BuOhB380+OCwdA@mail.gmail.com \
    --to=dan.hitt@gmail.com \
    --cc=christopher.howard@qlfiles.net \
    --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.
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.