From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: repeat-on-final-keystroke
Date: Mon, 24 Apr 2006 12:40:33 +0200 [thread overview]
Message-ID: <444cab56$0$11073$9b4e6d93@newsread4.arcor-online.net> (raw)
In-Reply-To: mailman.732.1145653193.9609.help-gnu-emacs@gnu.org
Enzo Vitale <enzo.vitale@epfl.ch> writes:
> Dear Emacs experts,
>
> I have rebound the 'bs-cycle-next' command to 'C-x b' and I would very
> much like it to behave as 'repeat' in the sense that continuing to
> press
> simply the last character of the key-binding ('b' in this case) had
> the effect of scrolling one by one the list of active buffers.
>
> Currently, I have to retype 'C-x b' each time, very annoying when
> editing tens of different buffers, which is typical for me during code
> development.
IMNSHO, if you have tens of different buffers, you need something more
efficient than buffer cycling ... well, there is no accounting for
taste.
> By the way, the same would also be very useful with the 'undo' command
> (C-x u), and probably many more...
Use `C-/' for undo then.
> Is this possible ?
The way to find this out is by looking at the definition of functions
which already do this, like `repeat'. After cursory skimming it, I'd
say offhand that for your purpose it is sufficient to tinker with
`last-input-event', `read-event' and `unread-command-events'. For
instance:
(defun my-bs-cycle-next ()
(interactive)
(let ((dont-stop t))
(bs-cycle-next)
(while dont-stop
(let ((last last-input-event)
(event (read-event)))
(if (eq event last)
(bs-cycle-next)
(push event unread-command-events)
(setq dont-stop nil))))))
(define-key global-map (kbd "C-c b") #'my-bs-cycle-next)
Oliver
--
5 Floréal an 214 de la Révolution
Liberté, Egalité, Fraternité!
next prev parent reply other threads:[~2006-04-24 10:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.732.1145653193.9609.help-gnu-emacs@gnu.org>
2006-04-22 20:32 ` repeat-on-final-keystroke liyer.vijay
2006-04-24 10:40 ` Oliver Scholz [this message]
2006-04-24 15:37 ` repeat-on-final-keystroke B. T. Raven
2006-04-24 16:25 ` repeat-on-final-keystroke Kevin Rodgers
2006-04-24 16:31 ` repeat-on-final-keystroke Drew Adams
[not found] ` <mailman.870.1145895999.9609.help-gnu-emacs@gnu.org>
2006-04-24 19:56 ` repeat-on-final-keystroke B. T. Raven
[not found] <mailman.871.1145896319.9609.help-gnu-emacs@gnu.org>
2006-04-24 22:05 ` repeat-on-final-keystroke B. T. Raven
2006-04-21 13:45 repeat-on-final-keystroke Enzo Vitale
2006-04-21 21:23 ` repeat-on-final-keystroke Leon
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='444cab56$0$11073$9b4e6d93@newsread4.arcor-online.net' \
--to=alkibiades@gmx.de \
/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.
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).