* key binding question
@ 2007-02-10 13:00 Hadron
2007-02-12 4:42 ` Kevin Rodgers
[not found] ` <mailman.4372.1171255378.2155.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Hadron @ 2007-02-10 13:00 UTC (permalink / raw)
To: help-gnu-emacs
Is it to add a new key binding to be local to a specific mode by adding
a hook e.g
(add-hook 'html-mode-hook
(lambda ()
(local-set-key [f10] 'myfunc)))
or to use define-key on the specific mode-map?e.g
(define-key html-mode-map [f11] 'myfunc)
(assume the html-mode-map variable is instantiated/inscope.
Or to ask another way, why would you choose one over the other and what
might the pitfalls be?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: key binding question
2007-02-10 13:00 key binding question Hadron
@ 2007-02-12 4:42 ` Kevin Rodgers
[not found] ` <mailman.4372.1171255378.2155.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2007-02-12 4:42 UTC (permalink / raw)
To: help-gnu-emacs
Hadron wrote:
> Is it to add a new key binding to be local to a specific mode by adding
> a hook e.g
>
>
> (add-hook 'html-mode-hook
> (lambda ()
> (local-set-key [f10] 'myfunc)))
>
>
> or to use define-key on the specific mode-map?e.g
>
> (define-key html-mode-map [f11] 'myfunc)
>
> (assume the html-mode-map variable is instantiated/inscope.
>
> Or to ask another way, why would you choose one over the other and what
> might the pitfalls be?
I use the mode hook, because I have an aversion to keymap variable names
:-) and because it doesn't require the package to be loaded.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.4372.1171255378.2155.help-gnu-emacs@gnu.org>]
* Re: key binding question
[not found] ` <mailman.4372.1171255378.2155.help-gnu-emacs@gnu.org>
@ 2007-02-12 9:11 ` Hadron
2007-02-13 6:36 ` Kevin Rodgers
0 siblings, 1 reply; 8+ messages in thread
From: Hadron @ 2007-02-12 9:11 UTC (permalink / raw)
To: help-gnu-emacs
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
> Hadron wrote:
>> Is it to add a new key binding to be local to a specific mode by adding
>> a hook e.g
>>
>>
>> (add-hook 'html-mode-hook
>> (lambda ()
>> (local-set-key [f10] 'myfunc)))
>>
>>
>> or to use define-key on the specific mode-map?e.g
>>
>> (define-key html-mode-map [f11] 'myfunc)
>>
>> (assume the html-mode-map variable is instantiated/inscope.
>>
>> Or to ask another way, why would you choose one over the other and what
>> might the pitfalls be?
>
> I use the mode hook, because I have an aversion to keymap variable names
> :-) and because it doesn't require the package to be loaded.
Makes sense, and doesn't add it multiple times I assume :-;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: key binding question
2007-02-12 9:11 ` Hadron
@ 2007-02-13 6:36 ` Kevin Rodgers
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2007-02-13 6:36 UTC (permalink / raw)
To: help-gnu-emacs
Hadron wrote:
> Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
>
>> Hadron wrote:
>>> Is it to add a new key binding to be local to a specific mode by adding
>>> a hook e.g
>>>
>>>
>>> (add-hook 'html-mode-hook
>>> (lambda ()
>>> (local-set-key [f10] 'myfunc)))
>>>
>>>
>>> or to use define-key on the specific mode-map?e.g
>>>
>>> (define-key html-mode-map [f11] 'myfunc)
>>>
>>> (assume the html-mode-map variable is instantiated/inscope.
>>>
>>> Or to ask another way, why would you choose one over the other and what
>>> might the pitfalls be?
>> I use the mode hook, because I have an aversion to keymap variable names
>> :-) and because it doesn't require the package to be loaded.
>
> Makes sense, and doesn't add it multiple times I assume :-;
No need to assume: C-h f add-hook
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 8+ messages in thread
* key binding question
@ 2003-04-06 5:05 Kevin Reeder
2003-04-06 11:14 ` maierh
2003-04-07 10:10 ` Jerome Besnard
0 siblings, 2 replies; 8+ messages in thread
From: Kevin Reeder @ 2003-04-06 5:05 UTC (permalink / raw)
When using the python interpreter within emacs, I'd like to have the
up/down arrows echo previous commands. Can anyone give me the code for
this?
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: key binding question
2003-04-06 5:05 Kevin Reeder
@ 2003-04-06 11:14 ` maierh
2003-04-07 10:10 ` Jerome Besnard
1 sibling, 0 replies; 8+ messages in thread
From: maierh @ 2003-04-06 11:14 UTC (permalink / raw)
Kevin Reeder <avail@uponrequest.org> writes:
> When using the python interpreter within emacs, I'd like to have the
> up/down arrows echo previous commands. Can anyone give me the code for
> this?
The common philosophy on this subject is to use M-p and M-n because
with down and up or C-n and C-p you might move in the buffer. Anyway,
I don't know the python interpreter mode, but if it's derived from
comint then you can set in the interpreter mode hook the function
'comint-previous-input' and 'comint-next-input' to your favorite keys.
Here an example that sets in general for all comint modes new function
keys. But you can set this too only for a special mode such as
'shell-mode-hook' or maybe 'py-mode-hook' (?).
(add-hook
'comint-mode-hook
(lambda ()
(interactive)
(define-key comint-mode-map [up] 'comint-previous-input)
(define-key comint-mode-map [down] 'comint-next-input)
))
Harald
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: key binding question
2003-04-06 5:05 Kevin Reeder
2003-04-06 11:14 ` maierh
@ 2003-04-07 10:10 ` Jerome Besnard
2003-04-08 4:09 ` Kevin Reeder
1 sibling, 1 reply; 8+ messages in thread
From: Jerome Besnard @ 2003-04-07 10:10 UTC (permalink / raw)
> When using the python interpreter within emacs, I'd like to have the
> up/down arrows echo previous commands. Can anyone give me the code for
> this?
The pyhton shell uses comint-mode (for input-output in shell-like modes). In
comint mode, previous commands are echoed via C-up and C-down.
But if you really prefer to have these with up/down arrows, you should set
comint-previous-command and comint-next-command to up/down.
Something (untested) like:
(define-key comint-mode-map [up] 'comint-previous-command)
(define-key comint-mode-map [down] 'comint-next-command)
should do the trick.
--
Jerome
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: key binding question
2003-04-07 10:10 ` Jerome Besnard
@ 2003-04-08 4:09 ` Kevin Reeder
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Reeder @ 2003-04-08 4:09 UTC (permalink / raw)
On Mon, 07 Apr 2003 03:10:36 -0700, Jerome Besnard wrote:
>> When using the python interpreter within emacs, I'd like to have the
>> up/down arrows echo previous commands. Can anyone give me the code for
>> this?
>
> The pyhton shell uses comint-mode (for input-output in shell-like
> modes). In comint mode, previous commands are echoed via C-up and
> C-down. But if you really prefer to have these with up/down arrows, you
> should set comint-previous-command and comint-next-command to up/down.
> Something (untested) like:
> (define-key comint-mode-map [up] 'comint-previous-command) (define-key
> comint-mode-map [down] 'comint-next-command)
>
> should do the trick.
I'll try C-up/down and add make the change to my init file later if
necessary. It's second nature to hit up or down when I'm using the
shell, but adding the C- shouldn't take much getting used to.
Thanks.
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-02-13 6:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-10 13:00 key binding question Hadron
2007-02-12 4:42 ` Kevin Rodgers
[not found] ` <mailman.4372.1171255378.2155.help-gnu-emacs@gnu.org>
2007-02-12 9:11 ` Hadron
2007-02-13 6:36 ` Kevin Rodgers
-- strict thread matches above, loose matches on Subject: below --
2003-04-06 5:05 Kevin Reeder
2003-04-06 11:14 ` maierh
2003-04-07 10:10 ` Jerome Besnard
2003-04-08 4:09 ` Kevin Reeder
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).