How to set the font size in Emacs?

前端 未结 17 1681
囚心锁ツ
囚心锁ツ 2020-11-28 17:43

I also want to save the font size in my .emacs file.

17条回答
  •  甜味超标
    2020-11-28 18:00

    Here's an option for resizing the font heights interactively, one point at a time:

    ;; font sizes
    (global-set-key (kbd "s-=")
                    (lambda ()
                      (interactive)
                      (let ((old-face-attribute (face-attribute 'default :height)))
                        (set-face-attribute 'default nil :height (+ old-face-attribute 10)))))
    
    (global-set-key (kbd "s--")
                    (lambda ()
                      (interactive)
                      (let ((old-face-attribute (face-attribute 'default :height)))
                        (set-face-attribute 'default nil :height (- old-face-attribute 10)))))
    

    This is preferable when you want to resize text in all buffers. I don't like solutions using text-scale-increase and text-scale-decrease as line numbers in the gutter can get cut off afterwards.

提交回复
热议问题