From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help 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 19:03:36 +0200 Organization: Aioe.org NNTP Server Message-ID: <87h9s0xk0n.fsf@debian.uxu> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1430240431 31118 80.91.229.3 (28 Apr 2015 17:00:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2015 17:00:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 28 19:00:30 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yn8s0-0003Sj-RF for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 19:00:28 +0200 Original-Received: from localhost ([::1]:35076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn8s0-0001tz-CS for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 13:00:28 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 75 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:2gTT/XafbjMZwpbDq5EO+nv1nNo= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:211756 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104038 Archived-At: 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 This will make for transparency - except for the particular key "o"! Perhaps you can insert that with `C-u o' when you don't want to go to the next window (only necessary in window roaming mode, of course). This closely resembles what I did (out of someone else's work) - this code [1] should be understandable (I hope) and the principle is exactly the same. Come back with more questions if need be! > 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. > Scenario 2 - I use the windmove package. - I bind > the windmove-up/down/left/right to C-o i, C-o k, C-o > j, C-o l respectively. Now, if I want to windmove to > up-left, I type C-o i, C-o j. Is there a way to use > C-o i j instead? First, good bindings! `C-o i' for up etc. are great. I love the 'ijkl' keys for 2D movements ever since playing a monochrome Lode Runner on a Mac Plus in the 80s. Second, you can't do that for the same prefix/command reason above. It would require some timeout solution for the prefix key which would be too slow to use anyway to be pleasant. Instead, why don't you use the same principle as you already did and use "u", "o", ".", and "m" for combinations? E.g., "u" is up, then left? But, here I actually think it is better to use `C-o i', then `C-o j' and so on. I don't see any comfort or speed disadvantage to speak of with that. Good luck! [1] http://user.it.uu.se/~embe8573/conf/emacs-init/caps-back.el -- underground experts united http://user.it.uu.se/~embe8573