[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: key binding question
From: |
maierh |
Subject: |
Re: key binding question |
Date: |
Sun, 06 Apr 2003 13:14:03 +0200 |
User-agent: |
Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.3 (windows-nt) |
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