The Mastering Emacs ebook cover art

Emacs 28 Edition is out now!

Read a Free Sample

Learn More

Improving the performance of Emacs’s Display Engine?

Quick tip to improving the performance of Emacs's display engine.

I came across an interesting thread on the GNU Emacs developer mailing list about an obscure variable called redisplay-dont-pause and I figured I’d talk about it.

So, currently, if Emacs is busy redrawing the screen any input event (keyboard, mouse) will halt the redrawing and abort to handle the input event. The obvious benefit here is that the user will get a smoother typing experience, especially on older machines where display updates were slow. Nowadays, though, you could argue that this is an unnecessary and very conservative setting as it will cause screen tearing.

The variable redisplay-dont-pause, when set to t, will cause Emacs to fully redraw the display before it processes queued input events. This may have slight performance implications if you’re aggressively mouse scrolling a document or rely on your keyboard’s auto repeat feature. For most of us, myself included, it’s probably a no-brainer to switch it on.

Add this to your .emacs file to enable this functionality:

(setq redisplay-dont-pause t)

Further Reading

Have you read my Reading Guide yet? It's a curated guide to most of my articles and I guarantee you'll learn something whether you're a beginner or an expert. And why not check out my book?

Subscribe to the Mastering Emacs newsletter

I write infrequently, so go on — sign up and receive an e-mail when I write new articles