Emacs: Set Line Spacing

By Xah Lee. Date: . Last updated: .

You can change line spacing by setting the variable line-spacing.

emacs line spacing 2020-04-13 jskdz
emacs line spacing 2020-04-13

To set a default line spacing, put this in your emacs init file:

(setq-default line-spacing 0.5)

The value can be a integer or decimal number.

To experiment without restart, you can set line spacing in current buffer, by typing (setq line-spacing 0.5) in a buffer, move cursor to the end, then Alt+x eval-last-sexpCtrl+x Ctrl+e】. [see Emacs: Evaluate Elisp Code]

Note that the spacing height between lines also depends on font. [see Emacs: Font Setup]

Toggle Line Spacing Command

Here's a command that lets you toggle line spacing between 2 values.

(defun xah-toggle-line-spacing ()
  "Toggle line spacing between no extra space to extra half line height.
URL `http://ergoemacs.org/emacs/emacs_toggle_line_spacing.html'
Version 2017-06-02"
  (interactive)
  (if line-spacing
      (setq line-spacing nil)
    (setq line-spacing 0.5))
  (redraw-frame (selected-frame)))

This is useful for switching between reading source code and reading novels. [see Emacs: Novel Reading Mode]

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