[IPython-user] ipython in emacs
Alexander Schmolck
a.schmolck@gmx....
Thu Dec 6 04:06:46 CST 2007
"Fernando Perez" <fperez.net@gmail.com> writes:
> On Dec 5, 2007 11:11 PM, wang frank <fw3@hotmail.co.jp> wrote:
>>
>> Hi,
>>
>> Even though I could not make ipython work with emacs 23.2 in window xp. It
>> is very easy to make it work in Linux. However, the most important feature
>> of ipython is missing inside emacs. That is retreiving the previouse command
>> from command history.
>>
>> In ipython running from normal shell, press up and down arrow key will
>> bring back the previouse or next command. If you type some character of
>> previous command and press the up and down arrow key, ipython will automatic
>> search backward for the command starting with the character. If it is not
>> the command you want, you can press the up arrow key again. However, inside
>> emacs, the up and down arrow keys will more the cursor up and down. It
>> cannot retrieve the previous command. If you type the character of the
>> previouse command, up arrow key will not search the command. The tab key
>> will not complete the command inside emacs.
>>
>> Does anyone know how to fix this?
>
> C-up instead of just up. Since Emacs implements its own cursor
> functionality, it overrides readline. So the keystrokes aren't quite
> the same, but you can get pretty much the same functionality (at some
> cost in muscle memory).
No need to strain your poor muscles' limited mental ressources :)
I think the following should do (added somehwere at the front of your .emacs),
either without prefix matching:
(define-key comint-mode-map (kbd "<up>")
'comint-previous-input)
(define-key comint-mode-map (kbd "<down>")
'comint-next-input)
or, I think handier, with:
(define-key comint-mode-map (kbd "<up>") ; (I bind that to M-p)
'comint-previous-matching-input-from-input)
(define-key comint-mode-map (kbd "<next>")
'comint-next-matching-input-from-input)
cheers,
'as
More information about the IPython-user
mailing list