* next-frame / cycle through all frames?
@ 2006-04-07 17:52 David Reitter
0 siblings, 0 replies; 3+ messages in thread
From: David Reitter @ 2006-04-07 17:52 UTC (permalink / raw)
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?
Thanks for your help!
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.175.1144432367.9609.help-gnu-emacs@gnu.org>]
* Re: next-frame / cycle through all frames?
[not found] <mailman.175.1144432367.9609.help-gnu-emacs@gnu.org>
@ 2006-04-07 19:16 ` Johan Bockgård
2006-04-08 11:52 ` Alan Mackenzie
1 sibling, 0 replies; 3+ messages in thread
From: Johan Bockgård @ 2006-04-07 19:16 UTC (permalink / raw)
David Reitter <david.reitter@gmail.com> writes:
> What's a good way to cycle through all frames?
C-x 5 o runs the command other-frame
--
Johan Bockgård
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: next-frame / cycle through all frames?
[not found] <mailman.175.1144432367.9609.help-gnu-emacs@gnu.org>
2006-04-07 19:16 ` Johan Bockgård
@ 2006-04-08 11:52 ` Alan Mackenzie
1 sibling, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2006-04-08 11:52 UTC (permalink / raw)
David Reitter <david.reitter@gmail.com> 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").
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-08 11:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-07 17:52 next-frame / cycle through all frames? David Reitter
[not found] <mailman.175.1144432367.9609.help-gnu-emacs@gnu.org>
2006-04-07 19:16 ` Johan Bockgård
2006-04-08 11:52 ` Alan Mackenzie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).