Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
(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.

share|improve this answer
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 '12 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 '12 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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