The recenter command in emacs is recenter-top-bottom which I can invoke using Ctrl-l. How can I call this command automatically every time the cursor is on the fifth-last line in the visible frame?


I am manually editing one column in a large csv file with 4000 rows and I have turned on overwrite mode and I have remapped the 0 and 1 keys so that they automatically add a new line, like this:

(local-set-key (kbd "1") (lambda () (interactive)
 (self-insert-command 1) (next-line) (left-char)))

So I don't have to press any arrow keys. One last thing that I want to automate is the recentering.

  • 2
    Have a look at the variable scroll-margin. – lawlist Apr 22 '19 at 1:39
  • Thanks for the pointer :) – Pushpendre Apr 22 '19 at 8:16

Your Answer

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

Browse other questions tagged or ask your own question.