help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making ielm behave like a shell (getting to previous commands using


From: Okam
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

On 12/16/20 10:02 PM, steve-humphreys@gmx.com wrote:
> 
> 
> I have started using ielm and would be useful for it to behave like a terminal
> That is enabling history on ielm to view all the previous executed commands
> using the Up Arrow Key.
> 
> Regards
> Steve
> 

If you're not already aware, many places in Emacs allow you to access 
your input history using "M-n" and "M-p". This works in IELM and Term, 
for example.

You can check what commands these keys run using the command 
`describe-key', which is bound to [F1 k] and "C-h k". You'll see that 
"M-n" and "M-p" run the commands `comint-next-input' and 
`comint-previous-input', respectively.

If you want to rebind [up] and [down] to cycle history instead of moving 
the cursor, you can do

   (define-key ielm-map (kbd "<up>") #'comint-previous-input)
   (define-key ielm-map (kbd "<down>") #'comint-next-input)

which applies only to IELM.  If you would like to have that behavior in 
every mode that uses Comint (such as Term, the inferior Python shell, 
etc.), then you can define the key in `comint-mode-map' instead.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]