Skip to content

Attempt at good pixel-based smooth scrolling in Emacs

License

Notifications You must be signed in to change notification settings

io12/good-scroll.el

Repository files navigation

MELPA Check

good-scroll.el

Attempt at good pixel-based smooth scrolling in Emacs

About

This package implements smooth scrolling by pixel lines. It attempts to improve upon pixel-scroll-mode by adding variable speed.

Demo

Setup

Install and load the package. Then, enable good-scroll-mode. For example, you can add the following snippet to your config.

(good-scroll-mode 1)

Key bindings

If you want to bind the Page Up and Page Down keys, you can also add the following:

(global-set-key [next] #'good-scroll-up-full-screen)
(global-set-key [prior] #'good-scroll-down-full-screen)

FAQ

How does this work?

Instead of scroll events directly scrolling the screen, they update a destination variable. A timer that runs every good-scroll-render-rate seconds calculates the expected position and actually scrolls the window to it. To make the window scrolled partially through a line, good-scroll updates the window's vscroll (vertical scroll) position.

Why is performance sometimes bad?

Scrolling sometimes pauses or stutters. It's unclear exactly why, but one factor is that Emacs lacks animation support. Emacs has timers for updating the screen contents, which is enough for playing simple animated GIF files, but not enough for video playback or frame-perfect smooth scrolling.

How does this compare to other scrolling packages?

Other modifications, like smooth-scrolling, smooth-scroll, sublimity-scroll, and inertial-scroll also aim to improve scrolling in Emacs, but none of them involve scrolling by pixel lines, only by text lines. The built-in pixel-scroll does implement pixel line scrolling, but, unlike good-scroll, does not support dynamic scrolling velocity.

Why is this file written in Markdown and not Org?

Apparently, GitHub does not yet support rendering Org links with formatting inside of them.

novoid/github-orgmode-tests#3