unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul R <paul.r.ml@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
Subject: Re: New global bindings
Date: Tue, 03 Jun 2008 19:35:38 +0200	[thread overview]
Message-ID: <87bq2ie80l.fsf@gmail.com> (raw)
In-Reply-To: <jwv7id6plqo.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue\, 03 Jun 2008 11\:56\:28 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Point nb 1 is easy to fix, maybe I can live with nb 3, but nb 2 seems to
> be more problematic.  So I think we need to find some other key-bindings
> for that.  I think a prefix key followed by +, -, and = (repeatable like
> C-x e e e e e, maybe even allowing switching between + and -) is the
> best choice.

It is one more case where I think emacs should provide a binding of
the form C-x C-+ + + + + ...

'+' would mean "repeat last command" as long as no other key is hit.
Additionnaly, we could declare "-" as a valid candidate.
Why not :

(global-set-key-autorepeat '("\C-x\C-" . ("+" . zoom-in)
                                         ("-" . zoom-out)))

to allow auto-repeat on + and - after either C-x C-- or C-x C-+. 

I'd be happy if emacs could provide a primitive for this. It could
display a transient helper in the echo area to remind what keys are
temporary bound to special functions.

Currently, I use the following code :

;;;; Auto-repeat any command by pressing last shortcut key
(defun auto-repeat-command (command)
  (let ((repeat-repeat-char
         (when (eq last-command-char
                   last-command-event)
           last-command-char)))
    (call-interactively command)
    (while (eq (read-event) repeat-repeat-char)
      ;; Make each repetition undo separately.
      (auto-repeat-command command)
      (setq unread-command-events (list last-input-event)))))


then, for example :

(global-set-key "\C-xmn" (lambda () (interactive) (auto-repeat-command 'marker-visit-next)))

This is clearly not optimal, but it works and I have not looked for a
cleaner implementation, yet.

This type of binding is ideal for any command that :
 - is not very often called
 - when called, will probably be called several time in a row
They are a lot of places where such default behaviour would provide
intuitive and non-intrusive bindings.

What do you think ?

-- 
      Paul




      parent reply	other threads:[~2008-06-03 17:35 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
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 [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87bq2ie80l.fsf@gmail.com \
    --to=paul.r.ml@gmail.com \
    --cc=emacs-devel@gnu.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).