help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Can I use 'C-x o o o o o' instead of C-x o C-x o C-x o C-x o C-x o?


From: Drew Adams
Subject: RE: Can I use 'C-x o o o o o' instead of C-x o C-x o C-x o C-x o C-x o?
Date: Tue, 28 Apr 2015 07:07:16 -0700 (PDT)

> Scenario 1
> - I split many windows.
> - I wish to switch to some other windows.
> - I type C-x o, C-x o, C-x o repeatedly until the cursor landed on
> the desired window. Is there a way to use C-x o o o instead?

Yes.  Using function `repeat-command', this command, like lots of
others, is made "repeatable": You can bind the repeatable command
to a key sequence that includes a prefix key and then just repeat
the last key: `C-x o o o o o...'.

A prefix arg you give to the command initially is passed to each
subsequent consecutive call.  So for example, `C-2 C-x o o o ...'
cycles through every other window.

(defun other-window-repeat (count)
  "Repeatable `other-window'."
  (interactive "p")
  (require 'repeat)
  (repeat-command 'other-window))

(global-set-key "\C-xo" 'other-window-repeat)


Here is `repeat-command', from `misc-cmds.el'.
http://www.emacswiki.org/emacs/download/misc-cmds.el

(defun repeat-command (command)
  "Repeat COMMAND."
  (let ((repeat-message-function  'ignore))
    (setq last-repeatable-command  command)
    (repeat nil)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]