From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "chenyu" Newsgroups: gmane.emacs.help Subject: Re: how switch between 2 mostly used windows Date: Tue, 8 Jun 2010 08:07:38 +0800 Organization: A poorly-installed InterNetNews site Message-ID: References: <87bpbmo4od.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1291951576 27796 80.91.229.12 (10 Dec 2010 03:26:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 03:26:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 10 04:26:10 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQtcS-0004yj-MT for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Dec 2010 04:26:07 +0100 Original-Received: from localhost ([127.0.0.1]:36471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQtc1-0004lf-Qi for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 22:25:38 -0500 Original-Path: usenet.stanford.edu!newsfeed.berkeley.edu!ucberkeley!newsgate.cuhk.edu.hk!www.shinco.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Original-NNTP-Posting-Host: 114.84.174.22 Original-X-Trace: www.shinco.com 1275955660 24829 114.84.174.22 (8 Jun 2010 00:07:40 GMT) Original-X-Complaints-To: news@www.shinco.com Original-NNTP-Posting-Date: Tue, 8 Jun 2010 00:07:40 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3664 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3664 Original-Xref: usenet.stanford.edu gnu.emacs.help:178727 X-Mailman-Approved-At: Thu, 09 Dec 2010 20:23:44 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor 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:77269 Archived-At: It works very well. Wonderful. chenyu "Pascal J. Bourguignon" ??????:87bpbmo4od.fsf@kuiper.lan.informatimago.com... > "chenyu" writes: > >> hi, >> 3 windows have open in emacs, and two of them are mostly used. >> >> C-X o, switch to the next windows. >> >> But which commands for switch back to the previous windows, by skipping >> the >> third (just show windows)? > > > (defun selected-window () > (first (window-list))) > > (defvar *first-window* nil) > (defvar *second-window* nil) > > (defun designate-first-window () > "Sets the first window." > (interactive) > (setf *first-window* (selected-window))) > > (defun designate-second-window () > "Sets the second window." > (interactive) > (setf *second-window* (selected-window))) > > (defun skip-to-other-designated-window () > "Selects the other window (either the first or second)." > (interactive) > (if (eq (selected-window) *first-window*) > (select-window *second-window*) > (select-window *first-window*))) > > > (global-set-key (kbd "") 'skip-to-other-designated-window) > (global-set-key (kbd "") 'designate-first-window) > (global-set-key (kbd "") 'designate-second-window) > > Type to designate your first window, to designate the second. > Then you can use to toggle between the two. > > -- > __Pascal Bourguignon__ http://www.informatimago.com/