Emacs font sizing with Ctrl key and mouse scroll

前端 未结 5 1777
庸人自扰
庸人自扰 2020-12-31 06:17

notepad++ allow me to increase the font size when I hold the Ctrl Key and rotate the mouse middle scroll button to forward.

In the same way, the when I ho

5条回答
  •  爱一瞬间的悲伤
    2020-12-31 06:40

    code for AlexCombas' answer:

    (defun font-big ()
     (interactive)
     (set-face-attribute 'default nil :height 
      (+ (face-attribute 'default :height) 10)))
    
    (defun font-small ()
     (interactive)
     (set-face-attribute 'default nil :height 
      (- (face-attribute 'default :height) 10)))
    
    (global-set-key (kbd "") 'font-small)
    (global-set-key (kbd "") 'font-big)
    

    Edit: for a min and a max use

    (defun font-big ()
     (interactive)
     (set-face-attribute 'default nil :height 
      (min 720
       (+ (face-attribute 'default :height) 10))))
    
    (defun font-small ()
     (interactive)
     (set-face-attribute 'default nil :height 
      (max 80
       (- (face-attribute 'default :height) 10))))
    

提交回复
热议问题