Emacs: Proportional Font

By Xah Lee. Date: . Last updated: .

Alt+x variable-pitch-mode to toggle between fixed-width and variable-width font. (monospace vs proportional)

The font change is for current file/buffer only.

(For setting up font in init file, see Emacs: Font Setup)

emacs variable pitch mode
Alt+x variable-pitch-mode
emacs variable-pitch-mode 2015-09-21
Alt+x variable-pitch-mode , for reading code.

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.

(Thanks to Oscar Carlsson for suggesting variable-pitch-mode.)

Setup Proportional Font by Major Mode

Here's how to make some mode always use proportional font.

(progn
  ;; use variable-width font for some modes
  (defun xah-use-variable-width-font ()
    "Set current buffer to use variable-width font."
    (variable-pitch-mode 1)
    ;; (text-scale-increase 1 )
    )
  (add-hook 'nxml-mode-hook 'xah-use-variable-width-font)
  (add-hook 'emacs-lisp-mode-hook 'xah-use-variable-width-font)
  (add-hook 'js-mode-hook 'xah-use-variable-width-font)
  (add-hook 'css-mode-hook 'xah-use-variable-width-font)
  (add-hook 'html-mode-hook 'xah-use-variable-width-font)
  (add-hook 'mhtml-mode-hook 'xah-use-variable-width-font))

[see Emacs: Font Setup]

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys

ELisp

ELisp Examples

ELisp Write Major Mode


Emacs Init

Init Basics

packages

text editing

file

appearance

misc