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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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