> I changed <= to < to fix only Y coordinates for top/bottom windows, > but maybe X coordinates should still use <= ? The function has to treat the case where an edge is shared between two windows separately. A non-shared edge always belongs to the corresponding window. > Please note that the crucial difference is that now it uses > frame relative positions rather than window relative ones > with '(window-edges window nil nil t)' of the window to be deleted, > and window coordinates added to X and Y of posn-at-point. Right. But the X and Y values are needed separately only at the time `window-at-pos' is called. > 1. `get-mru-window' could be one possible choice of the new option. > 2. `use-posn-at-point' could be another choice. I called them just 'mru' and 'pos' now. The option is called `selected-window-after-deletion', there might be better names. > 3. Selecting the first window could remain in `delete-window-internal'. It has to stay there. > 4. But what to do with this code block with '(other-window -1 frame)'? > Should this be simply deleted? That `other-window' was a bug: A frame that is not selected should not get selected because we delete a window on it. In addition, the old code did not record a newly selected window unless that window was produced by `get-mru-window'. I tried to fix those too. Please have a look. martin