emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: set font size with ctrl-mouse wheel?


From: Drew Adams
Subject: RE: set font size with ctrl-mouse wheel?
Date: Fri, 31 Jul 2009 08:50:34 -0700

> Thanks!  I can confirm zoom-frm works.  But, it also requires:
> frame-fns.el
> frame-cmds.el
> 
> I favor adding (at least the abililty to easily bind, if not 
> the default binding) of ctrl-mouse-wheel as standard in emacs

So do I.

> but I think requiring all 3 of these files to do it is a bit
> heavy-weight.

Yes, of course. But those libraries do more than that.

> Perhaps there is a simpler approach?

Just extract the part of those libraries that does only what you want.

If all you want is text scaling (available starting with Emacs 23), then this is
all you need (extracted from the definitions in zoom-frm.el):

(defun zoom-in ()
 (interactive)
 (with-current-buffer
     (if (string-match "mouse" (format "%S" (event-basic-type
                                             last-command-event)))
         (window-buffer (posn-window (event-start last-command-event)))
       (current-buffer))
   (text-scale-increase 1)))

(defun zoom-out ()
 (interactive)
 (with-current-buffer
     (if (string-match "mouse" (format "%S" (event-basic-type
                                             last-command-event)))
         (window-buffer (posn-window (event-start last-command-event)))
       (current-buffer))
   (text-scale-decrease 1)))

(global-set-key (vector (list 'control mouse-wheel-down-event)) 'zoom-in)
(global-set-key (vector (list 'control mouse-wheel-up-event)) 'zoom-out)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]