From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) 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 13:48:59 -0400 Message-ID: <877fswcfec.fsf@yale.edu> References: <87h9s0xk0n.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: ger.gmane.org 1430243412 19479 80.91.229.3 (28 Apr 2015 17:50:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2015 17:50:12 +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:49:53 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 1Yn9dn-00020y-MP for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 19:49:51 +0200 Original-Received: from localhost ([::1]:35268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn9dn-0005k5-26 for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 13:49:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn9dF-0004t3-QR for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 13:49:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yn9dC-0004tV-KQ for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 13:49:17 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:60920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn9dC-0004t0-EX for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 13:49:14 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Yn9dA-0001RH-1O for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 19:49:12 +0200 Original-Received: from nat-130-132-173-151.central.yale.edu ([130.132.173.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Apr 2015 19:49:12 +0200 Original-Received: from jorge.alfaro-murillo by nat-130-132-173-151.central.yale.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Apr 2015 19:49:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nat-130-132-173-151.central.yale.edu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:ZRq+4RLh7Y7LB1M39fATwCJqxN4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:104042 Archived-At: Emanuel Berg writes: > 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.