emacs zoom in/zoom out

This config worked for me:

(global-set-key [C-wheel-up] 'text-scale-increase)
(global-set-key [C-wheel-down] 'text-scale-decrease)

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)

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)

Tags:

Emacs