2

I am using (global-display-line-numbers-mode) and the code suggested in https://unix.stackexchange.com/a/593889/441805 adapts the line numbers column font scale accordingly to the buffer text font scale

(defun post-text-scale-callback ()
  ;; fix line number text size
  (set-face-attribute 'line-number nil 
                      :height (floor (* (face-attribute 'default :height)
                                        (expt text-scale-mode-step text-scale-mode-amount)))))
(add-hook 'text-scale-mode-hook 'post-text-scale-callback)

but this has the drawback that the line numbers column font scale changes in every buffer now. I am using emacs 28.0.50

1 Answers1

0

Looking into the code of text-scale-adjust in face-remap.el, I believe there is an easy way to do this:

(add-hook 'text-scale-mode-hook (lambda() (face-remap--remap-face 'line-number)))

This basically does the same to the line-number part of the buffer that text-scale-adjust does to the default and the header-line part.

It will only adjust it for the current buffer.

fmech
  • 1