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: Jorge A. Alfaro-Murillo
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 13:48:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Emanuel Berg writes:

<keith@cheungsfamily.org> writes:
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?

You can't do that the normal way because then you'd have to set up prefix keys, but they themselves would have to be commands! - so Emacs cannot tell if it is a prefix key (i.e. it should await more input) or if it is a command (i.e. it should act). However, you can do it with programming, as always, and here's how: The first command, which you should bind to a key, should re-bind the keys - all keys. "o" should be "move to the next window". All other keys should be - let's say normal behavior is B - all other keys should be:
    a) exit this window roaming mode b) do normal behavior B

That is what the function set-transient-map is used for.
I aware that I can use C-u num C-x o, if I know the desired window is num step away. But there are times that I do not know 'num'.

OK: instead of iteration, I'd assign each window a letter (a, b, c...) and show that in the mode bar. Then do a function that accepts an argument which is such a letter. Then jump to that window. I'd say this idea is much better.

That is the idea of ace-window (https://github.com/abo-abo/ace-window), which also is better for Scenario 1 and even for a third scenario where you have want to delete a particular window but do not want to move to it first.

Best,

--
Jorge.




reply via email to

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