Emacs: Toggle Monospace / Proportional Font

By Xah Lee. Date: . Last updated: .

Toggle Monospace / Proportional Font

Alt+x variable-pitch-mode
Toggle between monospace and proportional font, in current buffer.
emacs variable-pitch-mode 2021-09-25 SyP3
emacs variable-pitch-mode 2021-09-25
emacs variable pitch 2024-10-08
emacs variable pitch 2024-10-08

Proportional font is useful for reading info doc, email, etc. Proportional font is easier to read, and shows 20 or more characters per line. It also works great for coding too (except Python). Try it. You may be surprised.

2010-12-01 Thanks to Oscar Carlsson for suggesting variable-pitch-mode.

Problem of Using Non-Monospace Font in Code

Tried to use Non-Monospace in code, for few months in different years. But i always ends up not adopting.

problem is hard to describe, various minor details.

one of them, is that in emacs, it screws up the alignment of left margin when you have line numbering on.

emacs variable-pitch-mode 2024-12-01 094047
emacs variable-pitch-mode 2024-12-01 094047

variable-pitch-mode regex string legibility problem

another problem is when you have complex regex string.

with variable width font, it cannot distinguish neighbor APOSTROPHE and QUOTATION MARK.

in general, regex became harder to read if it contains space or l1|O0

emacs variable-pitch-mode regex 2024-12-02 081255
emacs variable-pitch-mode regex 2024-12-02 081255

Emacs Monospace, Proportional Font

Emacs, font setup