Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs zoom in/zoom out

Tags:

emacs

Is there a way to zoom in and out (dynamically change the font size, quite smoothly) on emacs?

like image 666
sawa Avatar asked Apr 03 '11 23:04

sawa


3 Answers

Try C-x C-+ and C-x C--; that is, Control-x Control-Minus/Control-Plus.

After one combination (C-x C-+ or C-x C--), successives + or - increase or decrease the text scale without typing C-x C- again.

Addition by sawa

I looked up the function that was assigned to the keys mentioned, and found out that they are text-scale-increase and text-scale-decrease. I added the following to my configuration file so that I can do Ctrl+Scroll to zoom in/out. It is useful.

(global-set-key [C-mouse-4] 'text-scale-increase)
(global-set-key [C-mouse-5] 'text-scale-decrease)
like image 165
7 revs, 6 users 44% Avatar answered Nov 10 '22 19:11

7 revs, 6 users 44%


The -very nice- answer of user173973 is binding the functions to non-generic mouse events. That is to say that for example on my windows system, the binding command is not valid.

To use it on windows (or probably anywhere) you can use these generic bindings :

(global-set-key [C-mouse-wheel-up-event]  'text-scale-increase)
(global-set-key  [C-mouse-wheel-down-event] 'text-scale-decrease)
like image 8
Peter Avatar answered Nov 10 '22 19:11

Peter


This config worked for me:

(global-set-key [C-wheel-up] 'text-scale-increase)
(global-set-key [C-wheel-down] 'text-scale-decrease)
like image 1
Stacksys Avatar answered Nov 10 '22 20:11

Stacksys