all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Brett <peter@peter-b.co.uk>
To: emacs-devel@gnu.org
Subject: Re: set font size with ctrl-mouse wheel?
Date: Thu, 30 Jul 2009 15:02:44 +0100	[thread overview]
Message-ID: <we1m1vnyfeuz.fsf@ssclt003.ee.surrey.ac.uk> (raw)
In-Reply-To: h4s1jp$nl4$1@ger.gmane.org

Neal Becker <ndbecker2@gmail.com> writes:

> It is becoming fairly standard to use ctrl+mouse-wheel to increase/decrease 
> font size.

It is?  A quick straw poll of editors and other dev tools:

gvim             n
gedit            n
nedit            n
Bluefish         n
cssed                  y
geany                  y
quanta           n
SciTE                  y
Eclipse          n
xml-copy-editor        y
Kmail            n
Kile             n   
GNU TeXMACS      n

...indicates that by "fairly standard" you mean "some applications do it".

> It'd be great if emacs could do this.

It can.  This should get you started. [*]

(defvar text-height-scale-factor 0.2)

(defun scale-text-height (s)
  "Scale the current text height"
  (set-face-attribute 'default nil :height
    (truncate (* s (face-attribute 'default :height)))))
(defun reduce-text-height ()
  "Reduce the text height"
  (interactive)
  (scale-text-height (- 1.0 text-height-scale-factor)))
(defun increase-text-height ()
  "Increase the text height"
  (interactive)
  (scale-text-height (+ 1.0 text-height-scale-factor)))

(global-set-key [C-mouse-4] 'reduce-text-height)
(global-set-key [C-mouse-5] 'increase-text-height)


Best wishes,

                                          Peter

[*] Someone will be along shortly to explain how I could have achieved
    this in less than half as much ELisp.

-- 
Peter Brett <peter@peter-b.co.uk>
Remote Sensing Research Group
Surrey Space Centre





  parent reply	other threads:[~2009-07-30 14:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30 11:53 set font size with ctrl-mouse wheel? Neal Becker
2009-07-30 13:45 ` Drew Adams
2009-07-31 10:46   ` Neal Becker
2009-07-31 13:39     ` Tassilo Horn
2009-07-31 15:54       ` Drew Adams
2009-07-31 15:50     ` Drew Adams
2009-07-30 14:02 ` Peter Brett [this message]
2009-07-30 14:28 ` Leo
2009-07-30 14:42   ` Drew Adams
2009-07-30 18:00     ` Leo
2009-07-30 19:18       ` Drew Adams
2009-07-30 20:28         ` Leo
2009-07-30 21:20           ` Drew Adams
2009-07-30 22:31             ` Chad Brown
2009-07-31  6:37               ` CHENG Gao
2009-07-31  6:59             ` Jan Djärv
2009-07-31 15:25               ` Drew Adams
2009-07-30 21:02 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=we1m1vnyfeuz.fsf@ssclt003.ee.surrey.ac.uk \
    --to=peter@peter-b.co.uk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.