Subject: Re: bug#47300: delete-window to select window with same position

From: martin rudalics <[email-masked]>
Date: Mon, 7 Jun 2021 09:35:07 +0200

> The customization interface could use only functions that could be
 > first called before deletion, then the customized function returns
 > a lambda that will be called after deletion.

Only specialized users would be able to write such a function. And they
can use the 'delete-window' parameter for that purpose.

 > Then for example
 > all 'pos' logic could be moved to a separate function:
 >
 > (defun delete-window-pos ()
 >    (let ((frame-selected-window-edges (window-edges frame-selected-window nil nil t))
 >          (frame-selected-window-pos (nth 2 (posn-at-point nil frame-selected-window))))
 >      (lambda ()
 >        (let ((new-frame-selected-window
 > 	     (window-at-pos
 >                (+ (nth 0 frame-selected-window-edges)
 >                   (car frame-selected-window-pos))
 >                (+ (nth 1 frame-selected-window-edges)
 >                   (cdr frame-selected-window-pos))
 >                frame t)))
 >          (and new-frame-selected-window
 >               ;; Select window at WINDOW's position at point.
 > 	     (set-frame-selected-window
 >                frame new-frame-selected-window))))))

I'm completely lost with the scoping of that first `let'.  So at least
for a poor soul like me such a solution would not be feasible at all.

martin