From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#47300: delete-window to select window with same position Date: Sun, 06 Jun 2021 23:47:56 +0300 Organization: LINKOV.NET Message-ID: <87zgw2lnyb.fsf@mail.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40163"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Lars Ingebrigtsen , 47300@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 06 23:16:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lq07w-000AAk-FK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 23:16:12 +0200 Original-Received: from localhost ([::1]:55406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lq07v-0008Tq-HH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 17:16:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lq07m-0008R8-BI for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 17:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lq07l-0008C7-V5 for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 17:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lq07l-00005x-RH for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 17:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 21:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47300 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47300-submit@debbugs.gnu.org id=B47300.162301411532729 (code B ref 47300); Sun, 06 Jun 2021 21:16:01 +0000 Original-Received: (at 47300) by debbugs.gnu.org; 6 Jun 2021 21:15:15 +0000 Original-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 Original-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 Original-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) In-Reply-To: <3c111515-d877-06fd-6291-09e624dba97c@gmx.at> (martin rudalics's message of "Sun, 6 Jun 2021 09:43:47 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208159 Archived-At: >>> 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))))))