mouseevent - Emacs font sizing with Ctrl key and mouse scroll -


notepad++ allow me increase font size when hold ctrl key , rotate mouse middle scroll button forward.

in same way, when hold ctrl , rotate mouse middle scroll button backward, fond size reduces.

how can same emacs?

code 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 "<c-wheel-down>") 'font-small) (global-set-key (kbd "<c-wheel-up>") 'font-big) 

edit: min , 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)))) 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -