From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#47300: delete-window to select window with same position Date: Thu, 27 May 2021 17:20:51 +0200 Message-ID: <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> References: <87a6qw43gg.fsf@mail.linkov.net> <87pmxodrmq.fsf@gnus.org> <7f870f9b-95ad-6b5d-82aa-1bcfe5cc880a@gmx.at> <87fsyk0w92.fsf@mail.linkov.net> <2ec3b911-4fb1-4b13-a5b8-28278a5c43ba@gmx.at> <87h7iyzvh5.fsf@mail.linkov.net> <0c239adb-e9d5-1fe9-4c4c-2da1603002f7@gmx.at> <87mtsmmpey.fsf@mail.linkov.net> <1032ab23-3905-1b3f-917c-60ccd12337b3@gmx.at> <87v9752n4r.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37300"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 27 17:22:32 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lmHqB-0009ZN-TL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 May 2021 17:22:32 +0200 Original-Received: from localhost ([::1]:36656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmHqA-00057z-SE for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 May 2021 11:22:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmHpi-00055z-GQ for bug-gnu-emacs@gnu.org; Thu, 27 May 2021 11:22:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41081) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmHpi-0005Rp-8L for bug-gnu-emacs@gnu.org; Thu, 27 May 2021 11:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lmHpi-0000hL-44 for bug-gnu-emacs@gnu.org; Thu, 27 May 2021 11:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 May 2021 15:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47300 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47300-submit@debbugs.gnu.org id=B47300.16221288622613 (code B ref 47300); Thu, 27 May 2021 15:22:02 +0000 Original-Received: (at 47300) by debbugs.gnu.org; 27 May 2021 15:21:02 +0000 Original-Received: from localhost ([127.0.0.1]:52627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmHok-0000g5-Ba for submit@debbugs.gnu.org; Thu, 27 May 2021 11:21:02 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:45059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmHoh-0000fF-R3 for 47300@debbugs.gnu.org; Thu, 27 May 2021 11:21:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622128853; bh=9AVU6RQjI3CnYdhWHKqHcsb1Qemvgh8xIjVhh3ocoyk=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=RQbejmtr+5Dsv9P5LB7TTLVOGo2HP0w3yNKTNN8apO64HEi314NCT5CbDjT46zgd3 xjmH5E/QERyhAfYzOS1EDiveCntXofjBhQc8xfJf5QNn9E/m7phINpXrjGjyUC78fa EmbZRs/E344o1Yaobllsf+GOL7tIGAPf5+Suc+s4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([212.95.5.167]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MLzFr-1m3gCz3kdl-00HtCC; Thu, 27 May 2021 17:20:52 +0200 In-Reply-To: <87v9752n4r.fsf@mail.linkov.net> Content-Language: en-US X-Provags-ID: V03:K1:8TfxaxqxhSu8cZbWGeH76X2CIQng6KHivkntOVK17pplNZ2Zb9O qg8tVy8P6Wmp+tH3dMlZ5FXz66GO683GDNkmGIxozhhv3QyT4E5tmGyZQhLRXSho0KB9JRo HR1+r2J8Yp5jOjUO8HBhWAg3ryRRVmRoaWiS4LyHPbKsrwaYL+OX81X0P2ZDLo+5Fo0j4WD QSUS0vw8rXfvMrYLlQSHg== X-UI-Out-Filterresults: notjunk:1;V03:K0:A2OqXeD9BQg=:Ea3yBaj+31IEeXJ9JDPMbL RFUlzHebZso6ZlJBMjkRlAy29k4CUYKsX6ej2Ao38faSASqIb8UgIsO5JyvjYzqsRqStY+i3i u7TOFb/b+xXW3hb3RHkrNl3ZnnXCJHMQan2CO4sA8o2Xck451fX0rgeCltT/Uzn3BFKfAjahD CTwe6hjx4u6nXz39jFjQHFZkCvPBXjrFC3WDTxbLRZ3RJMpfbeaPhsoxZfl8Aes5N5OilZ5HX 25/1k9hBuit0ZEAnbeKZXxB7U0eyVfiaP4AsI2GjXQq6PLtNxeRTba23nCPgfWoGgAoNaKuBj glcJG0OXT9UbOjy5l9RlTXQHVr6tdDGWzXLzjcU9SIRmUehqZfvG9/nOgOZHB93pIfDWgi5m7 IeysYK61kBB9nmjsoBAgC/IWeCTt/qc/fIkielFLjp9mzWnNNZvjocu6O2l8xY7ncTWRVbGM/ XJfAuoH8X4WNe9GvH8PdeTqJGZM6/UPzMkKAK3ga4cZ2F7w2mtHGwzBsGs4ZcXeD5opfIYCId 69ylHMQkvLbrXRZvChD2W8ahZroDoNd6Zeno2FvDeEDlelS0djM5Ne4n7Z27WwkPuZ/TLG6rU 6RZ7/SMv59c9mXDPCADyS4dfOh/ZeZn/9w8c3eVl/iCOMcTMESjYFarwZp+qTqg7SSf/4edK3 d1OMjEZM/F80OcehfEBguU7f6clCxX5eRzg8TT7vPdGJefUSQHIawrp0d2K9kCLDr31JINbb4 s/xhNjJnriu6bcpbfYIqL0xr2EoKhkX6pFbpoavdAwcTF3ZenzQZRT9k01AYlgsI3K4rjlpj X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207382 Archived-At: + (when (and (>= x (nth 0 edges)) (< x (nth 2 edges)) + (>= y (nth 1 edges)) (< y (nth 3 edges))) We have to mention the "<" somewhere. For two side-by-side windows with the right window's point at 1, we obviously must avoid the left window's right edge because the X, Y coordinates set by pos_visible_p are the top left edge of the character box at that position, i.e., 0, 0. But OTOH the "<" leaves the right edge of a frame's rightmost window unhandled and someone might use that function for other purposes. [...] It would be a tad more elegant to just save `posn-at-point' here ... + (setq posn-at-point-x (+ (nth 0 edges) (car posn-at-point)) + posn-at-point-y (+ (nth 1 edges) (cdr posn-at-point)))))) ;; Actually delete WINDOW. (delete-window-internal window) (window--pixel-to-total frame horizontal) - (when (and frame-selected ... and delay extracting its car and cdr until here. + (when (and posn-at-point-x posn-at-point-y + (setq window-at-posn-at-point + (window-at-pos posn-at-point-x posn-at-point-y frame))) I'd still urge you to transfer the `get-mru-window' call here too, that is, the entire /* Now look whether `get-mru-window' gets us something. */ mru_window = call1 (Qget_mru_window, frame); if (WINDOW_LIVE_P (mru_window) && EQ (XWINDOW (mru_window)->frame, frame)) new_selected_window = mru_window; /* If all ended up well, we now promote the mru window. */ if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) Fselect_window (new_selected_window, Qnil); else fset_selected_window (f, new_selected_window); block, and to include the (when (and frame-selected (window-parameter (frame-selected-window frame) 'no-other-window)) ;; `delete-window-internal' has selected a window that should ;; not be selected, fix this here. (other-window -1 frame)) so we can avoid selecting a new window up to four times when deleting a window (the one remaining call in `delete-window-internal' does not record the window and has to stay there). It's simply not nice to do that. martin