>> I'll into this as soon as I sorted out bug 16013 (unless you wanted to >> have a look). > > Please do. I'm sure you understand the problem area better, and there > are other issues I'd rather devote attention to. IIUC the bug happens only in a window whose subwindow does not have an integral number of lines like in a maximized frame. Is that correct? Here on a maximized frame with two windows above each other and the upper one selected the following happens (window-height) => 30 (window-pixel-height) => 484 so the selected window has 484 / 16 lines which is larger than 30. Now `windmove-other-window-loc' with DIR 'down does (+ (1- (nth 3 edges)) windmove-window-distance-delta))) ; (x, y1+d-1) and returns 30. `window-at' returns the selected window since that window extends until after line 30 and windmove doesn't move because the target window is the selected one. In the long run I'd like to use `window-in-direction' here because it doesn't suffer this problem. Meanwhile I can offer the attached patch (although I'm not sure whether it is really better than customizing `windmove-window-distance-delta'). martin BTW: If you want to test `window-in-direction' directly you can try the following instead: (defun select-window-on-left () "Select window on the left." (interactive) (select-window (window-in-direction 'left))) (defun select-window-above () "Select window above." (interactive) (select-window (window-in-direction 'above))) (defun select-window-on-right () "Select window on the right." (interactive) (select-window (window-in-direction 'right))) (defun select-window-below () "Select window below." (interactive) (select-window (window-in-direction 'below))) (defun select-window-keybindings (&optional modifier) "Set up keybindings as in windmove." (interactive) (unless modifier (setq modifier 'shift)) (global-set-key (vector (list modifier 'left)) 'select-window-on-left) (global-set-key (vector (list modifier 'right)) 'select-window-on-right) (global-set-key (vector (list modifier 'up)) 'select-window-above) (global-set-key (vector (list modifier 'down)) 'select-window-below))