From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: repeat-on-final-keystroke Date: Mon, 24 Apr 2006 12:40:33 +0200 Organization: Arcor Message-ID: <444cab56$0$11073$9b4e6d93@newsread4.arcor-online.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1145878835 31411 80.91.229.2 (24 Apr 2006 11:40:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Apr 2006 11:40:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 24 13:40:32 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FXzQX-0005zp-ND for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Apr 2006 13:40:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXzQX-0005Ft-82 for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Apr 2006 07:40:25 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 51 Original-NNTP-Posting-Date: 24 Apr 2006 12:41:26 MEST Original-NNTP-Posting-Host: 5d80d4da.newsread4.arcor-online.net Original-X-Trace: DXC=]QGe6??jWfTTkno\?fPDcV:ejgIfPPldTjW\KbG]kaMX]kI_X=5KeaVjgcKUS@:BBR3kWa6 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:34624 Archived-At: Enzo Vitale 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é!