From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Okam Newsgroups: gmane.emacs.help Subject: Re: Making ielm behave like a shell (getting to previous commands using the up-arrow key) Date: Thu, 17 Dec 2020 03:34:48 +0000 Message-ID: <73f77f84-638c-c044-8012-154f08f28256@protonmail.com> References: Reply-To: Okam Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11934"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 17 16:51:19 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpvYk-0002vL-Bb for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 17 Dec 2020 16:51:18 +0100 Original-Received: from localhost ([::1]:36796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpvYj-0000bK-CX for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 17 Dec 2020 10:51:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpk4G-0006m8-2A for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 22:35:04 -0500 Original-Received: from mail-40134.protonmail.ch ([185.70.40.134]:34477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpk4D-0001OK-74 for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 22:35:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1608176091; bh=bYXMwm6sTEdL69B8+M1kNs7g9mZFe09SSED25/DF9TA=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=ZgiyEt5WVY/jAHIpTLsi1fQI1nFH+hb2NYiGRxErSMdWYlxwRoLd9AUWdJfcHvr6y 77eb9Cyd0tGUVlfjtFvZEZALViYEXDuIC4LMoBuP4IFW4JG7M0aY5uPbSJKOwL3mj9 pFMPxOKH9d4tmFYXenV8SY41XpHy2OaV6FqDa/ds= In-Reply-To: Received-SPF: pass client-ip=185.70.40.134; envelope-from=okamsn+emacs-org@protonmail.com; helo=mail-40134.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 17 Dec 2020 10:49:53 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126464 Archived-At: On 12/16/20 10:02 PM, steve-humphreys@gmx.com wrote: >=20 >=20 > I have started using ielm and would be useful for it to behave like a ter= minal > That is enabling history on ielm to view all the previous executed comman= ds > using the Up Arrow Key. >=20 > Regards > Steve >=20 If you're not already aware, many places in Emacs allow you to access=20 your input history using "M-n" and "M-p". This works in IELM and Term,=20 for example. You can check what commands these keys run using the command=20 `describe-key', which is bound to [F1 k] and "C-h k". You'll see that=20 "M-n" and "M-p" run the commands `comint-next-input' and=20 `comint-previous-input', respectively. If you want to rebind [up] and [down] to cycle history instead of moving=20 the cursor, you can do (define-key ielm-map (kbd "") #'comint-previous-input) (define-key ielm-map (kbd "") #'comint-next-input) which applies only to IELM. If you would like to have that behavior in=20 every mode that uses Comint (such as Term, the inferior Python shell,=20 etc.), then you can define the key in `comint-mode-map' instead.