all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles.bader@necel.com>
To: M Jared Finder <jared@hpalace.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: New global bindings
Date: Wed, 04 Jun 2008 11:50:42 +0900	[thread overview]
Message-ID: <buolk1lgbgd.fsf@dhapc248.dev.necel.com> (raw)
In-Reply-To: <g23s4c$54i$1@ger.gmane.org> (M. Jared Finder's message of "Tue,  03 Jun 2008 09:39:39 -0700")

M Jared Finder <jared@hpalace.com> writes:
> I would be happy with C-x C-+/C-x C-- bindings.

Please try the following:

(define-key ctl-x-map [(control ?+)] 'incdec-buffer-face-height)
(define-key ctl-x-map [(control ?-)] 'incdec-buffer-face-height)
(define-key ctl-x-map [(control ?=)] 'incdec-buffer-face-height)
(define-key ctl-x-map [(control ?0)] 'incdec-buffer-face-height)

(defun incdec-buffer-face-height (&optional inc)
  "Increase or decrease the height of the default face in the current buffer.

Then, continue to read input events and increase/decrease the
face height as long as the input events with all modifiers
removed are one of the following:

   +, =   Increase the default face height by one step
   -      Decrease the default face height by one step
   0      Reset the default face height to the global default

Each step scales the height of the default face by the variable
`text-scale-mode-step' (a negative number of steps decreases the
height by the same amount).  As a special case, an argument of 0
will remove any scaling currently active.

This command is a special-purpose wrapper around the
`increase-buffer-face-height' command which makes repetition
convenient even when it is bound in a non-top-level keymap.  For
binding in a top-level keymap, `increase-buffer-face-height' or
`decrease-default-face-height' may be more appropriate."
  (interactive "p")
  (let ((first t) 
	(step t)
	(ev last-command-event))
    (while step
      (let ((base (event-basic-type ev)))
	(cond ((or (eq base ?+) (eq base ?=))
	       (setq step inc))
	      ((eq base ?-)
	       (setq step (- inc)))
	      ((eq base ?0)
	       (setq step 0))
	      (first 
	       (setq step inc))
	      (t
	       (setq step nil))))
      (when step
	(increase-buffer-face-height step)
	(setq inc 1 first nil)
	(setq ev (read-event))))
    (push ev unread-command-events)))


Thanks,

-Miles

-- 
Education, n. That which discloses to the wise and disguises from the foolish
their lack of understanding.




  parent reply	other threads:[~2008-06-04  2:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-03 15:56 New global bindings Stefan Monnier
2008-06-03 16:13 ` Miles Bader
2008-06-03 18:44   ` joakim
2008-06-03 23:39     ` Miles Bader
2008-06-03 16:39 ` M Jared Finder
2008-06-03 17:13   ` Drew Adams
2008-06-04  2:08     ` Miles Bader
2008-06-04  2:50   ` Miles Bader [this message]
2008-06-04  3:46     ` Stefan Monnier
2008-06-04  3:53       ` Miles Bader
2008-06-04  5:11         ` Stefan Monnier
2008-06-04 10:43     ` joakim
2008-06-04 13:30       ` Miles Bader
2008-06-04 14:35         ` Juanma Barranquero
2008-06-04 18:38           ` Stephen Berman
2008-06-03 16:55 ` Eric Hanchrow
2008-06-03 17:35 ` Paul R

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=buolk1lgbgd.fsf@dhapc248.dev.necel.com \
    --to=miles.bader@necel.com \
    --cc=emacs-devel@gnu.org \
    --cc=jared@hpalace.com \
    --cc=miles@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.