From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: maierh@myself.com Newsgroups: gmane.emacs.help Subject: Re: key binding question Date: Sun, 06 Apr 2003 13:14:03 +0200 Organization: T-Online Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <6AOja.383118$sf5.707842@rwcrnsc52.ops.asp.att.net> Reply-To: Harald Maier NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1049628033 17727 80.91.224.249 (6 Apr 2003 11:20:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 6 Apr 2003 11:20:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 06 13:20:32 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1928CO-0004bl-00 for ; Sun, 06 Apr 2003 13:20:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 1928CS-00028c-00 for gnu-help-gnu-emacs@m.gmane.org; Sun, 06 Apr 2003 07:20:36 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-X-Trace: news.t-online.com 1049627643 03 20446 KbsxEeWESKA5rM 030406 11:14:03 Original-X-Complaints-To: abuse@t-online.com X-ID: EBlTsMZaoeP7SNGYlYMQ0pImk4xvn779AE6X-gbdSVOY9tUSPzzb6t User-Agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:x0mFD4qy6n+bpIflnKP1WrAmqbk= Original-Xref: shelby.stanford.edu gnu.emacs.help:111719 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8220 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8220 Kevin Reeder 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