Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to trigger a scroll in emacs when my cursor gets within 4 lines from the top or bottom of the terminal.

My .vimrc file contains this line:

:set scrolloff=4

What do I add to .emacs to acheive the same?

PS. I promise not to add it with:

vi ~/.emacs
share|improve this question
up vote 6 down vote accepted

I think scroll-margin will help -- look for it in the Emacs docs on Textual Scrolling.

Put this in your .emacs:

(setq scroll-margin 4)
share|improve this answer

Your Answer


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.