Emacs stops you from scrolling past the end of a document; i.e., it doesn't allow you to lift the last line up to the top of the visible buffer, or vice versa with the starting line. Sometimes this is irritating if I've, say, pulled down a hanging terminal like Guake and would like to slide something into view there. I took a look around and didn't see any documentation relating to this. Is there a way to configure this?

1 Answer 1


You can lift the last line to the top of the visible buffer by issuing recenter-top-bottom repeatedly (twice if you haven't customized recenter-positions). By default, this command is bound to C-l (that's a lower-case L).

  • Is there an equivalent command for the top? Jan 12, 2014 at 7:29
  • @TrevorAlexander I'm not sure what you mean? If you want the recenter-top-bottom command to lift the line you're on to the top first, you can customize the variable recenter-position. Its default value is (middle top bottom); set it to (top middle bottom) to achieve the behaviour you want.
    – itsjeyd
    Jan 12, 2014 at 9:13
  • Sorry, I meant that the command you mentioned seems to work until you get to the top of the buffer; with that command emacs will not make empty space on the top as it does with the bottom. Jan 12, 2014 at 10:31
  • 1
    OK, I see what you mean now. I am not aware of any built-in commands that would work for the top line of a buffer. You'd probably have to advise the recenter-top-bottom function to get this type of behavior. If you choose to go that route, check out the "Simple Advice" section in the link I gave you. It shows how to do something similar to what you are trying to do for the previous-line command (which also doesn't allow to move past the first line of a buffer by default).
    – itsjeyd
    Jan 12, 2014 at 12:24

You must log in to answer this question.

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