GNU bug report logs - #47300
delete-window to select window with same position

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 21 Mar 2021 21:15:02 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #64 received at 47300 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 47300 <at> debbugs.gnu.org
Subject: Re: bug#47300: delete-window to select window with same position
Date: Sun, 06 Jun 2021 23:47:56 +0300
>>> In general, just plugging in some existing function would usually fail
>>> here and I would like to avoid the illusion that it could work.  Also,
>>> as you can see with the 'pos' case, some work must be done _before_
>>> calling `delete-window-internal' so the actual work would have to be
>>> split among two functions at least.
>>
>> The 'pos' case is an exception.  What I meant is simple cases
>> like customizing to 'get-lru-window'.
>
> That one would have to handle the 'no-other-window' parameter.  And we
> would have to mix functions and constants as customizable values which
> looks queer in the customization interface.

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.  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))))))




This bug report was last modified 4 years and 37 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.