I am a high school computer science teacher and would like to use emacs to present programs to my students. I would like to be able to present the programs, even short ones, one line at a time and not have the whole program show in the emacs buffer from the start.
Thus I would like emacs to hide all the lines below the current line and reveal each line when I move the cursor down to that line.
Try this:
(defun narrow-next-line ()
(interactive)
(widen)
(call-interactively 'move-end-of-line)
(forward-char)
(call-interactively 'move-end-of-line)
(narrow-to-region 1 (point)))
(global-set-key (kbd "C-x n i") 'narrow-next-line)
Choose your own hotkey for this command. See also http://www.gnu.org/software/emacs/manual/html_node/emacs/Narrowing.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With