5

I have been using Emacs shell mode for some time, but one thing keeps bothering me. After I split the window vertically with Ctrl+3, invoke M-x shell and fill the window with commands and output, whenever I execute a command, the pointer jumps to the middle of the screen, where there are usually outputs of previous command. I could Alt+> to jump to where the new prompt is, but that is tedious. However, Emacs works well if I do not split the window, i.e. keeps the pointer at the bottom of the screen.

Another fact (not the same question) that I happened to found is that I could keep all the outputs in the upper half of the screen, while leaving the lower half blank. Is this triggered by some shortcut?

For clarification, I just want my Emacs shell's output behave like a common shell like bash, i.e. keeps the pointer at the bottom. The pointer in emacs sometimes jumps to the middle of the screen after I enter a command.

Hopefully I have made myself understood.

2 Answers 2

2

Question solved in this link.

That is, add the following code to ~/.emacs

(remove-hook 'comint-output-filter-functions 'comint-postoutput-scroll-to-bottom)

after pressing c-l c-l in shell-mode.

0
(defun eshell/clc()
  "to clear the eshell buffer."
  (interactive)
  (let ((inhibit-read-only t))
    (erase-buffer)))

Type "clc" in emacs shell and it clears the screen.

2
  • 1
    I am sorry, but this does not work for my emacs shell. Also this is not what I want. I have edited the question for clarification.
    – user55872
    Oct 26, 2012 at 5:46
  • Thanks for reformatting, @devav2. But this does not seem to work for me. Is it supposed to be pasted into "/.emacs"? I did that, but in shell mode, found that "no command 'clc' found".
    – user55872
    Nov 2, 2012 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .