4

when I execute a command on eshell the prompt switches to the bottom of the window. I have to C-l a few times to get it back on top. Once again after I execute anything it goes back to the bottom of the window. It is infuriating. How do I make sure the eshell prompt stays on 'top' of the window at all times with the previous commands being hidden above the window. I don't know if 'window' is correct terminology. Please correct me if not.

3

You can disable the Eshell's scroll feature using:

(add-hook 'eshell-mode-hook
          (defun chunyang-eshell-mode-setup ()
            (remove-hook 'eshell-output-filter-functions
                         'eshell-postoutput-scroll-to-bottom)))

Notes, (eval-after-load "eshell" (remove-hook ...)) doesn't work correctly according to my experiment, it simply sets eshell-output-filter-functions to nil, I don't know the cause. You can also use the Custom interface with:

M-x customize-option RET eshell-output-filter-functions RET

this way works too and is much easier, since this option is available until Eshell has been invoked, if you can't find this option, type M-x eshell then try again.

  • I do not have eshell-output-filter-functions option available. What should I do? – minibuffer Nov 22 '16 at 6:45
  • 1
    @JackDawkins I am not sure what's your meaning. Emacs 24.3 has this option, probably some earlier versions has it too. Besides, the option is only available AFTER Eshell has been invoked. – xuchunyang Nov 22 '16 at 6:58
  • Yes, indeed it worked after I invoked eshell. Thanks. – minibuffer Nov 22 '16 at 7:06
  • Well it goes back to doing what it did before in the middle of an editing session. scrolls to the bottom. I made sure I 'apply and save' it. Why is this happening? – minibuffer Nov 22 '16 at 8:01
  • I usually execute clear command in zsh when my workspace gets cluttered. I did the same in eshell. The saved setting gets deleted when I do this it seems – minibuffer Nov 22 '16 at 8:19
3

You might check whether eshell-scroll-to-bottom-on-output is set to nil. Here's the documentation:

Documentation: Controls whether interpreter output causes window to scroll. If nil, then do not scroll. If t or ‘all’, scroll all windows showing buffer. If ‘this’, scroll only the selected window. If ‘others’, scroll only those that are not the selected window.

  • Where exactly do I change this?. I don't have any customizations for eshell on my .emacs.d/init.el file. – minibuffer Nov 22 '16 at 6:47
  • If you do M-x Customize and then type eshell it will take you to the customize screen. Scroll down and you'll see the setting. Or alternately, just put (setq eshell-scroll-to-bottom-on-output nil) in your init.el file. – mclear Nov 22 '16 at 7:56
  • It gives me the following four options.1. Do not scroll eshell windows. 2. scroll all windows showing the buffer 3. scroll only the selected window. 4. scroll all windows other than selected. Which one should I choose?. I am confused. – minibuffer Nov 22 '16 at 8:06
  • Since you don't want to go to the bottom of the window it should be set to 1. do not scroll. Or you can do the setq option that I mention above. – mclear Nov 22 '16 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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