geek-boy

Quick Emacs Tip: Scale fonts in a buffer

Emacs23 includes default keybindings for scaling fonts up or down:
C-x C-+ — scale the current buffer's face/font up

C-x C-+ — scale the current buffer's face/font down

This is good as far as it goes, but I'd really like something a little easier. So I've added the following to my .emacs file:
(global-set-key [(control mouse-4)] (lambda () (interactive)
                                      (text-scale-increase 1)))
(global-set-key [(control mouse-5)] (lambda () (interactive)
                                      (text-scale-decrease 1)))

Now, if I hold down the control key and scroll the mouse wheel, the font will get larger or smaller. Some other applications (e.g. Firefox) use "Control +" and "Control -" to do something similar along with "Control 0" to return to the default size. You could set these keybindings in Emacs without losing too much (unless you're used to C-- and C-0 as prefixes, in which case, you still have C-M-- and C-M-0):
(global-set-key [(control ?+)] (lambda () (interactive)
                                      (text-scale-increase 1)))
(global-set-key [(control ?-)] (lambda () (interactive)
                                      (text-scale-decrease 1)))
(global-set-key [(control ?0)] (lambda () (interactive)
                                      (text-scale-increase 0)))


None of this will permanently affect the size of the font, so for the next buffer you open or the next time you start Emacs, you'll have the same size font you started with. If you want to change the default font size, use M-x customize-face RET default RET instead.
Tags:

Comments

hello i am so sorry that i stopped replying to your e-mails and comments! i got sidetracked and stopped paying attention but would you still be interested in accepting payments or something from users? :-) i could give you money on a monthly basis if it would be enough to raise the userpic count on certain accounts and maybe fix the issue with interests linking up when they match! the reason i registered so many accounts on my e-mail is that some of them are for friends of mine, by the way since i just realized that you asked :{
Would $60/yr be too much? We could set it up so that Paypal charged you and your friends $5/month each. If you were able to get some friends to join in, I'd be very willing to help you guys out quite a bit. ("Quite a bit" but I do need my sleep ;) )

If that is reasonable, then I can set it up for you.
no that wouldn't be too much at all! in fact, i was thinking about maybe paying you $60 up front and then we could work out a payment plan because the other users really aren't as financially well off as i am! :{ i could probably pay you enough for multiple users, maybe $20 or $30 or even more than that a month to make up for that! :-) i think that would be a perfect amount to ask for actually, since we would be hoping to up the userpic limit even if it's only to 30/40 for every account! i'd be willing to pay a certain amount of money per account or something like that :} i'm sorry this took forever jeez