Similar to WindMove, this package allows you to move focus between frames using arrow keys. Additionally, it can hook into WindMove’s keys so that when you can’t move between windows (because you reached the edge of the frame), the next event jumps frames.
Note This not for moving frames, but for moving focus between frames.
To install framemove on its own:
(require 'framemove) (framemove-default-keybindings) ;; default prefix is Meta
But you might want to use this in conjunction with WindMove, in which case this is the integration code to add to your .emacs:
(require 'framemove) (windmove-default-keybindings) (setq framemove-hook-into-windmove t)
Currently, when focus shifts to a new frame - the point does not change inside the frame.
Download from Lisp:framemove.el
If you get errors due to remove-if-not not being defined, you might need some common-lisp stuff:
1. I like it. I bind your change-focus keys to
‘M-S-up’, etc., since I bind
‘M-up’ etc. to the frame movement commands
‘move-frame-up’ etc. from frame-cmds.el.
2. Suggestion: Let
‘fm-left-frame’ etc. cycle (wrap) around to the rightmost frame when the end is reached, instead of just showing the message “
No frame in that direction”. That would make this feature more useful.
3. Consider adding to the file header of framemove.el:
;; Compatibility: GNU Emacs 22.x, 23.x
4. Consider making it a bit clearer in the file’s
Commentary and on this wiki page that, in spite of the names, this is not about moving frames; it is about moving (changing) the input focus from one frame to the next. The function and libraries names are a bit unfortunate, IMO, but I suppose they are modeled on
windmove.el, which also uses unfortunate terminology. But for windows, actual “moving” makes less sense than for frames. The only way you can “move” a window is relative to others: exchange them. Not so, for frames. – DrewAdams
*Done* (to some extent)
5. Suggestion: fail with a more informative message than a “Wrong-type-argument-p” error on terminal frames:
--- a/.emacs.d/packages/framemove/framemove.el +++ b/.emacs.d/packages/framemove/framemove.el @@ -102,7 +102,9 @@ (interactive (list (intern (completing-read "Which direction: " '("up" "down" "left" "right") nil t)))) (let* ((thisframe (selected-frame)) - (current-coords (fm-absolute-coords-of-position (posn-at-point))) + (current-coords (if (frame-parameter thisframe 'top) + (fm-absolute-coords-of-position (posn-at-point)) + (error "Frame movement not supported on character terminals."))) (coords-projected-in-dir (fm-project current-coords thisframe dir)) (possible-frames (sort
6. Suggestion: remove warnings because two of the lambdas are quoted incorrectly:
--- a/framemove.el 2014-10-08 14:50:32.000001000 -0400 +++ b/framemove.el 2014-10-08 14:49:59.002167000 -0400 @@ -109,7 +109,7 @@ (remove-if-not '(lambda (f) (fm-frame-is-to-dir-of f dir thisframe)) (visible-frame-list)) - '(lambda (f1 f2) (fm-frame-is-to-dir-of f1 (fm-opposite dir) f2))))) + #'(lambda (f1 f2) (fm-frame-is-to-dir-of f1 (fm-opposite dir) f2))))) (if possible-frames (let ((frames-in-line-of-cursor ;; try to find frame in line with cursor @@ -123,7 +123,7 @@ (remove-if-not '(lambda (f) (fm-range-overlap thisframe f dir)) possible-frames) - '(lambda (f1 f2) + #'(lambda (f1 f2) (< (fm-dist-from-coords coords-projected-in-dir f1) (fm-dist-from-coords coords-projected-in-dir f2)))))) (select-frame-set-input-focus
Look also at ‘next-multiframe-window` command and possibly bound it to a handy keybinding! – SewerynKokot