I'd like to apply a line-height
property to all text in all buffers to add space above each line (so line-spacing
doesn't work, I think).
I've added a function to 'buffer-list-update-hook
to create and propertize an overlay that spans the entire buffer (also set to grow with text on either end). This works, but feels like a big hack for something this simple. Is there no better way of doing this?
(defvar fov-line-height-overlay nil
"Overlay used to manage line-height across the buffer")
(make-variable-buffer-local 'fov-line-height-overlay)
(defun fov-update-line-height-overlays ()
"Run through the list of buffers and ensure they have an overlay for line-height."
(dolist (buf (buffer-list))
(with-current-buffer buf
(unless fov-line-height-overlay
(setq fov-line-height-overlay (make-overlay (point-min) (point-max) nil nil t))
(overlay-put fov-line-height-overlay 'line-height 1.2)))))
(add-hook 'buffer-list-update-hook 'fov-update-line-height-overlays)
PS: The reason I'm doing this is I've set the hl-line
face to have a box with :line-width -1
(to avoid jitter while moving) but now I need more space for the text.