all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* code snippet to do very smooth scrolling
@ 2003-02-11 22:31 zhaoway
  0 siblings, 0 replies; only message in thread
From: zhaoway @ 2003-02-11 22:31 UTC (permalink / raw)


Here is my first try to do very smooth scrolling. Do you like it?

It moves the window one line down or up the buffer, keeps the cursor
one line down or up its current position, and if possible, at the same
column.

----8<----
(global-set-key (kbd "<next>") 'my-page-down)
(defun my-page-down ()
  "12Feb03"
  (interactive)
  (let ((pos (point)))
    (goto-char (window-start))
    (next-line 1)
    (set-window-start (selected-window)
                      (point))
    (goto-char pos)
    (next-line 1)))

(global-set-key (kbd "<prior>") 'my-page-up)
(defun my-page-up ()
  "12Feb03"
  (interactive)
  (let ((pos (point)))
    (goto-char (window-start))
    (previous-line 1)
    (set-window-start (selected-window)
                      (point))
    (goto-char pos)
    (previous-line 1)))
---->8----

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-11 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-11 22:31 code snippet to do very smooth scrolling zhaoway

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.