[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `scroll-conservatively'
From: |
chming |
Subject: |
Re: `scroll-conservatively' |
Date: |
27 May 2007 13:22:37 -0700 |
User-agent: |
G2/1.0 |
This might be better.
(defun scroll-one-line-up (&optional arg)
"Scroll the selected window up (forward in the text) one line (or N
lines)."
(interactive "p")
(let ((pos
(save-excursion
(previous-line (or arg 1))
(point))))
(if (not (pos-visible-in-window-p pos))
(progn
(scroll-down (or arg 1))
(previous-line (or arg 1)))
(previous-line (or arg 1)))))
(defun scroll-one-line-down (&optional arg)
"Scroll the selected window down (backward in the text) one line (or
N)."
(interactive "p")
(let ((pos
(save-excursion
(next-line (or arg 1))
(point))))
(if (not (pos-visible-in-window-p pos))
(progn
(scroll-up (or arg 1))
(next-line (or arg 1)))
(next-line (or arg 1)))))