From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: next-frame / cycle through all frames? Date: Sat, 8 Apr 2006 11:52:44 +0000 Organization: muc.de e.V. -- private internet access Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1144500032 4942 80.91.229.2 (8 Apr 2006 12:40:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 8 Apr 2006 12:40:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 08 14:40:29 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FSCjr-00013t-UG for geh-help-gnu-emacs@m.gmane.org; Sat, 08 Apr 2006 14:40:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FSCjr-0003Sq-D5 for geh-help-gnu-emacs@m.gmane.org; Sat, 08 Apr 2006 08:40:27 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 79 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1144496922 7545 193.149.49.134 (8 Apr 2006 11:48:42 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 8 Apr 2006 11:48:42 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:138619 Original-To: help-gnu-emacs@gnu.org 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:34237 Archived-At: David Reitter wrote on Fri, 7 Apr 2006 18:52:39 +0100: > What's a good way to cycle through all frames? > I have defined > (defun switch-to-next-frame () > (interactive) > (select-frame-set-input-focus (next-frame))) > which lets me switch to the next frame. But unfortunately, at least > in current CVS versions, it seems to be adding the current frame to > the top of the list so that the next call to `next-frame' will > return the previously selected frame. In other words, if you have > three frames open, it'll only let you cycle between two of them. > Is that actually the intended behavior? (It might be analogous to > windows.) > If that's so, what's the easiest way to cycle between all frames? I don't like Emacs's standard frame swapping stuff. I switch to specific frames with F1, F2, ...., rather than cycling through them. Like this: ######################################################################### (defvar frame-no-initialised nil) (when (not frame-no-initialised) ; run only at emacs startup. (modify-frame-parameters (selected-frame) '((acm-no . 0)))) (defun assign-acm-no (frame) "FRAME is a (typically newly created) frame. Give it an acm-no frame-parameter if there is one free (in the range 0..11). Return that number or nil." (let ((assigned (make-bool-vector 12 nil)) (f (frame-list)) n) (while f (if (setq n (frame-parameter (car f) 'acm-no)) (aset assigned n t)) (setq f (cdr f))) (setq n 0) (while (and (< n 12) (aref assigned n)) (setq n (1+ n))) (if (= n 12) nil (modify-frame-parameters frame `((acm-no . ,n))) n))) (defun find-acm-no-frame (n) "Return the frame with parameter (acm-no . N), or nil." (let ((f (frame-list))) (while (and f (not (eq (frame-parameter (car f) 'acm-no) n))) (setq f (cdr f))) (car f))) (add-hook 'after-make-frame-functions 'assign-acm-no) (defun select-frame-acm-no (n) "Select the frame with acm-no frame-parameter N, or do nothing." (let ((frame (find-acm-no-frame n))) (if frame (select-frame-set-input-focus frame)))) (global-set-key [f1] (lambda () "Switch to frame F1" (interactive) (select-frame-acm-no 0))) (global-set-key [f2] (lambda () "Switch to frame F2" (interactive) (select-frame-acm-no 1))) (global-set-key [f3] (lambda () "Switch to frame F3" (interactive) (select-frame-acm-no 2))) (global-set-key [f4] (lambda () "Switch to frame F4" (interactive) (select-frame-acm-no 3))) (global-set-key [f5] (lambda () "Switch to frame F5" (interactive) (select-frame-acm-no 4))) (global-set-key [f6] (lambda () "Switch to frame F6" (interactive) (select-frame-acm-no 5))) (global-set-key [f7] (lambda () "Switch to frame F7" (interactive) (select-frame-acm-no 6))) (global-set-key [f8] (lambda () "Switch to frame F8" (interactive) (select-frame-acm-no 7))) (global-set-key [f9] (lambda () "Switch to frame F9" (interactive) (select-frame-acm-no 8))) (global-set-key [f10] (lambda () "Switch to frame F10" (interactive) (select-frame-acm-no 9))) (global-set-key [f11] (lambda () "Switch to frame F11" (interactive) (select-frame-acm-no 10))) (global-set-key [f12] (lambda () "Switch to frame F12" (interactive) (select-frame-acm-no 11))) ######################################################################### > Thanks for your help! -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").