9

Sometimes, when I scroll up in eshell, point leaves the command prompt line to stay in the visible area. When I then enter a command, I don't enter the command at the prompt, but rater insert the text somewhere into the output of previously called commands. This is pretty annoying.

How can I make sure that eshell returns point to the command prompt when I enter a char, just like in other shells?

/edit: Here is a screencast of the situation. I type ls, then I scroll up to review the output, then decide that I want to do a cd .., but because it just inserts the command at point, it turns out to be garbage.

eshell-scroll-point

3
  • I don't think it is annoying. In Eshell, you can run a command from anywhere and using previous output, not only after the last command prompt, it is obviously a very cool feature. For me, this feature is the main reason that I use Eshell. To goto the last command prompt, I use M->.
    – xuchunyang
    Commented Jul 25, 2015 at 4:01
  • Is there the possibility to provide a screenshot of a case where the point leaves the command line and you would like to return the point to the command prompt by inserting an arbitrary character? Is the left point in the same line that the last prompt? Do you like to return to the last prompt? What if there is some incompleted text at the last prompt?
    – Name
    Commented Jul 25, 2015 at 5:36
  • @xuchunyang: The problem is really that the point moves away from the prompt when I don't want it to (i.e., when I scroll up, see the screencast). So having the point stay at the prompt unless I move it somewhere by myself would be the 'real' solution. Seems like the point must always be in the visible area in emacs though.
    – Geier
    Commented Jul 26, 2015 at 20:18

2 Answers 2

5
(setq eshell-scroll-to-bottom-on-input t)

should do what you want.

2
  • This seems to work.
    – Name
    Commented Jul 25, 2015 at 6:03
  • 1
    Yep, that works. Here's a screencast: i.imgur.com/Mjzt8j2.gif
    – Geier
    Commented Jul 26, 2015 at 20:20
0

I think what you are looking for is the Plan 9 Smart Shell behavior in Emacs. Mickey Peterson covered it in his recent book Mastering Emacs, which involves adding these to your init.el file:

(require 'eshell)
(require 'em-smart)
(setq eshell-where-to-jump 'begin)
(setq eshell-review-quick-commands nil)
(setq eshell-smart-space-goes-to-end t)
2
  • Doesn't work :(
    – Geier
    Commented Jul 24, 2015 at 21:06
  • There three options already have the same value as you set (at least in Emacs 25 which I'm using), so you might don't set them again now.
    – xuchunyang
    Commented Jul 25, 2015 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.