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

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

Re: extending a mode


From: Dan Hitt
Subject: Re: extending a mode
Date: Sat, 28 Oct 2017 20:35:23 -0700

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 via email to

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