From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 21 17:14:30 2021 Received: (at submit) by debbugs.gnu.org; 21 Mar 2021 21:14:30 +0000 Received: from localhost ([127.0.0.1]:55563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lO5P4-0001pQ-7F for submit@debbugs.gnu.org; Sun, 21 Mar 2021 17:14:30 -0400 Received: from lists.gnu.org ([209.51.188.17]:54568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lO5P2-0001pI-5e for submit@debbugs.gnu.org; Sun, 21 Mar 2021 17:14:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lO5P1-000678-WE for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2021 17:14:28 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:48437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lO5Oz-0007LC-J9 for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2021 17:14:27 -0400 Received: from mail.gandi.net (m91-129-107-223.cust.tele2.ee [91.129.107.223]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 4F073100003 for ; Sun, 21 Mar 2021 21:14:21 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: delete-window to select window with same position Organization: LINKOV.NET Date: Sun, 21 Mar 2021 22:31:27 +0200 Message-ID: <87a6qw43gg.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.178.231; envelope-from=juri@linkov.net; helo=relay11.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain People still have trouble with unpredictable behavior of 'C-x 0' that selects an unexpected window after the current window is deleted. This is a recent example: https://old.reddit.com/r/emacs/comments/m8omt0/how_can_deletewindow_cx_0_be_configured_to_stay/ The previous failed attempt to fix this was in bug#32790. I still don't understand the current logic what window is selected after deleting the selected window with 'C-x 0'. But maybe this could be customizable? Tried to write an advice: (advice-add 'delete-window :around (lambda (orig-fun &optional window) (if window ;; Non-interactive call (funcall orig-fun window) ;; Interactive call (let* ((pos (window-absolute-pixel-position)) (x (when pos (/ (car pos) (frame-char-width)))) (y (when pos (/ (cdr pos) (frame-char-height))))) (funcall orig-fun window) ;; Select window that takes space from the deleted window (when (and x y) (select-window (window-at x y)))))) '((name . delete-window-keep-pos))) Maybe something like this could be adapted to delete-window by adding an optional interactive argument keep-pos: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=delete-window-keep-pos.patch diff --git a/lisp/window.el b/lisp/window.el index f27631bb86..e2029406c7 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4177,7 +4177,7 @@ window--before-delete-windows (push (list buf start-m pos-m) prev-buf) (set-window-prev-buffers win prev-buf))))))) -(defun delete-window (&optional window) +(defun delete-window (&optional window keep-pos) "Delete WINDOW. WINDOW must be a valid window and defaults to the selected one. Return nil. @@ -4194,13 +4194,16 @@ delete-window argument. Signal an error if WINDOW is either the only window on its frame, the last non-side window, or part of an atomic window that is its frame's root window." - (interactive) + (interactive (list nil t)) (when switch-to-buffer-preserve-window-point (window--before-delete-windows)) + (setq keep-pos (and keep-pos (not window) (window-absolute-pixel-position))) (setq window (window-normalize-window window)) (let* ((frame (window-frame window)) (function (window-parameter window 'delete-window)) (parent (window-parent window)) + (keep-pos-x (when keep-pos (/ (car keep-pos) (frame-char-width)))) + (keep-pos-y (when keep-pos (/ (cdr keep-pos) (frame-char-height)))) atom-root) (window--check frame) (catch 'done @@ -4259,6 +4262,8 @@ delete-window ;; `delete-window-internal' has selected a window that should ;; not be selected, fix this here. (other-window -1 frame)) + (when (and keep-pos-x keep-pos-y (window-at keep-pos-x keep-pos-y)) + (select-window (window-at keep-pos-x keep-pos-y))) (window--check frame) ;; Always return nil. nil)))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 22 14:58:02 2021 Received: (at control) by debbugs.gnu.org; 22 Mar 2021 18:58:02 +0000 Received: from localhost ([127.0.0.1]:58665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOPkY-0004WV-Ct for submit@debbugs.gnu.org; Mon, 22 Mar 2021 14:58:02 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOPkW-0004Vr-O2 for control@debbugs.gnu.org; Mon, 22 Mar 2021 14:58:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=r/EDx8+wa2p5Rv84HH3ewHR784jVdV3QPsh/+/sTh38=; b=sat3ohwn0mmeiVEx3L4UNHn8LY mB7xymygBajl+G9iuIyMYWXHxuO2JrVBPwk2UPAjIB4KO76KwVYXS7Pp6BTuAuc5BaHaIBhDRQiVJ 2U7B2+m2ElaVJ0Trbz+dkrjhG2tHvGIB6DdUqZ/ZoYx2foJxDB+Vdzq3CEAP9B480SPU=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOPkP-0000O1-1i for control@debbugs.gnu.org; Mon, 22 Mar 2021 19:57:55 +0100 Date: Mon, 22 Mar 2021 19:57:51 +0100 Message-Id: <877dlzhv80.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #47300 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 47300 + patch quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 47300 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Tue May 18 10:49:14 2021 Received: (at 47300) by debbugs.gnu.org; 18 May 2021 14:49:14 +0000 Received: from localhost ([127.0.0.1]:56882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lj121-0001r4-PZ for submit@debbugs.gnu.org; Tue, 18 May 2021 10:49:14 -0400 Received: from quimby.gnus.org ([95.216.78.240]:43100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lj11z-0001qq-4r for 47300@debbugs.gnu.org; Tue, 18 May 2021 10:49:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PESItR8HSa5PL0IrkVQONBUmoDNhSoF7Pd/9xECYBB0=; b=LNPl89bU2KxrEBkX6y3U9JkyDg OLxRiddyhLiS3wZCp3pf52YaFDSEvW8wPD/2PT7a/mszm6H9vKUFxyVulTho5JyyvUVOaYYivJLD3 L3jbsQ0qXDzmRaBWWS0ghDND5nX+fS2cZbFtWAZL603AWlUhknB/etfQupljzsADezGo=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lj11p-0006Py-VE; Tue, 18 May 2021 16:49:04 +0200 From: Lars Ingebrigtsen To: Juri Linkov Subject: Re: bug#47300: delete-window to select window with same position References: <87a6qw43gg.fsf@mail.linkov.net> X-Now-Playing: The Specials's _The Specials_: "Do The Dog" Date: Tue, 18 May 2021 16:49:01 +0200 In-Reply-To: <87a6qw43gg.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 21 Mar 2021 22:31:27 +0200") Message-ID: <87pmxodrmq.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Juri Linkov writes: > People still have trouble with unpredictable behavior of 'C-x 0' > that selects an unexpected window after the current window is deleted. > > This is a recent example: > https://old.reddit.com/r/ema [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47300 Cc: martin rudalics , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: > People still have trouble with unpredictable behavior of 'C-x 0' > that selects an unexpected window after the current window is deleted. > > This is a recent example: > https://old.reddit.com/r/emacs/comments/m8omt0/how_can_deletewindow_cx_0_be_configured_to_stay/ > > The previous failed attempt to fix this was in bug#32790. > > I still don't understand the current logic what window is selected > after deleting the selected window with 'C-x 0'. `C-x 0' isn't a command I use much, so I don't really have much intuition about how it's supposed to work. But, indeed, playing around with it, it seems unexpected that `C-x 0' selects a different window (instead of remaining in the "merged" window). > Maybe something like this could be adapted to delete-window > by adding an optional interactive argument keep-pos: If I'm reading that patch correctly (I haven't actually tested), that seems more DWIM to me. Perhaps Martin has some comments here; added to the CCs. (And if anybody else has an opinion here, please do chime in.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue May 18 12:00:51 2021 Received: (at 47300) by debbugs.gnu.org; 18 May 2021 16:00:51 +0000 Received: from localhost ([127.0.0.1]:57029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lj29K-0006gH-TT for submit@debbugs.gnu.org; Tue, 18 May 2021 12:00:51 -0400 Received: from mout.gmx.net ([212.227.17.21]:49851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lj29I-0006Yc-13 for 47300@debbugs.gnu.org; Tue, 18 May 2021 12:00:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621353641; bh=V4uRezhRwnD3bv7B/V8W72JvtWfFEOhLx3H1vPBpuco=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=bYcZrjcARjHHL+xCyD+IpEuaMwi4umI+JTocc87IvBYnDqIC2Alf9xeFBKqzaoVLF AHBZvyxBa/TLmP3QjxlL0PlrWmNqzuGWjXOHoG/IsBmE1KlIgxZ98M3Iz/daC7L4Ae eRu2za0979WS4W4yhKCikdpgRSGfOc7KBh2W6D1I= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([213.142.96.212]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4Jqb-1lilAH39Sj-000Nbq; Tue, 18 May 2021 18:00:40 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Lars Ingebrigtsen , Juri Linkov References: <87a6qw43gg.fsf@mail.linkov.net> <87pmxodrmq.fsf@gnus.org> From: martin rudalics Message-ID: <7f870f9b-95ad-6b5d-82aa-1bcfe5cc880a@gmx.at> Date: Tue, 18 May 2021 18:00:40 +0200 MIME-Version: 1.0 In-Reply-To: <87pmxodrmq.fsf@gnus.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:B3uEDuxLi6nJiPusAxtJ3kFmSBqVY6fY85+x7mDy1DFPFXECeOW Pjm8e7s38byaH0vVkOETD9OV8uTnt6JZHoLFYFgZKtB7yFRKVSbFCBo5TPd6gYyq0n4DeL8 JKahW6UMHdnBG4Z5x8/eiGdpkkmS5OefNBP4h7OaiSqJQwmFoL7MK3STXeRcpj/FKTfVmWy EBcE/sJP0xq3LJ/vHDJFw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:uNRIm8knMbA=:H470OybVsdu863PJRANqum RijXaYlOk2Yu3sxtVIQYlg7JoD1RoemGDIf37lGgx56gRR8C/BPvKZfeO5Lxm/ATzNPlE9xTu JZeT25oz3kgQOMZhJuBafeo+I8YEAiMG/TumYJksRbQiGDQvS4RVQwa7IeIOIToUrvEHSXK0k 05Jvd/EZGmcbrwwpTYiS33jI1OEk4O3MJp7YKTw43SIAqsZAUsRmuzyHj42zhzs6TNUBUkan9 VO2mZKoBLB4qhDxbI4ClCpEQ7KzVw/GzPlARIhN9t4VJKOVBZLCOHwQm40nEmt6G/3jXKJzj1 POuYaCL44qZFZ7Pymw0GHUFDhQBZ1g+3WIAywdJetTp+B+0YGLJXn/K8GMwjAXF8Zqh9FDbZn u6a4F+/xk4S/L38vUr6tvwpbSH2YaXh6x8L2YzjTy+PXsVb5fYrzF/GkyTR3jLXoxhTK1YFY9 TNiSWCT6DDTnYTWN/8PGW/zihqCYeqSBJg2kU+ChrlvnXDqagxoJoslRoZ+R6jHVecnbKDDEE tH5jES6wPR0EWrVz3QTmIyRuYJaj1Aik7D4hrrwoNO5hxE68u6j1CDZKmwrvPUrPpxB3uWB0N iLbgA0gd2XkP9IKGTJfWS6wlR/1gnllIGYtFQIKVjGCiqiTjzR+UgAKPWVjXk8/Nfqy28id1O 9BT/kMmwZ845wBrUVhET6XGeElwr5GIk1Poiai3TigciZsLqQhfqLD+Iz2zJ/Mmr9tsZSdBbJ 2lGcN5mxnhOup7zZtIVtCB7TVG9DAG1cawj3DIQUIJmc6Gg4KDrXLgtTN5OTcVaSbIkalmQot 4sqPfpF1S18XIs6wO2zHZleDmYSQrtBInIJjUS4taJx8WD20+97nsvs7tqAyAfRi4Y13Tq5wR y3M2FpUBYn127VwFFecp4ll2zq5ZD7KlsMuM0B/gKwCjafD795KJTTJmqhQagrBB9i0La8Itg FryLScgmmm+lAnC3mgWaemGOcbnAgUDZ72zveFd44hdBE3EIcUwzvDtjyw54Xji/T6cjn4SYl VE/PkgSfBkKVLkOiVeIAbFhxeVjXC54aA98272REBfqdaV88BNJXGBP41NCd0StkYtWiEcK+N EyZghXC8Inhz1ewjtuy8Wq+wdjwZeE1ntTIJtsuOZf96oFlZYlqB5X8XGg+JO/t3c79zdiyEz 6i6kt4u5PYfpo2rZY41OT7xKu+sGaIHvAHWBd/9lvjXHblLf6IK/JylymuW0I9okmDCJE= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> People still have trouble with unpredictable behavior of 'C-x 0' >> that selects an unexpected window after the current window is deleted. >> >> This is a recent example: >> https://old.reddit.com/r/emacs/comments/m8omt0/how_can_deletewindow_cx_0_be_configured_to_stay/ >> >> The previous failed attempt to fix this was in bug#32790. >> >> I still don't understand the current logic what window is selected >> after deleting the selected window with 'C-x 0'. By design it's the most recently used window (`get-mru-window') on the same frame after the deleted window has been removed from its window tree. > `C-x 0' isn't a command I use much, so I don't really have much > intuition about how it's supposed to work. But, indeed, playing around > with it, it seems unexpected that `C-x 0' selects a different window > (instead of remaining in the "merged" window). > >> Maybe something like this could be adapted to delete-window >> by adding an optional interactive argument keep-pos: > > If I'm reading that patch correctly (I haven't actually tested), that > seems more DWIM to me. Perhaps Martin has some comments here; added to > the CCs. (And if anybody else has an opinion here, please do chime in.) Personally I don't care but people used to the current behavior might get confused. So an option should be the provided and could be "ON" by default. martin From debbugs-submit-bounces@debbugs.gnu.org Tue May 18 16:27:31 2021 Received: (at 47300) by debbugs.gnu.org; 18 May 2021 20:27:31 +0000 Received: from localhost ([127.0.0.1]:57403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lj6JP-0000M8-Ie for submit@debbugs.gnu.org; Tue, 18 May 2021 16:27:31 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:57291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lj6JN-0000Lh-5P for 47300@debbugs.gnu.org; Tue, 18 May 2021 16:27:30 -0400 Received: (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 77B6DFF802; Tue, 18 May 2021 20:27:20 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET References: <87a6qw43gg.fsf@mail.linkov.net> <87pmxodrmq.fsf@gnus.org> <7f870f9b-95ad-6b5d-82aa-1bcfe5cc880a@gmx.at> Date: Tue, 18 May 2021 23:17:37 +0300 In-Reply-To: <7f870f9b-95ad-6b5d-82aa-1bcfe5cc880a@gmx.at> (martin rudalics's message of "Tue, 18 May 2021 18:00:40 +0200") Message-ID: <87fsyk0w92.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > By design it's the most recently used window (`get-mru-window') on the > same frame after the deleted window has been removed from its window > tree. I can't find where `get-mru-window' is called during window deletion. > Personally I don't care but people used to the current behavior might > get confused. So an option should be the provided and could be "ON" by > default. Maybe a new option e.g. `delete-window-select' with type not boolean, but a predicate with the default value `get-mru-window', and another choice `delete-window-select-underlying' to select the "merged" window. From debbugs-submit-bounces@debbugs.gnu.org Wed May 19 03:43:00 2021 Received: (at 47300) by debbugs.gnu.org; 19 May 2021 07:43:00 +0000 Received: from localhost ([127.0.0.1]:57896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljGr6-00043r-7X for submit@debbugs.gnu.org; Wed, 19 May 2021 03:43:00 -0400 Received: from mout.gmx.net ([212.227.15.18]:35123) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljGr4-00043e-LG for 47300@debbugs.gnu.org; Wed, 19 May 2021 03:42:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621410172; bh=4e4qoKVOJUrallFqwPQ2xjxToCsyhvF1ZjrfZppSirk=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=RGpeoE3Yt1HyKRgKLLEbq8KCnF/fQQ45LFv66DuU0drzjLCTTd0Vfe+6lO4FYmZgq S9vHC18/57rqMA8btvaQF1rwAwfs37LMvP3XSnaNQB8GV76P7afePj2hpk2+bfPlCQ Kk/C8UpH2mP7GQyfgVihaWYTcobtXnK2ZEaQ+Nlo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([212.95.5.159]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MRTN9-1m4ObO3tdV-00NNqI; Wed, 19 May 2021 09:42:52 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov References: <87a6qw43gg.fsf@mail.linkov.net> <87pmxodrmq.fsf@gnus.org> <7f870f9b-95ad-6b5d-82aa-1bcfe5cc880a@gmx.at> <87fsyk0w92.fsf@mail.linkov.net> From: martin rudalics Message-ID: <2ec3b911-4fb1-4b13-a5b8-28278a5c43ba@gmx.at> Date: Wed, 19 May 2021 09:42:49 +0200 MIME-Version: 1.0 In-Reply-To: <87fsyk0w92.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:5f+Y2Lq5gDxVE6mBqqZhUuHAHkKujkBfO0zX6KLKoFhxjC09u44 SLm0hW9SN/4SXFCtbX4wPQ7vgJDJv7BKWzv9cxGIL74cAPSkTfnBHdRScQO7UVnbxqhlWby x096iCcWfrZwAapkZG9X628JoiaZncXJr714HMfxHh1VtT8ajE9Rc7KNOveOh/tz8LXdsAm bGxMruWBgych5rAHtwZ4g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:qcm8O6rhhJg=:qESCxd3iAiLiQloK9xyFwy /CGe/jn8JvSGF2aLLVZgASbdgpu6XZgtdV6C7JMWxgv57v2Kco3+rXFPbdQVFIK36aq7WA4FH Wo5nqw/298ml3+b7CqL1vCM7Nukv8Ra1vNW0Q89DqlKBWEpczO/WMd6ordL5nv+HXe79z2DuI U4YYXP3MqEph/21joPwsN2Q+RvqPbqSMfv9LNSC+vQqSpymi0ZJFiLQ70SOcidAn+hCRquxlI ajs5YCocVgRzZLIefLb12LV+k201pH/V4q5QM5HBKIsNXTl27QGhEddkFZGCYViaAEU0b2xP6 j7+q9uy40Gj8DCzUGMKmG9Q6VNsY2AFlt/DfNJ1WRJJTFFP5X/9TRwqHf6T1RJ404xJzv26/T FsRw3VapVRFVaQql6dIch3Og0JMW/v5VkhO+BU47PcVJ0+6IU6UFQE2LOsyYgMAlXuscBzGFQ hce0Nt6PjpiOxmPC8pagS1s1QAfFO8SbjdDCHF6Y0xVwAPO+Qwi0Dt+hhWNRfsqO9KYqB9LnG u6Txe+o4zuz87Mf01DMKYUMnE66e99U1OS8EYLI/CcVWcm7emw2pL9cu3UIzqX3OZm9Mj3rxw Cg6ponIcRjaE9eUsoUO6KNgRkS3Mh1LXOc345TTXNNlQEf8a0vBBOXTr0Z0oXUfwE1kDRALPv UsgwRm3mBKSOFcAfZCDFpHNbbuuiLtRHBCNe9+4Fj+/zbS29IerT4ZKiBm1d5Caf8BTmfT0jV PKpGIpunynN/w+ZDldDj2VH7C+H+YnUUYMQa55oG13z+xUXWyFve1kBXJ2MAJt+v2gH8DSFsm rdpT2lv2P2P2xcf12mwY9E1Ik0ivwezCCvwcHgIYqsBxXCqWVJA+ftLErg6u+sen6Mj5GcKer PeeLC20lX9q0pzCd2BKDf2q/5W6o8upY6mKK8uV87a+1iwAGKYhozBOswvpto4YKDKqM5DNrK mhrxP9qmBQJXM1pQGH9g8k7N9veYOy3JC086cnPe89uMOziLcHDmsFSBz3QaFuDAToFM9sOgE na9phwXoaxi9+9F6dFV7jrfBPuLoa3wTCdjaSEGFsFYgVvYcMdCNfGmzc+NzXDVHlrbHMFXtp DKk7pYoNm+dp+tvW1Y6tu5RLojJtRoDFgf+VxvsPcmJpS6/lREnmlOW8lFQks9P+7sZHtDgRN IgEo/o+CgwM9doptHdwdF8AAOpyozLDlZQYXC9vvfx4eMLCtdC3punKfklwvzoG/q8pek= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I can't find where `get-mru-window' is called during window deletion. It's here in `delete-window-internal' /* Now look whether `get-mru-window' gets us something. */ mru_window = call1 (Qget_mru_window, frame); > Maybe a new option e.g. `delete-window-select' with type not boolean, > but a predicate with the default value `get-mru-window', and another > choice `delete-window-select-underlying' to select the "merged" window. `get-mru-window' is not a predicate. You probably mean a function so that someone could also use `get-lru-window' as value of that option? The problem with such a function is that it has to be called with some predefined sort of FRAME or ALL-FRAMES argument so some explanatory footwork would be required. martin From debbugs-submit-bounces@debbugs.gnu.org Wed May 19 12:31:56 2021 Received: (at 47300) by debbugs.gnu.org; 19 May 2021 16:31:57 +0000 Received: from localhost ([127.0.0.1]:60563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljP6y-0000C9-NP for submit@debbugs.gnu.org; Wed, 19 May 2021 12:31:56 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:48163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljP6w-0000Bn-Hc for 47300@debbugs.gnu.org; Wed, 19 May 2021 12:31:55 -0400 Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id E88C624000D; Wed, 19 May 2021 16:31:46 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> Date: Wed, 19 May 2021 19:07:18 +0300 In-Reply-To: <2ec3b911-4fb1-4b13-a5b8-28278a5c43ba@gmx.at> (martin rudalics's message of "Wed, 19 May 2021 09:42:49 +0200") Message-ID: <87h7iyzvh5.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> I can't find where `get-mru-window' is called during window deletion. > > It's here in `delete-window-internal' > > /* Now look whether `get-mru-window' gets us something. */ > mru_window = call1 (Qget_mru_window, frame); Thanks, I missed it because I searched with 'C-x p g get-mru-window' instead of 'C-x p g get.mru.window'. >> Maybe a new option e.g. `delete-window-select' with type not boolean, >> but a predicate with the default value `get-mru-window', and another >> choice `delete-window-select-underlying' to select the "merged" window. > > `get-mru-window' is not a predicate. You probably mean a function so > that someone could also use `get-lru-window' as value of that option? Yes, a function to get a window to select after window deletion. > The problem with such a function is that it has to be called with some > predefined sort of FRAME or ALL-FRAMES argument so some explanatory > footwork would be required. It's fine to call it with a FRAME argument. The problem is how to write such a function that will find the window that gets the screen space previously owned by the deleted window. Could you recommend the right direction? Maybe this window that gets the screen space is just the parent of the deleted window? From debbugs-submit-bounces@debbugs.gnu.org Wed May 19 13:41:13 2021 Received: (at 47300) by debbugs.gnu.org; 19 May 2021 17:41:13 +0000 Received: from localhost ([127.0.0.1]:60633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljQC1-0002AM-Da for submit@debbugs.gnu.org; Wed, 19 May 2021 13:41:13 -0400 Received: from mout.gmx.net ([212.227.17.22]:43979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljQBz-0002A8-OQ for 47300@debbugs.gnu.org; Wed, 19 May 2021 13:41:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621446065; bh=y9PSFNR3iRWute1GO64Wm0IY06ZO+wwggjxEQUUulZ4=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=SYjD8b/RkgflakAfvPkk/47DjgV8QOL2QkfqKvUhURRuhOdKdd2Qi9FcpMTy+4iZT RClUI5tGJrti4eIOmOrYLqGp1MluaYKLRokTxq50aF+J8dRpTAaljwogK2Ofr26Syi 4LAzRMH3hgYi7tqqr1cscVrxBf2QcyI3oEPB3jXM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([212.95.5.159]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MmlXK-1l12kZ0UPW-00jpWM; Wed, 19 May 2021 19:41:05 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> From: martin rudalics Message-ID: <0c239adb-e9d5-1fe9-4c4c-2da1603002f7@gmx.at> Date: Wed, 19 May 2021 19:41:02 +0200 MIME-Version: 1.0 In-Reply-To: <87h7iyzvh5.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:kwwraGhavdgZCw3UkAf4toHhr/cfeibaFbrE26Gemlr6hojqwZ9 BPIBEMmKBc1FHXUPhAYvXP2BgCcDYPyA6kdMZduVL0kwY+dpuacNApK5FnRd4J0oJAz4g+Y pKINZRJdSDTex2F5qCNxZnHVX3mwx5czPzeGvVBsMAiA6rBfMrwzlQ6Ys51fQx/S5hMsz8j J+VzMwX3gwidfthY3FW1w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zKgnA3Ffzec=:kQ3hqTXyWQi2xIXco8hdPZ OUtvnn2zlMnqeEs0EKpxdVTVpTRuOzqcyKLUx3FTzKly3ZfgsSsGsiLiySFaFKPOILzzPb0cO AIcS1Ho7lk1Ntq0qt2H7Ui7LtwZ/+VgwHlxfHbJ61IH2v5VsTd9j7xbvP4EcPzzHX39ACj+AV 1s+9p/lRNowriOUN0kZcTAEMuFNEZtGnJU/DmgEUVhJShC/Q0FozP53hIWhqFyKUi2yhwW/wN 4kfOJaFh+shTvAl5wuDuomQjO4f0oSBiwVZiRR91RL5NrI5pHFy3vD2jHp+K6+vMUxI6t28BX +HPEH09KKSIwGbwu9Uwhhspkh89BXA9CJWIt0kNQX5xcOl1zuIEswwwFET0R/3oPyHe5EeJHa YW0JIf73IKibQ4aJlADAkkcwB4QRylFvLcalAkP4d9TbYvugxiwOJW6TmzxrUlO/7A5vHOK2j OaP9hgdbf+KgHJzVftgG6fVHsf8oQRTrQYcerMomoIs1SCiHDDtOat1SOxOaSfS3tW+VdDrMA Ghm7sSF7DcV8llfDOpTwDZ5CcRkCAX6wkjcuOO8BY+AIB+hIWf70WFa7hj03D/RGWqB9er9Ga Qh3/4xeaAedoeqo9Nw6cs2sOhUUxtDu8Gdm3hNxLZ9INryLrPvDUTExXupT2wz7o2pCWBkrxw FZjmD+M6CmndgQzsmcmJtWClTblm7koh7uLGq2smkhXAVVwd8BgaWyUzq1YMYzPoBNZoe/aa/ C5yxhDLcJh1m4BBbsefncMwqlcac55ScrgttAMgyrzY+ZoeK2dqy/B4dXhiIJFAm3axCGSZBa EToR/5rnayNfLV6L0U/JgMWcBNsyddv5uDen6UFdbixxHDsrUg8szVXRsuiiNcZCm7T1r5Hbb JrBrwDUTqGoT0+gLujFmmSJildyEAX2ggX5cdXjhhAgNRBXfj1+kVRX5ydhEr3hEgVk3CFJRy fkmKEppKFG4pYu9XPCd4r9kxBSbvuX2UU4cPx1zC3ZAa6PlYxrzLRoBrio2qmRs/SE2zN/dfO B8IWneU3ac4lYHFpcSnPG/gfByBtSyhn0O19fVMDeA6Q7MMWqKUKzHWiCOladSOyXERfqeK/2 TEYkBaO/fjJZYrUwvJb+qRfAFcxZPEMuiMtRqZnUIQ+QDo4UPvAGSRPew+YjFQjvg3K92nrRA ayYrrSAAVefGSEDgpOmP2kHwqn4APG+hiZ+1S2mauJc8ihrsVeucPjz59nmRbz6Sv2oGA= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > It's fine to call it with a FRAME argument. The problem is > how to write such a function that will find the window that > gets the screen space previously owned by the deleted window. > Could you recommend the right direction? Maybe this window that > gets the screen space is just the parent of the deleted window? No. You probably have to save the old position of the deleted window's point in frame coordinates and have the function that selects the new window use the window that is now at that frame position. The function would be called instead of the currently hard-coded mru_window = call1 (Qget_mru_window, frame); and the call is fairly safe because the frame's first window has been already selected at that time. martin From debbugs-submit-bounces@debbugs.gnu.org Sat May 22 04:05:31 2021 Received: (at 47300) by debbugs.gnu.org; 22 May 2021 08:05:31 +0000 Received: from localhost ([127.0.0.1]:38281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkMdX-00058j-3Q for submit@debbugs.gnu.org; Sat, 22 May 2021 04:05:31 -0400 Received: from mout.gmx.net ([212.227.15.18]:54645) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkMdT-00058U-NO for 47300@debbugs.gnu.org; Sat, 22 May 2021 04:05:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621670721; bh=rXbT79Y9m6E7PDU5L3raDZ8mosLJAEw6wr54JVFw1kQ=; h=X-UI-Sender-Class:Subject:From:To:Cc:References:Date:In-Reply-To; b=HvA29SqdaGxNAfAqwjtoTT0wUVYUaqCbnfdxaqzM5MFTUV/VvX/C4RDuFZKiV9YjA PwTMSyR4ey2JdQbV4DOmJaowuY/u+rIK0JRdRpIYiXWV+R2CeZUrJ3GFHIpkqRMI22 0wUHX06AkNEzAkf1Ts8mMbKB72T9fegI8//kfxqU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([213.142.96.249]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MacOW-1l9MvT1SsE-00c9x9; Sat, 22 May 2021 10:05:21 +0200 Subject: Re: bug#47300: delete-window to select window with same position From: martin rudalics To: Juri Linkov 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> Message-ID: Date: Sat, 22 May 2021 10:05:20 +0200 MIME-Version: 1.0 In-Reply-To: <0c239adb-e9d5-1fe9-4c4c-2da1603002f7@gmx.at> Content-Type: multipart/mixed; boundary="------------F3CA85BA3FCD7C283CC891F0" Content-Language: en-US X-Provags-ID: V03:K1:zKwzkFuPMMtsFOXERNLyExfvKYz+DNv/syXbZBl1ipEBucbfaNw /hcnIXv4NhMPCLo8p3NLpIs1EVPOxtrH8sJhZCbxatrUavURwIxX8Bu1ZNye4hJSbanHOwB 15zT2J1T8DRSYxANXy80ncq/b+HmCVII81+luVwIfGNYCOcTvAkEwXEIHASAMHMam/CtTsb Q69QETfnssGd7YYMr+djw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:2udq0oWeOSE=:rCA0YhytwppHKXiJ9TjZl+ j+5OvqToD//3RkBT+gCoXhbI7cw6BieLuFaZTv25vneCfowKS+lvBg2OiqAd2ZpNGWuh79UFH NQqqyYMDBXm9oftczm6RIxeyvEp0r6Oj3e9bLbd2SGTQaOhsOucb3PxgJarrFqc3uUkWNbu/P d4d4pTvlEL5O2pIQmhWyDUk6+Sr/RDVS2cwmtTgEzmM1eewvrYdiuaC44mq8BrOIQKl0ekkPg YMlI9/R5LaaZ7RWmFbqqO1C5mgZjIouViufwqmFHdJ3iB5xxMbGx6uNdMNZc1Q/s+bechM0Gm eTYKr6t6Ftx0HeK8d82NqGebc/WR1wX4btyHgUpIzV8zYPXagPELF+OjH5cb8Q5BuGnW5MiP4 C0s59VU8k4PsTWmV6dvEqgbMvT35o4Z+utl3nrKxJx4FNdXHkvuV6dDTzVT+I+FfDFiwjbCU+ CfC//26z8+DFTXvXpTikUPFYQh34gVUYCzfJFtdc8NPlU49aGiZBTBxTXjOpqEDqWeez53lSj Ulg4F3qC39oPZ8LUGR+mjQwrERA70aOk22dL2foBuLyjqNI2weiGQtT/uiRFf+agNxm7gJA9I sTS1qLPgFvRnBLtCzkjEmbRAxhjAbD1LdVCKQPCKf8L1eoSrkOtM4mRBSieiAHD075HuokXvR Ki8q3rdnN2xzQZ8SRnMvAtuy8BN2KAPdesgPHoqMCNHYSYvjiXCaCp82Got9cT0b37L0M9t1/ NjfqomqLumfLOTobV1N7craUStbdjIFWThsslDFE0g4nrv2YpeBvpzaSx07G9YEDS+OZ7wcVV XTRz928BNlrVt/uSxtfsN5e6gs+TzU+dsre8o/srr4ERHvpTpBGretaphd11f0+QqL4F+gwUk a3pVljQtroUvKWE+RNxa60hcN+ZFUgen7ap1hireacvYd05dCbZwOqU7A9W82erOdF8YkV/K3 LtrmAFN4U7aDBrqLnalfAe2J4WnKYNPGZyPocVOd5XyohbBRgw1O2jjj+kpNpq8ZRLh5CTm/g szlpxHWRwgmLiLxb5vJDI+g8urQQ8eMRJfhpVbZqTvryS7Vczmp6TQscXE2FGPgKaUEfoOm+k 9S4cK8chM/i3rmg3cf5hcqC1/7LE/P+qPVk X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------F3CA85BA3FCD7C283CC891F0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > No. You probably have to save the old position of the deleted window's > point in frame coordinates and have the function that selects the new > window use the window that is now at that frame position. Just to explain what I meant above look at the attached patch. I think we should then move the `get-mru-window' call to `delete-window' too and combine them all with the 'no-other-window' check so we never select a window with NORECORD nil twice here. martin --------------F3CA85BA3FCD7C283CC891F0 Content-Type: text/x-patch; name="window.el.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="window.el.diff" diff --git a/lisp/window.el b/lisp/window.el index a403daf10b..32742f07c5 100644 =2D-- a/lisp/window.el +++ b/lisp/window.el @@ -4800,6 +4800,8 @@ window--in-subtree-p (throw 'done t) (setq parent (window-parent parent)))))))) +(defvar delete-window-use-posn-at-point nil) + (defun delete-window (&optional window) "Delete WINDOW. WINDOW must be a valid window and defaults to the selected one. @@ -4822,7 +4824,7 @@ delete-window (let* ((frame (window-frame window)) (function (window-parameter window 'delete-window)) (parent (window-parent window)) - atom-root) + atom-root posn-at-point window-at-posn-at-point) (window--check frame) (catch 'done ;; Handle window parameters. @@ -4871,10 +4873,20 @@ delete-window (t ;; Can't do without resizing fixed-size windows. (window--resize-siblings window (- size) horizontal t))) + (when delete-window-use-posn-at-point + ;; Remember WINDOW's position at point. + (setq posn-at-point (posn-at-point nil window))) ;; Actually delete WINDOW. - (delete-window-internal window) + (delete-window-internal window) (window--pixel-to-total frame horizontal) - (when (and frame-selected + (when (and posn-at-point + (setq window-at-posn-at-point + (window-at (car (nth 6 posn-at-point)) + (cdr (nth 6 posn-at-point)) + frame))) + ;; Select window at WINDOW's position at point. + (select-window window-at-posn-at-point)) + (when (and frame-selected (window-parameter (frame-selected-window frame) 'no-other-window)) ;; `delete-window-internal' has selected a window that should --------------F3CA85BA3FCD7C283CC891F0-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 22 17:27:20 2021 Received: (at 47300) by debbugs.gnu.org; 22 May 2021 21:27:20 +0000 Received: from localhost ([127.0.0.1]:40175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkZ9U-0003u3-DG for submit@debbugs.gnu.org; Sat, 22 May 2021 17:27:20 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:33459) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkZ9S-0003tn-GK for 47300@debbugs.gnu.org; Sat, 22 May 2021 17:27:19 -0400 Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id CC97D200002; Sat, 22 May 2021 21:27:10 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> Date: Sun, 23 May 2021 00:25:41 +0300 In-Reply-To: (martin rudalics's message of "Sat, 22 May 2021 10:05:20 +0200") Message-ID: <87mtsmmpey.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> No. You probably have to save the old position of the deleted window's >> point in frame coordinates and have the function that selects the new >> window use the window that is now at that frame position. > > Just to explain what I meant above look at the attached patch. I think > we should then move the `get-mru-window' call to `delete-window' too and > combine them all with the 'no-other-window' check so we never select a > window with NORECORD nil twice here. > > [2. text/x-patch; window.el.diff]... I don't know why, but sometimes `window-at' returns 'nil'. From debbugs-submit-bounces@debbugs.gnu.org Sun May 23 04:43:43 2021 Received: (at 47300) by debbugs.gnu.org; 23 May 2021 08:43:43 +0000 Received: from localhost ([127.0.0.1]:40552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkji2-0003nY-Ta for submit@debbugs.gnu.org; Sun, 23 May 2021 04:43:43 -0400 Received: from mout.gmx.net ([212.227.15.19]:34391) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkji0-0003nI-KV for 47300@debbugs.gnu.org; Sun, 23 May 2021 04:43:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621759414; bh=gag/3tpZLUvIzmfcyywM3jaXEZmFUi57L7loIsGCGQY=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=anhGZIFbcpCYYPnMBiPrZYJklVYcODRwK1PWPnQyQJJtLHHryktoAR2nvsKD2yTq6 XuvRJSEMpH1tiknsfqJXXtcMHrvfdKwa6HYIbDBuTE2bGh8hqWIBdCcGJIRqilsdpn 3/PdJzfsupjL4JOLcQeE8GufPOqowpguqgsGjBYU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([213.142.96.97]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbzuH-1lAJ1l0BxP-00dVhL; Sun, 23 May 2021 10:43:34 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> From: martin rudalics Message-ID: <624f0efa-29cd-9c2f-cbc0-4192f4900d30@gmx.at> Date: Sun, 23 May 2021 10:43:32 +0200 MIME-Version: 1.0 In-Reply-To: <87mtsmmpey.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:Q7QsId4j4i9PYuu/HFbl0num4XWxFkMyurGmfvnqp5BEXzMlZie L54ojuXTOLFeMNQ+sRP9rHN6nGQoY2coB3jzepuMdzYbnYm24ZMrfdTLDHT4tSSDFlHApv+ djDKJRkuaepx/AqrlYFRMmMH8VQhi5fm9UET0kwPWBPIg+bhaoyuyhncnvRLGxJNkgNBo3O k5OGISyFj+2i+zF5x4aWw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:LghlwgBC79Y=:MwiSpLHTusTgzRsmt/XKjc szmsJTU9lwVd/ZtfmrVrTGzJjgXk1seD0MqMAOmKlikGn8ZtycLJn0AzdQBx2KRccXIEbVmhA /Zf4ZI3NUbWCFYPWmAtPptfgydzi2+zlTLaPxmKM230zUd96RwEaXIs09MfrPw/NiY9uvm3eV PRqQcaIkRf2Kbj5qiA0Jx181s4WFBe9G41gg0xtrhkFYG/q3/+1MFxN0SmupDvfbuW/joJJ0t FVHQq83ozwutyg4pBMcMvQS9G6nOvoWaHedQ3bD58gLLKIKq4jBjmdYpOqsgjXJRvaAdJroGs a9OuC6XmRRyUxHYaVNlhKe4MCwuhohJzJCvNDALwEwHeWTAcucnV3W4cW2myNwrqpWLpA9Wr7 JM34vQsLw4iQ6fOp5RRQTar+DBetgnNN76ir8/n1sZE2l9uHcIepE6Lhk22/SLtA6TNTwsv6Z 8IoGxL5AD7p+C0W220uEeLU5d0Wa3LW8t5ilmCRZr/u8b522PeVvjZsydvA8MzON1L8B65DAy CaQsQHjd0q+RVag/VkLQgJSLdJo3AzgWXGY8f4eaHNy9uXCF2iOLcENmW4xTYa4dscRtaZdHe itZ78oxhjW0PS7y/RTY967qMW/RvXSQiIx+c2HIh+Ea6UfUKIeElPITbRMbUpL/1rqE1icw0Z dMpge7GYok0GVp6eeup76mnRW3DxvfsHH4NAiO+QQyynzHgmB2UB+WfbtrsePWc+KZcpQ7Ciu WHahq2HTbHqIqdWeMqRqO+D2y+/gePG36UQXKH3z8IV44GN1atZV1imevelOg9Iy4GULQMm/A qZ6qvGxQWdssyzMZvIiLqiuoc25TisTWBwJAIyVkqX/aL6QNCyoVYpWge60zs+lOCUeFDSndS nIYiZTUniAnWifibkZgfAPdV+HAoidmdVXgEzzM0nqFxsBIuCqooq+BqPBTuNHFZA6f9wbptz 62DrNGjxDZs5bi5jlL1EZc4u9gmZQFZUd7Myf9cF6rxYOv8QL7bcrXDri8YpiIUQAk+cqTxpJ rxqDyM+ZIQomSgVsliLiIO3BY5B9lzQzHAXYTzqqzVg7NWziyKN8ydGonvmi3VONdAQ8M4I4v H5o2hQfTbtlSZVqb4GGXkLdfTgS7/cndge6HabrfNI3PxXLZtCSyFJbegy0/441Yd6ZUlyBKt JVV6TbFrkFNPv8WPuJA+cR2FNWE/BApA5MSJdMnIjfzc4N2m8O/P09YgwRjfJCwmA/yLA= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I don't know why, but sometimes `window-at' returns 'nil'. This can happen because we are feeding it with the wrong arguments or because there is a bug in its implementation. I'd suggest you rewrite `window-at' so you can easily put a breakpoint there when it returns nil (or write your own `my-window-at' for that purpose) and wait till that breakpoint gets hit. Then have a look at the X, Y arguments and, if they are good, step with GDB through coordinates_in_window to find out where and why it fails. martin From debbugs-submit-bounces@debbugs.gnu.org Tue May 25 02:50:32 2021 Received: (at 47300) by debbugs.gnu.org; 25 May 2021 06:50:32 +0000 Received: from localhost ([127.0.0.1]:44534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1llQtc-0000FK-4U for submit@debbugs.gnu.org; Tue, 25 May 2021 02:50:32 -0400 Received: from mout.gmx.net ([212.227.17.20]:36061) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1llQta-0000F8-5e for 47300@debbugs.gnu.org; Tue, 25 May 2021 02:50:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621925424; bh=LFe52q6l/QJSCpS9bD4DGAnEJvl6Y6/UmfxiT3AuQwQ=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=lwVO/ioE4DXrgA0zl3ffXel4Jf8GM9k0pUQL7VunW4Laos9yplTVxKCJS7ZivR9W7 8+GN2+FsCptrYvtpcJAZ/1srOhAm7bP24wLeGjL8AJw3bHkh/aybTPh/43RUHZQ4Rh EmTUCI+BxIZUIp2r2h01ef5qS2zWB5gairqqh1CQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([213.142.96.13]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MOzOm-1m4AdI0Fo4-00PIiL; Tue, 25 May 2021 08:50:24 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> From: martin rudalics Message-ID: <1032ab23-3905-1b3f-917c-60ccd12337b3@gmx.at> Date: Tue, 25 May 2021 08:50:23 +0200 MIME-Version: 1.0 In-Reply-To: <87mtsmmpey.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:CSSmtvhLBy8xnGX0lhBCpBDaV+GpkWX6NRynGKVy/u3nwrPGlMl xwhtLK+YB7DueYBZANOV/gBvO3qASvv0PipClf3Pz880W/+eCvqIDUT+9+th95KjdD22vB9 Tz+V4KGJVpS23zCGYIUangKk2nV2Tc1PfBDd2GsbM0AVYoy+eMNJKiawI5o/rgQagqNzN3M Kt4wg8utBAn35dWNGHwUw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:e7H/OjYmrT8=:cno7UBJaA6Rr/X0/I0pbzO B0XXeuA1gGA29y8mxf9APekHkU7Jtda+3bcMuJwZ/2IL2A6LD4Y8vlZQ1dSzovm7OO/7868DQ Hkl9DAbbrzFLI/mTI1ZEzqc2+EgOxXRkRSaOvoF94yEgLmF206NXtjgPqIaBt8tISvJns8WfL RtV+uKxj6tkAH20e5wPGQ0O2PTf5Yukfl+WezWMYIDB1DBoTJlHCEYub7jJGtfAqczSBQxyzK JiwUePC5/xYdumYTtKhtGA4a5rg/8KkuH37+3m9fs0pw7Ok6DcKRxzJbRkA9xZrHynbrPx7jO 8J75ufPOXq69JxptA1F6PoXLVjse1LLFDykhoMPECMmJn0kKDDR8D5/v4ZFZ5MvXBcTVySzPq 4Qsej8XybkBfoYHi6THq8o/UACC1p1YP9Th1lNeVSRv19fvddRJYj0T8dWqRin+cKKEAdrQ5C ingy8iDx7r96gamER4z+aN4eYCMkJPhNFZSc9WAZzYFmDhr7sh1R1Wn5yKHbI6ZNvtWN6E5JI 5YjcL/jT2xka/9F19bNbPSACOJ21X7b30CytlkzftWK5CEh1rzu5hl9qstDziPniu/y9vT8Vf 8n+mDoykZFRWfBKhBwPf9xh9mcwWHzr9SdoUB00oHTMR1JZzrFw9OZhUpLg7JL5TpPhQptJvJ 3MwQxWeUUA0W+8Dwg31WIn3yrWzQFt24DqeZ9Xz4RzugrVgikyBzeVpFPzN1xLFPpkV+MdSdS EujTvS42vqnGgVoT73J1Eucn/Lnte97CMCBXejfU7IrVoTyUW79QQZYafUrcsiuDeoYCbi+sr aAoa2Gd9NSHL/4r93zo+Jf/AzY7f+Sn76SsruWGdLwBt8wMQR7KWlRr9nCjL67w9lY6LjsJbP P5vuVrlv0RCdgKViO9cR+Vt4sH0/tAjkddlX2cVaMI/gBG1JGMcVD7sx9jXR3c2BKdRMbJ9Wc xqCtkMfgOksX81DWYnegzZzVrYZnVVpIUkbZjTxon6FlljLcIIpOwGnIZf+yqFd/YReqCbZmK Eni2v+UHSAVX0fL5RePZAoSeFgwWmD8u7SD85TVmBMwSJ2pQjfQhjk9yft1sstiAdGpbG8gd0 iMUAxVMRU89i39St0BOnAvK9BTSF3XcMboW X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I don't know why, but sometimes `window-at' returns 'nil'. `window-at' is pretty useless anyway. Try the below instead. martin (defun window-at-pos (x y &optional frame) "Return live window at position X, Y on specified FRAME. X and Y are counted in pixels from the origin at 0, 0 of FRAME's native frame. FRAME must specify a live frame and defaults to the selected one. Return nil if no such window can be found." (setq frame (window-normalize-frame frame)) (catch 'window (walk-window-tree (lambda (window) (let ((edges (window-edges window nil nil t))) (when (and (>= x (nth 0 edges)) (<= x (nth 2 edges)) (>= y (nth 1 edges)) (<= y (nth 3 edges))) (throw 'window window)))) frame nil nil))) From debbugs-submit-bounces@debbugs.gnu.org Wed May 26 17:40:31 2021 Received: (at 47300) by debbugs.gnu.org; 26 May 2021 21:40:31 +0000 Received: from localhost ([127.0.0.1]:50059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lm1GR-0004Ue-Dn for submit@debbugs.gnu.org; Wed, 26 May 2021 17:40:31 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:38789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lm1GO-0004UO-FM for 47300@debbugs.gnu.org; Wed, 26 May 2021 17:40:29 -0400 Received: (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 80BE2C0006; Wed, 26 May 2021 21:40:20 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> Date: Thu, 27 May 2021 00:29:36 +0300 In-Reply-To: <1032ab23-3905-1b3f-917c-60ccd12337b3@gmx.at> (martin rudalics's message of "Tue, 25 May 2021 08:50:23 +0200") Message-ID: <87v9752n4r.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain >> I don't know why, but sometimes `window-at' returns 'nil'. > > `window-at' is pretty useless anyway. Try the below instead. > > (defun window-at-pos (x y &optional frame) Thanks. Now after tweaking I finally found what changes would make the workable version: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=delete-window-use-posn.patch diff --git a/lisp/window.el b/lisp/window.el index fd1c617d6b..81a770ff32 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4140,6 +4140,23 @@ window--in-subtree-p (throw 'done t) (setq parent (window-parent parent)))))))) +(defun window-at-pos (x y &optional frame) + "Return live window at position X, Y on specified FRAME. +X and Y are counted in pixels from the origin at 0, 0 of FRAME's +native frame. FRAME must specify a live frame and defaults to +the selected one. Return nil if no such window can be found." + (setq frame (window-normalize-frame frame)) + (catch 'window + (walk-window-tree + (lambda (window) + (let ((edges (window-edges window nil nil t))) + (when (and (>= x (nth 0 edges)) (< x (nth 2 edges)) + (>= y (nth 1 edges)) (< y (nth 3 edges))) + (throw 'window window)))) + frame nil nil))) + +(defvar delete-window-use-posn-at-point t) + (defun delete-window (&optional window) "Delete WINDOW. WINDOW must be a valid window and defaults to the selected one. @@ -4162,7 +4179,7 @@ delete-window (let* ((frame (window-frame window)) (function (window-parameter window 'delete-window)) (parent (window-parent window)) - atom-root) + atom-root posn-at-point-x posn-at-point-y window-at-posn-at-point) (window--check frame) (catch 'done ;; Handle window parameters. @@ -4211,10 +4228,22 @@ delete-window (t ;; Can't do without resizing fixed-size windows. (window--resize-siblings window (- size) horizontal t))) + (when delete-window-use-posn-at-point + ;; Remember WINDOW's position at point. + (let ((edges (window-edges window nil nil t)) + (posn-at-point (nth 2 (posn-at-point nil window)))) + (when posn-at-point + (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 + (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))) + ;; Select window at WINDOW's position at point. + (select-window window-at-posn-at-point)) + (when (and frame-selected (window-parameter (frame-selected-window frame) 'no-other-window)) ;; `delete-window-internal' has selected a window that should --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 27 11:21:02 2021 Received: (at 47300) by debbugs.gnu.org; 27 May 2021 15:21:02 +0000 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 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 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 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> From: martin rudalics Message-ID: <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> Date: Thu, 27 May 2021 17:20:51 +0200 MIME-Version: 1.0 In-Reply-To: <87v9752n4r.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:8TfxaxqxhSu8cZbWGeH76X2CIQng6KHivkntOVK17pplNZ2Zb9O qg8tVy8P6Wmp+tH3dMlZ5FXz66GO683GDNkmGIxozhhv3QyT4E5tmGyZQhLRXSho0KB9JRo HR1+r2J8Yp5jOjUO8HBhWAg3ryRRVmRoaWiS4LyHPbKsrwaYL+OX81X0P2ZDLo+5Fo0j4WD QSUS0vw8rXfvMrYLlQSHg== X-Spam-Flag: NO 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/xhNjJnriu6bcpbfYIqL0xr2EoKhkX6pFbpoavdAwcTF3ZenzQZRT9k01AYlgsI3K4rjlpjx v0vHLezeexAWmkjCqyX1N2T//jhpWJKbJpQ6dnWRCUzYlYw/rJJFEVU+aXSIkF+Vz9P2Ra748 8xHu2SwPV0uixe0Hw0uG7GJW8GZ8V7lOwxVwTCMLkC0ElWBUVvezxiGxqaHbKPOcwEb9KuFzp yqH2KTEHx0Bo8ZCWfVnlB3OMzKwp4/ImfuYAUS+FHE9JZpzEH4jk525MQ4XDSn/wuwbaIk4Ka quhLVye2VbZM+ZXcUiind+DXKWEC40A6BYGWw4AimfxR7sK8ZGvZUDQqgcm7zZcWuyGVFeQwP VZGz8rlWzFJ7Y3Cfdu5JiHyksk0gi1tP0ol X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) + (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 From debbugs-submit-bounces@debbugs.gnu.org Mon May 31 16:58:35 2021 Received: (at 47300) by debbugs.gnu.org; 31 May 2021 20:58:35 +0000 Received: from localhost ([127.0.0.1]:35014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnozb-0001MT-D4 for submit@debbugs.gnu.org; Mon, 31 May 2021 16:58:35 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:58045) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnozY-0001MF-HE for 47300@debbugs.gnu.org; Mon, 31 May 2021 16:58:33 -0400 Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 1A1FC240002; Mon, 31 May 2021 20:58:24 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> Date: Mon, 31 May 2021 23:46:49 +0300 In-Reply-To: <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> (martin rudalics's message of "Thu, 27 May 2021 17:20:51 +0200") Message-ID: <87k0nefwq6.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > + (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. I changed <= to < to fix only Y coordinates for top/bottom windows, but maybe X coordinates should still use <= ? > 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))) 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. > 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. 1. `get-mru-window' could be one possible choice of the new option. 2. `use-posn-at-point' could be another choice. 3. Selecting the first window could remain in `delete-window-internal'. 4. But what to do with this code block with '(other-window -1 frame)'? Should this be simply deleted? From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 02 05:08:59 2021 Received: (at 47300) by debbugs.gnu.org; 2 Jun 2021 09:08:59 +0000 Received: from localhost ([127.0.0.1]:38849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loMrz-0004Jt-47 for submit@debbugs.gnu.org; Wed, 02 Jun 2021 05:08:59 -0400 Received: from mout.gmx.net ([212.227.15.19]:59469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loMrw-0004Jf-KZ for 47300@debbugs.gnu.org; Wed, 02 Jun 2021 05:08:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622624930; bh=Nivl9xTGWv26N86Ct4POKjlS1jyKh1LtktOuOBXi/bw=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=WyfCD5dRbNCFVsLIKZu4VRv/mg1nQMBdHjMF4asuuBdRSI/m1setDspuRS8q15FA5 XqbeZKCFpU/OnI4mHfPt1f7AQq6jUNTKgwl3DB9o2RlUw6D3cTxK1hGrB9rzCSPIKr pidAimO1A+WxSJaiLV8bH/iCqSE12rLvNBlt4k8k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([46.125.249.108]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MRCK6-1m0Q6v3Ewe-00N7rs; Wed, 02 Jun 2021 11:08:49 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> From: martin rudalics Message-ID: <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> Date: Wed, 2 Jun 2021 11:08:48 +0200 MIME-Version: 1.0 In-Reply-To: <87k0nefwq6.fsf@mail.linkov.net> Content-Type: multipart/mixed; boundary="------------15EAAD56E2E096153F467FFA" Content-Language: en-US X-Provags-ID: V03:K1:BhRNYk7qHy46mqzZjGT49rmB+1zwR+Myyi/zcR0qVFmNEeoZHmN jXggjonZBKjC4XbACJxzFWWrgepCNrD8ZzRslWnAuh7K7xpGLe5fEKUwIY5NP5GUdgWgS54 uTCgmNXMQnnOkxEQ/MmWILRcVDTf/bVvbCQa58jguu7c88VjAWbfkO1W87MTRaaVrALovUP /dkk1kK7BY6ABNeY07zng== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Q84vFIFeNgU=:/YAPUN8E0HoqhGED1CbYQx 8nY6n6Nezl48Df8HC7gfxW72JsHQ58zsTgCry+s1KOERzoh8mcMAlsdVALrHnm0UbDKxMIoCZ X0vo1TkDeRTAMxO0cTwLcBg1y7LcurTkOaKW8ldy5d5rIHdkmoZWgou629GfpLzIUrsZk6eRm NA57X3KOnEYTSFgvvsK7TAs6tiey5bxoTy53F21rchnp+omHVVBtvKCgvmHN64jFBA4oKqJTY Rq4KdYdL/PvKovh2kuXH5c1Jaeb0NEd/T+MszAVaCDAiP89HwlZDRNnFxosk/y4HqrjG7MSK1 eo+pNkiy9QDUUeqhbhk38X2iDn3/8hbBeI85sMB8QPMiGllsMFSFk3CchRlV5cA6H8odBHYVr EWidJFihOp0fviIwsbfEgqFx8X8VAx/FUogU6K85TSJugWXXB7tfQwVDfjSkh3M6/zcGFSxd0 Qw97AAjcBzwKmehWNgwM6TN5pQrzko4lm4UMBHVmNKSjHfm4NXUrSWZWd61v9FcZGxPjlAYqm 0Z1/7jQlS92VlFd2GjeEaazLZi34ZzfDscbN/fBu/QLHurJ02v5XB6hzuq1dKlymdUZgFfq0u i3KsEA8xyCMgCXKGlnutrU+tw7gjCWDn8Hi39Dv9LPH2hMIezRCb9OjHT1+SUzeceP2PBI+7U ccJW6gniHPSAY+1j/Gy7/M9e4Vgo43uX67frFhY08FU/6mOzdM+v/s3ojo3KfPMVzbQnkXrla 2Va3TFmAohwKFxWfzgT936iHUtUmqnsCRoYaKbdHhQeNWB1f87YHyhK7OTSfyykedArZxyHRv IcSmorXvBeUi+4AtIYRrT1GEzJbhSxjV2P4D5Yr8+Q4+dQmKV8yPnYxG2vXNIOMNcYSfQ8L2i tl4T6NlhvOqOm6w7vNFo9L6ZvnPwE7IMJyeo1SFjPyaxCcqB0zwkkr+C4Lz+ZMlhwY6jINqLH xSG7kc+neZwKGvZixwZxw+FIj6QSnV8/VKOGvmLtfNyfs/es9El0geMR8Rsgq+2+slHH+5Zks EDYEa7evvIfyZBeukgDlSey1Xk5yJ+bZB7elCWn/UiuIeZaNBnb4kVrFBmIYOmsZ4dXHJMv0W mEHV+/70CHiv0Ui9uKzIcBQ7dI3O92ouUgT X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------15EAAD56E2E096153F467FFA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > 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 --------------15EAAD56E2E096153F467FFA Content-Type: text/x-patch; name="selected-window-after-deletion.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="selected-window-after-deletion.diff" diff --git a/lisp/window.el b/lisp/window.el index fd1c617d6b..20f664c6f5 100644 =2D-- a/lisp/window.el +++ b/lisp/window.el @@ -2538,12 +2538,14 @@ get-lru-window (setq best-window window))))) (or best-window second-best-window))) -(defun get-mru-window (&optional all-frames dedicated not-selected) +(defun get-mru-window (&optional all-frames dedicated not-selected no-oth= er) "Return the most recently used window on frames specified by ALL-FRAME= S. A minibuffer window is never a candidate. A dedicated window is never a candidate unless DEDICATED is non-nil, so if all windows are dedicated, the value is nil. Optional argument NOT-SELECTED -non-nil means never return the selected window. +non-nil means never return the selected window. Optional +argument NO_OTHER non-nil means to never return a window whose +'no-other-window' parameter is non-nil. The following non-nil values of the optional argument ALL-FRAMES have special meanings: @@ -2565,7 +2567,9 @@ get-mru-window (setq time (window-use-time window)) (when (and (or dedicated (not (window-dedicated-p window))) (or (not not-selected) (not (eq window (selected-window)))) - (or (not best-time) (> time best-time))) + (or (not no-other) + (not (window-parameter window 'no-other-window))) + (or (not best-time) (> time best-time))) (setq best-time time) (setq best-window window))) best-window)) @@ -4130,18 +4134,53 @@ window-deletable-p ;; of its frame. t)))) -(defun window--in-subtree-p (window root) - "Return t if WINDOW is either ROOT or a member of ROOT's subtree." - (or (eq window root) - (let ((parent (window-parent window))) - (catch 'done - (while parent - (if (eq parent root) - (throw 'done t) - (setq parent (window-parent parent)))))))) +(defun window-at-pos (x y &optional frame no-other) + "Return live window at coordinates X, Y on specified FRAME. +X and Y are counted in pixels from an origin at 0, 0 of FRAME's +native frame. A coordinate on an edge shared by two windows is +attributed to the window on the right (or below). Return nil if +no such window can be found. + +Optional argument FRAME must specify a live frame and defaults to +the selected one. Optional argument NO-OTHER non-nil means to +not return a window with a non-nil 'no-other-window' parameter." + (setq frame (window-normalize-frame frame)) + (let* ((root-edges (window-edges (frame-root-window frame) nil nil t)) + (root-left (nth 2 root-edges)) + (root-bottom (nth 3 root-edges))) + (catch 'window + (walk-window-tree + (lambda (window) + (let ((edges (window-edges window nil nil t))) + (when (and (>=3D x (nth 0 edges)) + (or (< x (nth 2 edges)) (=3D x root-left)) + (>=3D y (nth 1 edges)) + (or (< y (nth 3 edges)) (=3D y root-bottom))) + (if (and no-other (window-parameter window 'no-other-window)= ) + (throw 'window nil) + (throw 'window window))))) + frame)))) + +(defcustom selected-window-after-deletion 'mru + "How to choose a frame's selected window after window deletion. +When a frame's selected window gets deleted, Emacs has to choose +another live window on that frame to serve as its selected +window. This option allows to control which window gets selected +instead. + +The possible choices are 'mru' (the default) to select the most +recently used window on that frame and 'pos' to choose the window +at the position of point of the previously selected window. If +this is nil, choose the frame's first window instead. A window +with a non-nil 'no-other-window' parameter is never chosen." + :type '(choice (const :tag "Most recently used" mru) + (const :tag "At position" pos) + nil) + :group 'windows + :version "28.1") (defun delete-window (&optional window) - "Delete WINDOW. + "Delete specified WINDOW. WINDOW must be a valid window and defaults to the selected one. Return nil. @@ -4156,7 +4195,11 @@ delete-window `delete-window' with the root of the atomic window as its argument. Signal an error if WINDOW is either the only window on its frame, the last non-side window, or part of an atomic window -that is its frame's root window." +that is its frame's root window. + +If WINDOW is the selected window on its frame, choose some other +window as that frame's selected window according to the value of +the option `selected-window-after-deletion'." (interactive) (setq window (window-normalize-window window)) (let* ((frame (window-frame window)) @@ -4191,11 +4234,11 @@ delete-window (window-combination-resize (or window-combination-resize (window-parameter parent 'window-side))) - (frame-selected - (window--in-subtree-p (frame-selected-window frame) window)) + (frame-selected-window (frame-selected-window frame)) ;; Emacs 23 preferably gives WINDOW's space to its left ;; sibling. - (sibling (or (window-left window) (window-right window)))) + (sibling (or (window-left window) (window-right window))) + frame-selected-window-edges frame-selected-window-pos) (window--resize-reset frame horizontal) (cond ((and (not (eq window-combination-resize t)) @@ -4211,15 +4254,63 @@ delete-window (t ;; Can't do without resizing fixed-size windows. (window--resize-siblings window (- size) horizontal t))) + + (when (eq selected-window-after-deletion 'pos) + ;; Remember edges and position of point of the selected window + ;; of WINDOW'S frame. + (setq frame-selected-window-edges + (window-edges frame-selected-window nil nil t)) + (setq frame-selected-window-pos + (nth 2 (posn-at-point nil frame-selected-window)))) + ;; Actually delete WINDOW. (delete-window-internal window) (window--pixel-to-total frame horizontal) - (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)) + + ;; If we deleted the selected window of WINDOW's frame, choose + ;; another one based on `selected-window-after-deletion'. Note + ;; that both `window-at-pos' and `get-mru-window' mail fail to + ;; produce a suitable window in which case we will fall back on + ;; its frame's first window, chosen by `delete-window-internal'. + (cond + ((window-live-p frame-selected-window)) + ((and frame-selected-window-pos + ;; We have a recorded position of point of the previously + ;; selected window. Try to find the window that is now + ;; at that position. + (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))))) + ((and (eq selected-window-after-deletion 'mru) + ;; Try to use the most recently used window. + (let ((mru-window (get-mru-window frame nil nil t))) + (and mru-window + (set-frame-selected-window frame mru-window))))) + ((and (window-parameter + (frame-selected-window frame) 'no-other-window) + ;; If `delete-window-internal' selected a window with a + ;; non-nil 'no-other-window' parameter as its frame's + ;; selected window, try to choose another one. + (catch 'found + (walk-window-tree + (lambda (other) + (unless (window-parameter other 'no-other-window) + (set-frame-selected-window frame other) + (throw 'found t))) + frame)))) + (t + ;; Record the window chosen by `delete-window-internal'. + (set-frame-selected-window + frame (frame-selected-window frame)))) + (window--check frame) ;; Always return nil. nil)))) diff --git a/src/window.c b/src/window.c index 2d98ae5f15..db324effcc 100644 =2D-- a/src/window.c +++ b/src/window.c @@ -5148,15 +5148,13 @@ DEFUN ("delete-window-internal", Fdelete_window_in= ternal, Sdelete_window_interna adjust_frame_glyphs (f); if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f))) - /* We deleted the frame's selected window. */ + /* We apparently deleted the frame's selected window; use the + frame's first window as substitute but don't record it yet. + `delete-window' may have something better up its sleeves. */ { /* Use the frame's first window as fallback ... */ Lisp_Object new_selected_window =3D Fframe_first_window (frame); - /* ... but preferably use its most recently used window. */ - Lisp_Object mru_window; - /* `get-mru-window' might fail for some reason so play it safe - - promote the first window _without recording it_ first. */ if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) Fselect_window (new_selected_window, Qt); else @@ -5164,24 +5162,9 @@ DEFUN ("delete-window-internal", Fdelete_window_int= ernal, Sdelete_window_interna last selected window on F was an active minibuffer, we want to return to it on a later Fselect_frame. */ fset_selected_window (f, new_selected_window); - - unblock_input (); - - /* Now look whether `get-mru-window' gets us something. */ - mru_window =3D call1 (Qget_mru_window, frame); - if (WINDOW_LIVE_P (mru_window) - && EQ (XWINDOW (mru_window)->frame, frame)) - new_selected_window =3D 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); } - else - unblock_input (); + unblock_input (); FRAME_WINDOW_CHANGE (f) =3D true; } else --------------15EAAD56E2E096153F467FFA-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 03 17:44:31 2021 Received: (at 47300) by debbugs.gnu.org; 3 Jun 2021 21:44:31 +0000 Received: from localhost ([127.0.0.1]:44942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lov8h-0006fe-0E for submit@debbugs.gnu.org; Thu, 03 Jun 2021 17:44:31 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:3991) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lov8e-0006fO-Jo for 47300@debbugs.gnu.org; Thu, 03 Jun 2021 17:44:29 -0400 Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 9904A240003; Thu, 3 Jun 2021 21:44:19 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> Date: Fri, 04 Jun 2021 00:20:32 +0300 In-Reply-To: <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> (martin rudalics's message of "Wed, 2 Jun 2021 11:08:48 +0200") Message-ID: <87o8cmwrsf.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I called them just 'mru' and 'pos' now. The option is called > `selected-window-after-deletion', there might be better names. Maybe better with the same name prefix as `delete-window'? For example, `delete-window-select'? But the current is also fine. > Please have a look. Thanks, I tested out, and everything works nicely. Only minor remarks: > +(defun get-mru-window (&optional all-frames dedicated not-selected no-other) > +non-nil means never return the selected window. Optional > +argument NO_OTHER non-nil means to never return a window whose Typo: NO-OTHER > +(defcustom selected-window-after-deletion 'mru Not strictly necessary now, but for future extensions would it be possible to allow this option to be customized to a function that selects a window? > + :type '(choice (const :tag "Most recently used" mru) > + (const :tag "At position" pos) > + nil) This 'nil' needs to be replaced with a list like: (const :tag "First window" nil) > + ;; If we deleted the selected window of WINDOW's frame, choose > + ;; another one based on `selected-window-after-deletion'. Note > + ;; that both `window-at-pos' and `get-mru-window' mail fail to ========= Typo. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 04 05:19:38 2021 Received: (at 47300) by debbugs.gnu.org; 4 Jun 2021 09:19:38 +0000 Received: from localhost ([127.0.0.1]:45349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lp5zN-0000xj-Q5 for submit@debbugs.gnu.org; Fri, 04 Jun 2021 05:19:37 -0400 Received: from mout.gmx.net ([212.227.17.22]:36577) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lp5zM-0000xT-CW for 47300@debbugs.gnu.org; Fri, 04 Jun 2021 05:19:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622798370; bh=FzfcxIwWhaC1EBKJw26ydEQcRwlwsAYkGfROxw6DywM=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=SFRpN4Aux8FB5apD8fVXCVBnJm2KVJnW7+L0gp0HgX8xCj5Tz90+glhaaAbJC0l2o Tcg204Z5lNEJ2NqGy5PxYZlh1T9Lk4VifXLKsf6ONt9o36q2yNYKPoSKWbGlNcCuK6 bRvU886azjcsPy4aOrsYzvjSkhoTutGBCfRZbZdY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([213.142.96.52]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N4zAy-1lPYsY0WpA-010xUi; Fri, 04 Jun 2021 11:19:30 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> From: martin rudalics Message-ID: <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> Date: Fri, 4 Jun 2021 11:19:29 +0200 MIME-Version: 1.0 In-Reply-To: <87o8cmwrsf.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:IH4bxfSjji3sf5YJhDIUyg4m4by23OQEuJJauE/WZoMKIlzH9l7 IeSoyJerKqkr7fmBze0hnyer8GEEbkVz9AVUX0AIx9fZ+iZYHhzbY25OXVxHTlJWxORUVPK wPcPHdG4o3+M6uregAIt35k+Z2t4cvSs0FOVQQIKrg3P3FJV7iw9Z2pd/657H91N5RnEFOB +f8X7584X288akBTGKKpg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:8U0viCmwG2k=:WWq5I8UYIYtgtXdPhJfmXG mGShMHWEMIaR/c4Un6kHgY9iIRBGZeJZskwVAM5g70YsrWVbfmQoQQvnYaOoTpX78fOw4o0cJ En4hMTcIk6ceDlX/o3PWYUyS4654orZHGN4Q10Fmp62+bsz1GsW2IsL2CXRF5MIF1R87P8UGT YiVHoy2pt/KRpE4xtSQO8fPqk1w0/m1bnAIbi9jvc7/z6I2PooV6zBzgtqFTgh8YhFtHbMtp+ AQTChIahhLH0E3wHBgFALDCeVt46Ck9EfwTjwQyYWMeoaoDGvAznLYWBF34QTm3siYB2eHifz s2XRrigOCxW5rtU81SzYJXgK5EdGSFb1ankifRK/7Do3RNM+2wJp0N8tfzD7a4Pwv0dYiwpzN FZ5j+T5KjYcP4rRD5yh3+NJIpukWctSH0eewftJ7Tpc0GU0uLrqoSDf0ire+m+W/m8lr/SNOM gNJmpW1hgSmK9iSi7T3SlZ+daVRwz6xjmTyexqkHFvG+kraJQfZi7v3ChpODFoWe4tRFn7Cbi 0mGPoWcTOU4MucXphIFXE3EbopJ5GvHYMAvzhOye8s4kCVDhyXQkK5s+D/R2UDnBxUw44KlWO 2dXJlMU/+SuqRRHwdSV1ZTOgFkY2+gwM3GwIuiIoXIIUOLS9/J4utm/lXLSUf0uyUskgmXUZO n/A4Vy4prVk5fGexIziAiS/GAmIYegHpssraDLXfhpNVL39yseOnEG+VsbVbyn3jHxVY2NMob xceoJtSvs/P9h9biG1E8Ckfa3GHWKw+mTtuzd+vmS+4RSXvDPKv79v+STScLOQK4ojOD1M5ym Cf0QR5a6GqEm/mjwuLAIapgd+QaByky/3srq0dhJvZyrdhNqy8BLTOBWCJkw86Wr833adXScz m2CW9SWBfLgt1CUWliPj8jtfao/shSbM75hZLvIs7zxbzP5LUZN8WqKCBcVy8GEeUxdgwZrtI xMx8gn+Qt8FxYafzsjZuF5Bw5Xk6cqXmoxPzBe660Mgxq3MLWwpFRlbT4Zhwrn0Zk1CX4Bvn9 rowbbQrt6P5QpXGRMH+slrrP8IBNdYFdzXWdVyCrABqlz0NMkzpywLPSQrfbJoeZ+R+ZDtmYm qIJQgSaUmMP9VUdjxW/laffHuHBaP9lFqAa X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> I called them just 'mru' and 'pos' now. The option is called >> `selected-window-after-deletion', there might be better names. > > Maybe better with the same name prefix as `delete-window'? > For example, `delete-window-select'? But the current is also fine. It's not about "selecting a window", it's about "setting a frame's selected window". >> +(defun get-mru-window (&optional all-frames dedicated not-selected no-other) >> +non-nil means never return the selected window. Optional >> +argument NO_OTHER non-nil means to never return a window whose > > Typo: NO-OTHER Indeed. >> +(defcustom selected-window-after-deletion 'mru > > Not strictly necessary now, but for future extensions > would it be possible to allow this option > to be customized to a function that selects a window? > >> + :type '(choice (const :tag "Most recently used" mru) >> + (const :tag "At position" pos) >> + nil) 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. > This 'nil' needs to be replaced with a list like: > > (const :tag "First window" nil) > >> + ;; If we deleted the selected window of WINDOW's frame, choose >> + ;; another one based on `selected-window-after-deletion'. Note >> + ;; that both `window-at-pos' and `get-mru-window' mail fail to > ========= > Typo. But it rhymes! martin From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 04 12:40:26 2021 Received: (at 47300) by debbugs.gnu.org; 4 Jun 2021 16:40:26 +0000 Received: from localhost ([127.0.0.1]:47821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpCry-0003On-Eb for submit@debbugs.gnu.org; Fri, 04 Jun 2021 12:40:26 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:48867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpCrp-0003Nv-QN for 47300@debbugs.gnu.org; Fri, 04 Jun 2021 12:40:18 -0400 Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 12304200004; Fri, 4 Jun 2021 16:40:09 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> Date: Fri, 04 Jun 2021 19:29:34 +0300 In-Reply-To: <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> (martin rudalics's message of "Fri, 4 Jun 2021 11:19:29 +0200") Message-ID: <87k0n97g1t.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> I called them just 'mru' and 'pos' now. The option is called >>> `selected-window-after-deletion', there might be better names. >> >> Maybe better with the same name prefix as `delete-window'? >> For example, `delete-window-select'? But the current is also fine. > > It's not about "selecting a window", it's about "setting a frame's > selected window". I just tried to keep the prefix `delete-window-...'. Then maybe `delete-window-set-selected'? >>> +(defcustom selected-window-after-deletion 'mru >> >> Not strictly necessary now, but for future extensions >> would it be possible to allow this option >> to be customized to a function that selects a window? > > 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'. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 06 03:43:57 2021 Received: (at 47300) by debbugs.gnu.org; 6 Jun 2021 07:43:57 +0000 Received: from localhost ([127.0.0.1]:50538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpnRt-00015z-Cs for submit@debbugs.gnu.org; Sun, 06 Jun 2021 03:43:57 -0400 Received: from mout.gmx.net ([212.227.17.22]:54951) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpnRr-00015m-Rs for 47300@debbugs.gnu.org; Sun, 06 Jun 2021 03:43:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622965429; bh=1kfODHbEpj0O1nyUXnNJqvj7ag16UDlKlQIn/+hhT+c=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=UjO4D8zuD1pPntHO4w1vgsYKRysnSCxSBdXQup/vrMiyRc6lCdKW5Oc8WmQ/ed3Vs IhHvW2JdYqfCt93v9Ixgc3VT+CQBFtRb3MZ4wvwBZ0YdIYLXF+LpRz58iW5vzP4Oz2 96X8pS30VeRgMclXykIiiT0pPnmzlJ2VuVdkkLkg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([46.125.249.84]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MHGCu-1lcXtF1e6a-00DEZ8; Sun, 06 Jun 2021 09:43:49 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> <87k0n97g1t.fsf@mail.linkov.net> From: martin rudalics Message-ID: <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> Date: Sun, 6 Jun 2021 09:43:47 +0200 MIME-Version: 1.0 In-Reply-To: <87k0n97g1t.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:w5Sy+/JZdJDtuSJs0QckcDPkpiaBwVerEgGpssLVzcOul7umFA2 8i75Ma1U3WfPY+p0an5EEsuv57mrGh5IN0EdLqHPPGbQp615NjHO7RWiyuqokYrdvfOF/Gm dGURyjPf/q1ono7rnM3/+kMvMAGUw1o9hXQgPudjZgImn016mbPHkELKhsdsrkDyM0Qtyas LGcXGLVueARWTmC2q4NcA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:dBliyELxldU=:5Io1gug3TnzcRHgYxNeGbz E4XHDFFbIbPKsAFJ63ZajpM+acHwHNpjOeAGYjsko/gIVPpI+Icr2FF+D98hYYpjs8m3AmaFx oLuWLNI5yfgX+SwWIRwQ5Tkdbc2fvIhexTaepV3ekectez72IDrdw0YqqLMS069N7O3EeDg97 Ux7gktHyuDuA5mv0k3kqhhjGuSeo8j5rfGvz8JR730wlpJ/IDgk9YXy2Xkg4sL1w0su5H7AZ9 gU5GbPB850cbAKO9c/LB7DdWkPcsWTwKnSSgHTD/IEnOdxFqx3bqJ/hQ3FuQ/cx9MZ9sIBmSD DVFtDiKiykDRK5xQN9eWgqued7QYGZ3gPqI5J3tQoZhC8wOHlwcNI4sSKBbGO6yVrw6bqB0Er JEDiuOuTA6VEH/yZKO6Z6/H3UX/fgVH3ST5vhwD4SvtJUFW0p1cSYxAdJLm2kA8s/LCrj8j5j m3okWZX81oIPK90V3pQJXDAy1VLC7UKKMMOmKwUZYYmf0l3E7AldBxQIpphPq9yxS51QBqzwz wItqN6W1cyyWlIDLXyN9CVjE1qS5tRbDklz/DDCyKkR/Q5L9/O3KMa0FnFkj2PVHaJQUtEcC6 YUjJK1MWmSo+MFVn4Ab60VzLzRq4jQoU8ovgNIjO2aM7KgrDy7gCXDhU6fds5gdi7TqtE6XDM t6qyfMVR2Iiv/I9VZjL8a7qFFiv58EMxyLJbA3m2uelRuE1tKjN/28rebkOYBcsX1u7VMR9ft c6CkluZKjOtvzP7GcVFqOSs72IPzimhz6k/BXsCGBEFcFReqf/WTaZdXhTKWBgd72k0Q8kTtf FqoaelLy5U+6UqfTfnRSUOimls6bPUdhxaJW7RwFmW2SPtQvPTS9xVzuCAAHhBpEruKir3KLc cBCZW+Jhv9YYxuA0JHmnhlm4Sa2RptR3AziZZNUJRLlD4HbGStCPBwE029WoYLDL2irhTSaAz BiQdhw5xJY3+gvD/90a24ScT2clxDiSxgJMpLWwKms8bRUweVT89Cb4Etrw9osx+JzTTLpiE5 Ke3sp65sGcWXDD2/6hxqvG78cY1PYhQ1JwZoO2m4jl5mra6Qmk7AHx28y9GBp4g4RZeGemWGK ayjGVAmhB3wwIiP6YRDAn2UoHSA2BvNKEYm X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >> It's not about "selecting a window", it's about "setting a frame's >> selected window". > > I just tried to keep the prefix `delete-window-...'. > Then maybe `delete-window-set-selected'? Not very illustrative either. Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [46.125.249.84 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.17.22 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.227.17.22 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) >> It's not about "selecting a window", it's about "setting a frame's >> selected window". > > I just tried to keep the prefix `delete-window-...'. > Then maybe `delete-window-set-selected'? Not very illustrative either. >> 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. martin From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 06 17:15:15 2021 Received: (at 47300) by debbugs.gnu.org; 6 Jun 2021 21:15:15 +0000 Received: from localhost ([127.0.0.1]:54044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lq071-0008Vo-3W for submit@debbugs.gnu.org; Sun, 06 Jun 2021 17:15:15 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:18495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lq070-0008VV-3D for 47300@debbugs.gnu.org; Sun, 06 Jun 2021 17:15:14 -0400 Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 4B2B3240008; Sun, 6 Jun 2021 21:15:05 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> <87k0n97g1t.fsf@mail.linkov.net> <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> Date: Sun, 06 Jun 2021 23:47:56 +0300 In-Reply-To: <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> (martin rudalics's message of "Sun, 6 Jun 2021 09:43:47 +0200") Message-ID: <87zgw2lnyb.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> 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)))))) From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 07 03:35:18 2021 Received: (at 47300) by debbugs.gnu.org; 7 Jun 2021 07:35:18 +0000 Received: from localhost ([127.0.0.1]:54346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lq9n4-0000o5-BD for submit@debbugs.gnu.org; Mon, 07 Jun 2021 03:35:18 -0400 Received: from mout.gmx.net ([212.227.15.15]:36553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lq9n1-0000nm-6G for 47300@debbugs.gnu.org; Mon, 07 Jun 2021 03:35:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623051308; bh=w4ynMP8xZLLaa4aLjI41TY2QL55BhPTUUqNsO9WsIFA=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=MFBx1D2hevrGgLP4JRxvBoItDkyqVUD87Q2iNcVKtoTYHZg3iM7RhShb3PX8q6MBS v3Qnp/wRilm90vq12VSSvk+o3phD6OmrT+As7uaBNW+yQPDLoQcwAyTYQnPGZNlrXc Sz8JQLGqmIUaQ3CS8HaGW1uZC8vx+TVE25JU39VI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([213.142.96.94]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbzuH-1lDmtf2TXj-00dVa8; Mon, 07 Jun 2021 09:35:08 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> <87k0n97g1t.fsf@mail.linkov.net> <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> <87zgw2lnyb.fsf@mail.linkov.net> From: martin rudalics Message-ID: <52edd629-faee-9c91-525d-51a34d8a0a15@gmx.at> Date: Mon, 7 Jun 2021 09:35:07 +0200 MIME-Version: 1.0 In-Reply-To: <87zgw2lnyb.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:OxMVmO1fhqflCaeTZiAyYYXqDZRM0q/vV0q2688QcEX9MO8uGRp 3TG6oDXRiC0+aycbrg0TMEQXPOR20zJUraqWVudtF4OqoDeXk/GjiRDgS/z1JIqqi2E4DpS CvIQF1izaWQIO0MfoJjGNsT1n+AvukP6JgQppoyKmlb1JBfgqPkVFM6Dzt+xxhbVX87xtY7 YU1clsoJuu8e++AynVeag== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:iwKV01lFcfE=:dcF5zPymKTsq4eF/hWDL+B 8J2RRjFdpFsliEKxFoEa15sEBH6Hg6Q/Dfo0+gIK8nWMdEZPC3/H/mbwupYH+6sKXQt8fryP2 XqAq7QB0oBW6twAIZfeiTh0AQJIF1xDEbc6HHCV6x7YzFRIG+q1bMFG+MdfwVzA3zs908jNUR NXPbbzesvWXPe+v+N3xeGuRP9wpc60dm2/CzZbD0d+VZURdccO5gpXNyoE94+Wob4rdZ3sore FF8y8HESZjcmvwKoUKoyPAt8CyRbbqJDBpsM/4sNDPA6eWBWUbVZCi34vszgBvs7/SzaHRLUX cXrGXsm3p5yzDSYO5U+ESTnaj/q7l7fHpO91rxqPB1dblC6rcFgQzEtdZ16RzJU5Pgul+ldhn Hj5t8Sib4NMOM9JS9yr7oBQ2Uqw3R5eQaqcT2R6B614LF7MqKUnbOVuI+HpwSE+AFO4iWuqAA P6TkOsccsqyATRUOfz/5Hrmb0vT7rsV3HChQwmP11RjrCFhBwi+l7DB3auQ7CcNr1VMo7DA42 9eB1yJWvBXqUmUOAQXURe3fo9dxSXg8yKXBVaBTr1LHmvqXs5KvHoH9lmqSqnLP2EQLiNv3sn hbFs5NRcadHAvVTP+qvd7V8bMeqe+FvziyF/QkwNgLg5/U7DVdDS1zjadt73UPZ3Rawf7TaOT Mk5+4L7Lq702uvcKfbjDZOFBRcHNGG/hJl1Ep/fe4jH6BpW/AQF30K0lSrB8/xpHgE8rUGCHE OOI5Qlx48Jya4zt0Ib1Ok/RkaFN6pttfS+XpjN6mcf+fhoE+Ml8/fzDKhX004xZRO/CEsuTNo MGK8cyngI9V8Wvf6+fXb7jvyAXX2sh0c4n7jFz/+rO7kbcfPPrwUSbBDPX5nDLN+j82Fa28gg rhqjZGF1r9PBNLb6ncZ+FBPlE8LRj7lBMAm5bkhVXFMQJYeQ9SkOQLFLyNIGuMsn++gavlz/r dJ2xATZUOacoWa3d+92Q/8xzpiGs9aKz9CguBCI6/9l++wzW3Tiyw7bA4FaMHfPICF6iFi09j 4LnKP/yoH21Mv+9X2KWgVdgKJJANLQh0cLyI8TqvY+lnAmFwiASnRER4QPPSaOja93tiip5pT d8+O6C4Uj70/vpdbTfzx5o/QySHlq+rX6+G X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 07 17:03:06 2021 Received: (at 47300) by debbugs.gnu.org; 7 Jun 2021 21:03:06 +0000 Received: from localhost ([127.0.0.1]:56778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqMOo-00031l-Lf for submit@debbugs.gnu.org; Mon, 07 Jun 2021 17:03:06 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:56227) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqMOn-00031G-1k for 47300@debbugs.gnu.org; Mon, 07 Jun 2021 17:03:05 -0400 Received: (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 2668FE0002; Mon, 7 Jun 2021 21:02:56 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> <87k0n97g1t.fsf@mail.linkov.net> <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> <87zgw2lnyb.fsf@mail.linkov.net> <52edd629-faee-9c91-525d-51a34d8a0a15@gmx.at> Date: Tue, 08 Jun 2021 00:00:27 +0300 In-Reply-To: <52edd629-faee-9c91-525d-51a34d8a0a15@gmx.at> (martin rudalics's message of "Mon, 7 Jun 2021 09:35:07 +0200") Message-ID: <87r1hdjspg.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> 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 I'm not a specialized user because I didn't know about the 'delete-window' parameter :-) > 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. A lambda was just an example. But constants like in your previous patch are fine. So you could just push it when you want. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 10 03:44:19 2021 Received: (at 47300) by debbugs.gnu.org; 10 Jun 2021 07:44:19 +0000 Received: from localhost ([127.0.0.1]:35374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lrFMR-00087j-5t for submit@debbugs.gnu.org; Thu, 10 Jun 2021 03:44:19 -0400 Received: from mout.gmx.net ([212.227.15.18]:34197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lrFMO-00087R-5C for 47300@debbugs.gnu.org; Thu, 10 Jun 2021 03:44:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623311049; bh=zKLlaHoqO7TB6dRhSWg8d/y+QjCy5JgvXih2vJwniig=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=DdhOvVjxs1ClpA1JFYGe6lURsUIxWYQZizKvkipsW/hWI8tjDjbbYwIUSOYy1rKmV JYIQYvom595qh+58QRLWRxjxgkqvMybOOOK4U6ig6M7nTcNiaENWTPwf536EGdv44t SPtO0+U6tHU3mrHLFCFYtgsE0ENZN1j5PFb8V38Y= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.100] ([46.125.249.15]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N63Ra-1lFhbt1VMm-016O8E; Thu, 10 Jun 2021 09:44:09 +0200 Subject: Re: bug#47300: delete-window to select window with same position To: Juri Linkov 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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> <87k0n97g1t.fsf@mail.linkov.net> <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> <87zgw2lnyb.fsf@mail.linkov.net> <52edd629-faee-9c91-525d-51a34d8a0a15@gmx.at> <87r1hdjspg.fsf@mail.linkov.net> From: martin rudalics Message-ID: <0b2c395f-c9ff-7337-270a-b86f5d8bc27d@gmx.at> Date: Thu, 10 Jun 2021 09:44:07 +0200 MIME-Version: 1.0 In-Reply-To: <87r1hdjspg.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:v6zLs2m8Ad51l24ERtj7rsW4hXQpjuzqXSDHNhnIXfnfpV9oX3X YKESVDndActW5uUcuRu3fipuec7pbcC31DwyKTuTodWbSRKemTD5VMfSLBz1VdYhcY0y5MY IwMGDk+hdRzI3oYL5CFV173aqvchBbRirFPV30MxkkBMdCpc2imQUe7bgZwJUciirNGBdAX rv8r+AAG7mxb85sR+gQwQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:PU+v/9teGhA=:t/8JoG4smAmuGS6OnLL4Mx F8CGFspqPTbAJqv6e5fMNTF+RnL9STtoXs62dVVMF5jExQjIh4QBR1wIknFAOsRTg2/Yz198F KWXzk2WLQcEBKRVlgh+NsXFN42Uigkj5Kwap/d0m5uxtANWg81x7iC5FH6RTKfvtciq4q5yu4 iaYWWgNkYol5wHb8fbnpPT4DsxYOJVklFyTcwueYoLRdFmCy5AQRkZzPE9Ts9lFnxCO1tmfGc 3tN6UIuVk0tq1QvYVICqFV/vVyYdilY4fJhh1C69a+dy1igB3hjjbgDe8rmqGdhHmH8JCiIl+ 9QchljGLSYTzXMhx/et5kxim+JfKUvukDnsa0u6Ipchbu11ohsbcUcUwt5AJnc1uvLQdArAuQ Qle0vC2deOEGtj+ayM/BVfh46vOUddCF2wzuvhuKu0YxSk9zlPXlZirDG/b2yyWnGSaPQpI8X 6pmYWYP4o5uLOSu3m5CbJVp8/HYCx1Kj9D6ThGDJNuf4Trqyy4Sqh9XBJub+du9ULZwXgNfz2 YGP13X/rLgCyuiqvPP023HHZ/v0n1SadIgl0dOQwBwvt11yBPcMiBIhRSpUT6C50nJXouENch 2QKQesLxozRjjqucFokhZQR1lUdCkiwyynLlcCqGP7p1SWByYZ8JLt0/aAQ6H/Ehg/5QGFiqd EqSdj2zLMg6BzGeMKIuxb5ORk7wpS/81nJregxZwzeLqxPOBJbUV1yzwsh02ESDrK0+OAR5SU Ke9XpcUdnfxUu1pbdpQzUxbQk5DHtm8+/5yr5uhEGWqkw+qUsAB52XHaunTOjnBHXUYUjpLXs wP2hRdJol99Qh8Mj8L9i8FGfA63LD8f1MMw19ine11TDq7W5Y6ARznYsBUMeu7VkrLMGwMo9Y aSfJ4K0eaBjo4ybgXmzkUsHukVjOvwRGPT21ziSo23xBVzPTjXT9X/StjTxcZJ31fbrUcZ4jI Cz8t3fCmcaK3uMDJvLBAltRJpzEu5C1NHIHaPpFC8d1c8Z5GeFg+uwtw6y3KsgDyFexZmJWaE 2CQ3pkCMhgIZaABL3yHhxXQUYjDiujquu+5QBjjQ4JWyTeCSzzcPHqi+qqzn/mkGujBKv2ah4 rxyoj6GBu/APa40ekwGPajXSKvCKl1einoA X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > A lambda was just an example. But constants like in your previous patch > are fine. So you could just push it when you want. Pushed now. Feel free to change it if you have better ideas. Thanks, martin From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 11 13:13:52 2021 Received: (at 47300) by debbugs.gnu.org; 11 Jun 2021 17:13:52 +0000 Received: from localhost ([127.0.0.1]:39875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lrkj9-00088A-SL for submit@debbugs.gnu.org; Fri, 11 Jun 2021 13:13:52 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:53283) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lrkj6-00087p-Tv; Fri, 11 Jun 2021 13:13:51 -0400 Received: (Authenticated sender: juri@linkov.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 96D3860003; Fri, 11 Jun 2021 17:13:40 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#47300: delete-window to select window with same position Organization: LINKOV.NET References: <87a6qw43gg.fsf@mail.linkov.net> <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> <63612145-5eaa-0766-30cc-f30f7e7e1700@gmx.at> <87k0nefwq6.fsf@mail.linkov.net> <6f37ba16-527b-4537-116c-b215a9f39d1b@gmx.at> <87o8cmwrsf.fsf@mail.linkov.net> <30a62fd1-35f4-c8cf-4239-8ae9ae2d8af2@gmx.at> <87k0n97g1t.fsf@mail.linkov.net> <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> <87zgw2lnyb.fsf@mail.linkov.net> <52edd629-faee-9c91-525d-51a34d8a0a15@gmx.at> <87r1hdjspg.fsf@mail.linkov.net> <0b2c395f-c9ff-7337-270a-b86f5d8bc27d@gmx.at> Date: Fri, 11 Jun 2021 20:06:36 +0300 In-Reply-To: <0b2c395f-c9ff-7337-270a-b86f5d8bc27d@gmx.at> (martin rudalics's message of "Thu, 10 Jun 2021 09:44:07 +0200") Message-ID: <87h7i4daav.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47300 Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) tags 47300 fixed close 47300 28.0.50 thanks > Pushed now. Feel free to change it if you have better ideas. Thank you for implementing this useful feature. The name proposed by Eli is also good. So this request could be closed now. PS: I propose one additional tiny change - maybe would be better to add for @code{delete-window-choose-selected} a xref or pxref from the "Change Window" node of the User Manual to the Lisp Reference Manual (there are already many references to elisp in emacs/windows.texi.) From unknown Thu Aug 14 22:19:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 10 Jul 2021 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator