From unknown Fri Jun 20 07:23:42 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#67993 <67993@debbugs.gnu.org> To: bug#67993 <67993@debbugs.gnu.org> Subject: Status: Selecting buffer automatically Reply-To: bug#67993 <67993@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:23:42 +0000 retitle 67993 Selecting buffer automatically reassign 67993 emacs submitter 67993 Juri Linkov severity 67993 wishlist tag 67993 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 23 12:55:05 2023 Received: (at submit) by debbugs.gnu.org; 23 Dec 2023 17:55:05 +0000 Received: from localhost ([127.0.0.1]:51179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rH6DJ-000241-Gi for submit@debbugs.gnu.org; Sat, 23 Dec 2023 12:55:05 -0500 Received: from lists.gnu.org ([2001:470:142::17]:60862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rH6DH-00023Q-7A for submit@debbugs.gnu.org; Sat, 23 Dec 2023 12:55:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rH6D6-0007Mn-J3 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 12:54:52 -0500 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rH6D5-0004or-0k for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 12:54:52 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3CF3C240002 for ; Sat, 23 Dec 2023 17:54:46 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Selecting buffer automatically Organization: LINKOV.NET X-Debbugs-Cc: martin rudalics Date: Sat, 23 Dec 2023 19:51:10 +0200 Message-ID: <86zfy0g641.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=2001:4b98:dc4:8::221; envelope-from=juri@linkov.net; helo=relay1-d.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_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.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: -0.4 (/) --=-=-= Content-Type: text/plain [From emacs-devel] >>> I believe this should be customizable with something like >>> >>> (setopt display-buffer-alist >>> '(("\\*Compile-Log\\*" nil (select-window . t)))) >> >> Thank you for the advice, but I tried this and it didn't work. >> *Compile-log* buffer isn't selected. > > This feature was discussed in bug#33258 and bug#46034, > but not yet implemented. It should be easy to implement > exactly the same way as 'windmove-display-in-direction' > selects the old or new window in 'post-command-hook'. > Ok, I will post a patch to bug-gnu-emacs. Here is the patch that allows using (select-window . t) in display-buffer-alist to select the displayed window, and (select-window . nil) to deselect windows selected by such functions as pop-to-buffer: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=select-window.patch diff --git a/lisp/window.el b/lisp/window.el index 40070a4d929..fad95601a55 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7851,6 +7856,16 @@ display-buffer (while (and functions (not window)) (setq window (funcall (car functions) buffer alist) functions (cdr functions))) + (when-let ((select-window (assq 'select-window alist))) + (letrec ((postfun + (lambda () + (if (cdr select-window) + (when (window-live-p window) + (select-window window)) + (when (window-live-p (old-selected-window)) + (select-window (old-selected-window)))) + (remove-hook 'post-command-hook postfun)))) + (add-hook 'post-command-hook postfun))) (and (windowp window) window)))) (defun display-buffer-other-frame (buffer) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 24 09:35:00 2023 Received: (at control) by debbugs.gnu.org; 24 Dec 2023 14:35:01 +0000 Received: from localhost ([127.0.0.1]:51826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHPZE-0007Vj-Iq for submit@debbugs.gnu.org; Sun, 24 Dec 2023 09:35:00 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:58446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHPZB-0007VR-3k for control@debbugs.gnu.org; Sun, 24 Dec 2023 09:34:59 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a2698cff486so392824466b.0 for ; Sun, 24 Dec 2023 06:34:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703428485; x=1704033285; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=XGkUOBDaAWn3QnInNxoiUrxWmHmdsA/4oFWzcsBni84=; b=TA8jDlajx6vVc8QUeg9BNfnZdxqMrCivroT6HDtYO/BSIwZibTo74JafUG60UozfYj JJU/CoFrpKFJBGpQAs1O54ylon2HS69e5E6gkl8ZYShr8RCoHP0WTLxJA8TAKqpAIN+w I5c8sn08EQoYFg8amRuuRUWl1w5IF+9CKxolqBbxXJu0k3ZNytcPZmV4Du/EGDFnBPX5 tlbjZR24CvY1aPARbEBieUpj7GYSpIGGTHNf5CCOluptnWHXTInO5G5vtIcicXVElM2a X/v48Ax1rXXfabmYK2Wj0PnLeaGCW1lRmEZpBOmTKuaLLz+qk9D1cwdPdRjq8kDN7Ixo U6Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703428485; x=1704033285; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XGkUOBDaAWn3QnInNxoiUrxWmHmdsA/4oFWzcsBni84=; b=w/RCrEtk9D3fG3iHA8CFzzJuUCdx9P1JYPI06ZZJ1jniU6MRJMm1Xdh9WtQKHonAhU IBBPmuJ1H4hADZJG7/TLVydHwgC/o151lT5bxtDgv+JbGXpiz6Fq602+w7gpo+va5qjD by6jgeR8XATLdqGDUmvlnPYAVTu7rHgqjr5iFNaldU0n4uj8/xmxQuWwtbyfBTS3h+ew eAgHy2JcUAAPM6LiK/0Mo+fer8jeTA0mQXi69gasJQUZmTqCC2W/w4yMJ+yAAhdQEm5n hcOwcS3KbTtVDUXdEWb2Esx3XZBpCCl5nCBlyd+D6c5Kqc5YMhDweieBe3hCrdLEhqTa +qKA== X-Gm-Message-State: AOJu0YykMRszQD7AjBDOVR7zSr6q4c7Js4ZDEr96lRiSImd/KEsedQJM 2Fon7MyeMQ4vBnZ3gJqmyALNJbQ72wmOEisrh1VY4JhmoYo= X-Google-Smtp-Source: AGHT+IGmen6pA26ZaWZ/MMtIDZ7BOdaLpyShXpbh+qQ0sacPVo3CtjmTSmKB8LZWt8fyn7SzgUqmjINkuxPuCX1Xb2M= X-Received: by 2002:a05:6402:397:b0:553:894e:99b with SMTP id o23-20020a056402039700b00553894e099bmr2058327edv.133.1703428485307; Sun, 24 Dec 2023 06:34:45 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 24 Dec 2023 06:34:45 -0800 From: Stefan Kangas MIME-Version: 1.0 Date: Sun, 24 Dec 2023 06:34:45 -0800 Message-ID: Subject: control message for bug #67993 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" 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 (-) severity 67993 wishlist tags 67993 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 04 12:13:15 2024 Received: (at 67993) by debbugs.gnu.org; 4 Jan 2024 17:13:15 +0000 Received: from localhost ([127.0.0.1]:55585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLRHP-0000Ee-Fs for submit@debbugs.gnu.org; Thu, 04 Jan 2024 12:13:15 -0500 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]:33297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLRHN-0000E1-BB for 67993@debbugs.gnu.org; Thu, 04 Jan 2024 12:13:14 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 0585A1BF203; Thu, 4 Jan 2024 17:13:01 +0000 (UTC) From: Juri Linkov To: 67993@debbugs.gnu.org Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <86zfy0g641.fsf@mail.linkov.net> (Juri Linkov's message of "Sat, 23 Dec 2023 19:51:10 +0200") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> Date: Thu, 04 Jan 2024 19:12:23 +0200 Message-ID: <865y09nmp0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: martin rudalics 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 (-) Martin, do you agree with this change? If ok, then I could update the documentation as well. >>>> I believe this should be customizable with something like >>>> >>>> (setopt display-buffer-alist >>>> '(("\\*Compile-Log\\*" nil (select-window . t)))) >>> >>> Thank you for the advice, but I tried this and it didn't work. >>> *Compile-log* buffer isn't selected. >> >> This feature was discussed in bug#33258 and bug#46034, >> but not yet implemented. It should be easy to implement >> exactly the same way as 'windmove-display-in-direction' >> selects the old or new window in 'post-command-hook'. >> Ok, I will post a patch to bug-gnu-emacs. > > Here is the patch that allows using (select-window . t) in display-buffer-alist > to select the displayed window, and (select-window . nil) to deselect windows > selected by such functions as pop-to-buffer: > > diff --git a/lisp/window.el b/lisp/window.el > index 40070a4d929..fad95601a55 100644 > --- a/lisp/window.el > +++ b/lisp/window.el > @@ -7851,6 +7856,16 @@ display-buffer > (while (and functions (not window)) > (setq window (funcall (car functions) buffer alist) > functions (cdr functions))) > + (when-let ((select-window (assq 'select-window alist))) > + (letrec ((postfun > + (lambda () > + (if (cdr select-window) > + (when (window-live-p window) > + (select-window window)) > + (when (window-live-p (old-selected-window)) > + (select-window (old-selected-window)))) > + (remove-hook 'post-command-hook postfun)))) > + (add-hook 'post-command-hook postfun))) > (and (windowp window) window)))) > > (defun display-buffer-other-frame (buffer) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 05 04:23:23 2024 Received: (at 67993) by debbugs.gnu.org; 5 Jan 2024 09:23:23 +0000 Received: from localhost ([127.0.0.1]:56368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLgQF-00013X-0n for submit@debbugs.gnu.org; Fri, 05 Jan 2024 04:23:23 -0500 Received: from mout.gmx.net ([212.227.15.19]:50355) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLgQC-00013D-U2 for 67993@debbugs.gnu.org; Fri, 05 Jan 2024 04:23:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1704446590; x=1705051390; i=rudalics@gmx.at; bh=qitM5nCFRonmCD1AUBbHDLh7nTO8mHQgpI8PN19m5rw=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=TyDJQBWbsZshESSIxEhx0sB6E6xhcLZ3bApLV9mYs3FVsrQwMfrARprYWKsBcBUj DisieeA9xo6K7BExyXrjW54dl95G2wEjegOFaNmtYPO/dQ3aY2vhNq9EV4jjtvC1I vnOf9DmiAy/m3ZcaNlz9pKlsZCW7up70iVU7Mgu8ozWUkY25omoA+TVwSzLEa/0ey PetfVMPURwLO9EcDXZZMgvkXg3GE/O/xk5f32wk0QBMmAwxS3PPNi8nbsuOXcFaoM llOl9iGTP88cw8yYn/JC3EAW/Puk5LdEVXPSgbG55/pjYGBzbJ/uFYrFn2ezCdPHu AxExSU/ebuJDeMnP7A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([212.95.5.173]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N5mGH-1r9h811IeB-017BUn; Fri, 05 Jan 2024 10:23:10 +0100 Message-ID: <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> Date: Fri, 5 Jan 2024 10:23:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically Content-Language: en-US To: Juri Linkov , 67993@debbugs.gnu.org References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> From: martin rudalics In-Reply-To: <865y09nmp0.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:qzW94w2WPfEulQlwmGbrFUrhy3HGea3YewGmGxgAddili5n44fL b127OjTXFoLql8CULn8k0w+V1azl6kxOmhCu+9+G1kQsD9MmFZ1vlcLxGRqLuFyMVmLWBah ZxFb3RBnDzErdx6D4RKhZ8BdluobsjVBNJEqxMIS5XQBoNvZ4KieIS3ucD8DORhyrWGg5m6 Etzh3/rjNWH+U+RejceYQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:nAo7OUDSIVQ=;kEVHUzMYSHsVYZVD6TN283kyqpS ptI5Dqjl41OUUoRYVBcPc9n4LXljDkZRMS0uuytX/dm6s6JIrnmDnXJyyTbVltNbDFR3K3mqc 1H6J60b+B2rvFsyGbh93ALZ8NBBuerhr3SJjhJuMBtymQniLlUTXrVo7dU+duQtdQPYw9HK3J HH+8mSXwKen/77QwGUWmfh4WBcK2J6sWH3ye2Yu1IAvLjYddsgpakl947QJoMgreLp1XMjTpk z/jQcY2dDrPwXX4mXE7qDw249dgM2F6LdUvIqKVDH9ss9QGwNpceq8ieLcLtsM3dTtPchHXta LmSmOxYTkSkRs+RU8tuCaqXELZnTcvwc7gyf7OMbOO1GvhFlrWFdz90mQzO2pVjqYHXfN5/AC g+aLN3hBtLJ4plAmsoJ3/cSpYH0oGOt/+W2EL27Zetdr0pNamRfLVpEBFcbxkVfS1rchSkdp1 hzk8HfkSdyxzs+C73AoUTrzb8EGl3AR1i/ODUxIgfkoQgkZ93HufHbg/TKH1r99IqzQbojAOZ lT4NQmJ+GaiGb+cHcJ97aN6OrD+5eri/bOS9jghT3gvAhKokjASw627cKWUlB+PxabrB+RCKH OlJAyuyr84sp/XKorR2CyHOELrj0HWFuv2PD0zMDN8CYnNzhdp0LkUKEcO9B66czLdUD7Reio XdzRv5ebGV6G3ULdKs9lZR1E9iFnqusQuyPJq7XlKy745nMmlQYnej4QCcJGWAGyVz2JktDBT t79snHp6zZSeLSTkflfygU7NpeJBNCS0gNQMxKE2veKuLTpQUddnxrurYrv7JssSn93FO29BY L77cwP6x/h6xg6zsIK7d4fLo4hWEq+NM1ypsyR1NEuuH4nkHKznsZO5xN8TVxbP/MymkO7OtT 5Nr9j5pRMwYTAE/Ce59CFcxyQLC81EZCLv1J6NKChUs/q2NwF/gqz376J8ZgBozYpQiEwPZwD jeIevg== X-Spam-Score: 2.9 (++) 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: > Martin, do you agree with this change? > If ok, then I could update the documentation as well. The following looks like a glitch: >> + (when (window-live-p (old-selected-window)) >> + (select-window (old-selected-window)))) Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [212.95.5.173 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 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.15.19 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.15.19 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 67993 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.9 (+) 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: > Martin, do you agree with this change? > If ok, then I could update the documentation as well. The following looks like a glitch: >> + (when (window-live-p (old-selected-window)) >> + (select-window (old-selected-window)))) Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [212.95.5.173 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.227.15.19 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.15.19 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager > Martin, do you agree with this change? > If ok, then I could update the documentation as well. The following looks like a glitch: >> + (when (window-live-p (old-selected-window)) >> + (select-window (old-selected-window)))) is supposed to select the window selected the last time we ran window change functions. Now consider the following scenario: - Redisplay runs the window change functions and sets the old selected window. - An application changes the selected window. - 'display-buffer' gets called with a (select-window . nil) entry. The call will select the window selected at last redisplay. So I think that calling 'old-selected-window' here is not TRT. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 06 12:42:58 2024 Received: (at 67993) by debbugs.gnu.org; 6 Jan 2024 17:42:58 +0000 Received: from localhost ([127.0.0.1]:60258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMAhG-0000LW-8h for submit@debbugs.gnu.org; Sat, 06 Jan 2024 12:42:58 -0500 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:57477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMAhE-0000L4-DG for 67993@debbugs.gnu.org; Sat, 06 Jan 2024 12:42:56 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 9A9C9240003; Sat, 6 Jan 2024 17:42:43 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> (martin rudalics's message of "Fri, 5 Jan 2024 10:23:10 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> Date: Sat, 06 Jan 2024 19:40:02 +0200 Message-ID: <861qauxswd.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) >> Martin, do you agree with this change? >> If ok, then I could update the documentation as well. > > The following looks like a glitch: > >>> + (when (window-live-p (old-selected-window)) >>> + (select-window (old-selected-window)))) > > is supposed to select the window selected the last time we ran window > change functions. Now consider the following scenario: > > - Redisplay runs the window change functions and sets the old selected > window. > > - An application changes the selected window. > > - 'display-buffer' gets called with a (select-window . nil) entry. The > call will select the window selected at last redisplay. > > So I think that calling 'old-selected-window' here is not TRT. Could you suggest an alternative to 'old-selected-window' to select the original window that was selected before the current command? From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 09:57:00 2024 Received: (at 67993) by debbugs.gnu.org; 7 Jan 2024 14:57:00 +0000 Received: from localhost ([127.0.0.1]:33537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMUaB-0002Gs-S6 for submit@debbugs.gnu.org; Sun, 07 Jan 2024 09:57:00 -0500 Received: from mout.gmx.net ([212.227.17.21]:47611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMUaA-0002Gg-H7 for 67993@debbugs.gnu.org; Sun, 07 Jan 2024 09:56:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1704639406; x=1705244206; i=rudalics@gmx.at; bh=COqRXbw0WqtQYAsPwPyYEfVrU/Bd+FrliGlog9isxZY=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=mmZpMBVDzyGJCHPDg0lX6J6CbuxiI8GvTA05pAA/D5p6cvsc4pEOJWp4KOjUY16H xjuNnwwnLT2tmEkaZuTdQhHeXt9ukvXQ8NH+PxafxA0NVJjGrjO1bdF7n5BVe2OMy zB4FjFqD49iLlM/XGBqCf2/2nFupZm4CAkVOAHouNwyQNID1M203FUIYXNlWDIlq/ 2i3QjN+/5Q9pz+SRytNsdPFAK+FVXdW87rYiBkaKeirj/A6Vp9D5Z/p5umQatqDju G3k1YHkls1KYnrwIxohvOQ+750F/Ml5zV787MRukqovDZbjW4Y/UH3m+DuwprYkw7 uv/n10Y6nKrvR3FcoA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([213.142.97.200]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MFsYx-1rPSRl2Lvj-00HNlU; Sun, 07 Jan 2024 15:56:46 +0100 Message-ID: Date: Sun, 7 Jan 2024 15:56:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically Content-Language: en-US To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> From: martin rudalics In-Reply-To: <861qauxswd.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:nNzQVMIlBUP8c/RnHVJ+VDwsm3RQ5LtqwpmzE78/zxUy8WNmzH5 7ueObwCz2zN+QW8mFsgDGn5AVyN9Luqc6NfY3vkyDKCxoNRlFLpFY+m8EBQt8oUEur4mT2v u8jKtd1nWtt5Yfwii3Etenh9WIBlADUwvGThIK6NE3tvQCnmmsaQlFieOTeQR8pog8x2wUZ vkoMAhp18ij8APBWc3ZvQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:njDMyH0BSXA=;e1nrftYTlfe/lfQC8OpxmB4MIXK rwH5+ulfzVo99eVi4+YNNv5VBS/ByMRwDvdGeopDtBZE94/E4g35069HpI4qmO9yP4DUL2zCL d4X3XiOvZHntJM1weolV1LGHTb7CXax56vWEhkxu6EKeko3dygAlmMely4YnMne0kFnFKoc/h CTKhBA5KiFEKYk4DDTgLt7taZs0PrMWDaE9TCmWB1A741mfW0Kowmah9US7aW4vC4uOwTQqRC 2xSa6LZNDGS6JTXl/QXl0Z2fE1JxlzAER1X53fP6Rm8fZP0GO3LzRIEqjtylANVA9DFvV9S5b 9hIzGc1MqDR3vdrOletGqQLFencUn9VpWBhePIfPyGiPKVbg3UkiCtxcGirfe+MLlc0+Xmm0Y mmG06Kae+/J72EE1TVzIjpnnu0AhkGrZWtsgzmoGRg+tOHVVXY2Jgj1Abdh4cLwX812Ilhsev Sk2Tkw6+bdLeGWPFF79TK1hezVmAmajpGMQNolU3xrK+YeDMnCSVuoVDnaMkoUumcFB8RS2Z2 by3FvCuBTvMSg3g2CD21R2ump+Ml0mQGosBzz9N8ufOM/m1bE8+ivive1ugDwI/q6y4mwZIqb 372w6OYbpSMKSkh3AjApUvT6QadrVDewofJD7mPC5j8RT9ksi7gJUcwprzRiDIsdwkWzyQArx oz4F5cypit9zkZkJB0b3fo60pomgVX2Xu0Y5qYjoXpyJ29H+NW5g5NXcL/I5b6RvymoOk8zIx dULjPJoNY30nXyX5493AgjwURRfODF3Ep0A8Bw02s2phDuiqpJdLecUwAb562bJ5gnccpjeRA Ki6ywQgXTfjyYpfWeMKPL2AW1sIY2kGVbbBVj5Q881wSPjD804wue1YsEosJu21ASJWIWOWaW 5CcBOD7UAcXFKgv2CZzuFcnn1/mImp1ACUtI0kVr8QgjC8EFKhfXBd3ItCI5+RGAmuBb7timu M3p1lA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) > Could you suggest an alternative to 'old-selected-window' > to select the original window that was selected before > the current command? In 'display-buffer' first save the selected window as old-selected-window, display the buffer and in your code select old-selected-window instead of (old-selected-window). Better, rename "select-window" to "window-to-select" so grepping won't confuse it with a 'select-window' call and allow for an arbitrary window (or even buffer, but there could be two windows showing the same buffer) to use as the finally selected window in 'display-buffer'. And maybe have 'pop-to-buffer' and friends pass (select-window . t) instead of calling 'select-window' themselves and think of what has to happen when the window made or used by 'display-buffer' is on another frame that should be (de-)selected. martin From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 11:53:05 2024 Received: (at 67993) by debbugs.gnu.org; 7 Jan 2024 16:53:05 +0000 Received: from localhost ([127.0.0.1]:33655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMWOW-0001Ca-Oj for submit@debbugs.gnu.org; Sun, 07 Jan 2024 11:53:05 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:44419) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMWOU-0001BY-K8 for 67993@debbugs.gnu.org; Sun, 07 Jan 2024 11:53:03 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 2E9951C0002; Sun, 7 Jan 2024 16:52:49 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: (martin rudalics's message of "Sun, 7 Jan 2024 15:56:45 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> Date: Sun, 07 Jan 2024 18:51:04 +0200 Message-ID: <86cyudjdmb.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) >> Could you suggest an alternative to 'old-selected-window' >> to select the original window that was selected before >> the current command? > > In 'display-buffer' first save the selected window as > old-selected-window, display the buffer and in your code select > old-selected-window instead of (old-selected-window). Unfortunately, this is not so easy to do. 'old-selected-window' should be reinitialized before the next command is executed. So by definition 'old-selected-window' should contain the window that was selected before the current command was executed. I have no idea how to do this without hooks. > Better, rename "select-window" to "window-to-select" so grepping won't > confuse it with a 'select-window' call and allow for an arbitrary window > (or even buffer, but there could be two windows showing the same buffer) > to use as the finally selected window in 'display-buffer'. And maybe > have 'pop-to-buffer' and friends pass (select-window . t) instead of > calling 'select-window' themselves 'pop-to-buffer' can't be changed because (select-window . t) should be handled only at the end of the current command. > and think of what has to happen when the window made or used by > 'display-buffer' is on another frame that should be (de-)selected. So this also need to run 'select-frame' in post-command-hook. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 08 03:56:14 2024 Received: (at 67993) by debbugs.gnu.org; 8 Jan 2024 08:56:14 +0000 Received: from localhost ([127.0.0.1]:35150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMlQb-0000OD-MB for submit@debbugs.gnu.org; Mon, 08 Jan 2024 03:56:14 -0500 Received: from mout.gmx.net ([212.227.17.21]:41433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMlQZ-0000Nv-CC for 67993@debbugs.gnu.org; Mon, 08 Jan 2024 03:56:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1704704159; x=1705308959; i=rudalics@gmx.at; bh=iaf8M3OzCjl1dR5oLrW2UYMoZ7qQSIWBxTb4zEJ2Sb0=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=fZaa4hL1BrZghQLdcQjJ5zvzucRIVmXop67hTOr8YQ7djSDsVIR34TTj1IUFUJWw jEW94ILkOwnVL0ladbT9QoWgyf02OlJl0oFNUHM3Z+WwlcUqKj+rBRv5icpN/blBS PCffx9MhmhZeY1eAVnv4uiXOnObHCFEym/Hs8ZcvQ25PCNPr8yciA9IckpDPRItaT NQ3mZo1hhLUMM8wLkBYGYuekXnM5KB5WZZQRi4vNDGfjiDN3y1n4HWfOoY5+8XYOC xHN2orP/nsVGV8T8Ee5dinHpqtM2d1ai0vWSCp1OI+qxnYQUChIGlImfavCZ+HcNR lLVwmwLt2gehRRsrJA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([212.95.5.143]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MyKDU-1qzZhK3Fym-00yjVq; Mon, 08 Jan 2024 09:55:58 +0100 Message-ID: <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> Date: Mon, 8 Jan 2024 09:55:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically Content-Language: en-US To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> From: martin rudalics In-Reply-To: <86cyudjdmb.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:x+Ll+yU2PxhggptqHGcQU0/ozpG5hqKHPHQz6h9HO944A+2KPZv rlYS4vdHL48itiEzqyl6kUZtPadfuYMEyXR4WJV0FdpH2q6LCVoLeArMq6c8QcCBMsq+ySm l6r7/MEvFoh0zvhYopGmLU5eJZceODJs/VUqqEKmhQvJdBVl87qDcMbTWdJi8oML8VNKHS7 kU9VE/rAeh7uszStAB3+w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:vX8oPBLdtz4=;By1T28YFWeKbnlxFeVhx6jWc6xc oXlFtbt6AoBwr8e++0GX3iciDjW2QnsR+1J9tyzA/8+Cf4PTR/iL5omBgCYAfSko2CkXTXPfr aINSpRWdKyKHMJpUPy6TRlmCid7j6obDKyYF93H2zQt+1pAyeejPLPv2avgnedL/jJaz9hgV4 w7n8Akb1eoPFKK8acW7hSqv8DSr+IaWV087h04cni+ivm3k43ShVoAsrXLlGYXvMWsxqV505r A96mscXz8WCvoBlROhJNf4tKTVydXS8nd494Gp9StHZOcx092EvgnqwmHzfbtC/5DI2dh2yim 2q/T4+R4x/N+JZbiiTxctSuGpG7Zma4HgHSqsV9kgg6+anC0jWf8UEtRgeQjlAU8xIuKx+HPS KvjO3O/x3QixpekmPFpQTbdGI78LtTa3haTA0kKrSc6xUpXTiv2upzU5R1zxkzbHTbsjJKtFC lHoFq6TUm/skM0sXNAdAGJSaaem1B2o/YYOmYMsljnmNDUutD7pH1U8GVU77b6AmDld6KeDGu hbYvGDOKsDOuKqjZWQbNBxvFXALvCX3gPGMcFjRbKOddfqCyJq2AujlvUOxixsCtSHRjj0ceZ RpQBoEjn+8XyhhttDKLbZz0Pps/2UGqUKNbgxtsYDmGzS2gDPhcPsQOmpDvKR/1ybOFSrujGP H4t0Z2/PvZDX3mmF06Gs8pYiQVe6UchgVCXftBt2lXn0bCYAoOHllbZRmHYEHgQkZfh84rhb9 BOneZbO5X/iUJmKsmbwHb1DxNcW6xA76i7RW971dR/nMdRIdUSbMnE0BL1l0Gp5u1dwNrWs6P 4YHgPXkYt5q87NRdGAi51QlQ/COE71Qzjx3rHTQUNNYGs8OlIHsarR6VCYD5fdtxLbkP/vrAg JCFxD8g7DAoN5Ls45hBrCOq39TED66PwXx3onsC25enMN1PR+Gqv1X6V3RUqcnE9w6rMI2mNw Jgy3BA== X-Spam-Score: 2.9 (++) 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: >> In 'display-buffer' first save the selected window as >> old-selected-window, display the buffer and in your code select >> old-selected-window instead of (old-selected-window). > > Unfortunately, [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [212.95.5.143 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.21 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.21 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 67993 Cc: 67993@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.9 (+) 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: >> In 'display-buffer' first save the selected window as >> old-selected-window, display the buffer and in your code select >> old-selected-window instead of (old-selected-window). > > Unfortunately, [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [212.95.5.143 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.21 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.21 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager >> In 'display-buffer' first save the selected window as >> old-selected-window, display the buffer and in your code select >> old-selected-window instead of (old-selected-window). > > Unfortunately, this is not so easy to do. 'old-selected-window' > should be reinitialized before the next command is executed. Why? As I imagine it, it would be let-bound in 'display-buffer'. > So by definition 'old-selected-window' should contain > the window that was selected before the current command > was executed. I have no idea how to do this without hooks. Hmmm... I have problems to see what the "current command" is. One and the same command may contain multiple invocations of 'display-buffer'. I thought you wanted a 'select-window' entry to be handled separately by each of them. Otherwise, IIUC the entry provided by the last invocation would prevail any entries provided by previous invocations. How would you explain that to a user? If you want 'old-selected-window' to denote "some" state before the "current command", the function 'old-selected-window' might be a better choice than a variable you bind in 'display-buffer' (but note that redisplay may occur in the middle of executing a command). But if you want to interpret "current command" more strictly, you need a separate variable, say 'pre-command-selected-window' that you always set in 'pre-command-hook' and consult (and maybe reset) in 'post-command-hook'. > 'pop-to-buffer' can't be changed because (select-window . t) > should be handled only at the end of the current command. Are your sure that you do not somewhat arbitrarily restrict the scope of this feature? What if (select-window . t) were to be handled in a call from within a timer? Would you ignore it? > So this also need to run 'select-frame' in post-command-hook. 'select-frame-set-input-focus' maybe. Or, what's worse, undo the consequences of a preceding 'select-frame-set-input-focus' call triggered by 'pop-to-buffer'. That's why any such 'select-window' call (or its avoidance) you propose would be better handled within 'display-buffer' and not later in a 'post-command-hook'. martin From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 09 12:30:56 2024 Received: (at 67993) by debbugs.gnu.org; 9 Jan 2024 17:30:56 +0000 Received: from localhost ([127.0.0.1]:40848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNFwF-0006Kh-Vv for submit@debbugs.gnu.org; Tue, 09 Jan 2024 12:30:56 -0500 Received: from relay7-d.mail.gandi.net ([2001:4b98:dc4:8::227]:39575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNFwD-00064b-Uv for 67993@debbugs.gnu.org; Tue, 09 Jan 2024 12:30:54 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id CCDBC20005; Tue, 9 Jan 2024 17:30:37 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> (martin rudalics's message of "Mon, 8 Jan 2024 09:55:58 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> Date: Tue, 09 Jan 2024 19:20:13 +0200 Message-ID: <86frz6o832.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 'display-buffer' first save the selected window as >>> old-selected-window, display the buffer and in your code select >>> old-selected-window instead of (old-selected-window). >> >> Unfortunately, this is not so easy to do. 'old-selected-window' >> should be reinitialized before the next command is executed. > > Why? As I imagine it, it would be let-bound in 'display-buffer'. Ah, indeed, this is even better. This shows differences from the previous patch: diff --git a/lisp/window.el b/lisp/window.el index 5c3e68f04eb..f34b6d625c6 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7859,13 +7859,14 @@ display-buffer (setq window (funcall (car functions) buffer alist) functions (cdr functions))) (when-let ((select-window (assq 'select-window alist))) - (letrec ((postfun + (letrec ((old-selected-window (selected-window)) + (postfun (lambda () (if (cdr select-window) (when (window-live-p window) (select-window window)) - (when (window-live-p (old-selected-window)) - (select-window (old-selected-window)))) + (when (window-live-p old-selected-window) + (select-window old-selected-window))) (remove-hook 'post-command-hook postfun)))) (add-hook 'post-command-hook postfun))) (and (windowp window) window)))) >> So by definition 'old-selected-window' should contain >> the window that was selected before the current command >> was executed. I have no idea how to do this without hooks. > > Hmmm... I have problems to see what the "current command" is. One and > the same command may contain multiple invocations of 'display-buffer'. > I thought you wanted a 'select-window' entry to be handled separately by > each of them. Otherwise, IIUC the entry provided by the last invocation > would prevail any entries provided by previous invocations. How would > you explain that to a user? > > If you want 'old-selected-window' to denote "some" state before the > "current command", the function 'old-selected-window' might be a better > choice than a variable you bind in 'display-buffer' (but note that > redisplay may occur in the middle of executing a command). I guess the variable above should be fine. > But if you want to interpret "current command" more strictly, you need a > separate variable, say 'pre-command-selected-window' that you always set > in 'pre-command-hook' and consult (and maybe reset) in > 'post-command-hook'. This would be more troublesome. >> 'pop-to-buffer' can't be changed because (select-window . t) >> should be handled only at the end of the current command. > > Are your sure that you do not somewhat arbitrarily restrict the scope of > this feature? What if (select-window . t) were to be handled in a call > from within a timer? Would you ignore it? It would be a good design to ignore (select-window . t) from a hook. When windows pop up at random time while user is typing, this is too dangerous to allow. I remember such annoying popups as e.g. with a button "[D]elete" with the shortcut "D" while you are typing a text that contains "D" ;-) >> So this also need to run 'select-frame' in post-command-hook. > > 'select-frame-set-input-focus' maybe. Or, what's worse, undo the > consequences of a preceding 'select-frame-set-input-focus' call > triggered by 'pop-to-buffer'. Ok, I will try to save and restore 'old-selected-frame' as well. > That's why any such 'select-window' call (or its avoidance) you > propose would be better handled within 'display-buffer' and not later > in a 'post-command-hook'. No way to call 'select-window' immediately, because this will break too many functions that expect a window to be selected from the previous call of pop-to-buffer until the command is finished. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 10 03:37:44 2024 Received: (at 67993) by debbugs.gnu.org; 10 Jan 2024 08:37:44 +0000 Received: from localhost ([127.0.0.1]:41792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNU5n-00033d-TD for submit@debbugs.gnu.org; Wed, 10 Jan 2024 03:37:44 -0500 Received: from mout.gmx.net ([212.227.17.21]:51401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNU5m-00033M-1M for 67993@debbugs.gnu.org; Wed, 10 Jan 2024 03:37:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1704875848; x=1705480648; i=rudalics@gmx.at; bh=DS5UK0LbJOIf90B/3rhEVQSRMlJriFmOxJu5ZC6vmo4=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=kGByYf+qZpYZof5mv/Xdu3a7/jxE3uX33F8vLEVr6tYxRyenU0DtOQ2bFLGxbAi2 moYo4rdlxI8lD7SSnimQFCc8lwxkfTYXGVbfLb18HwW25GVVAeTfN8JfFThyacyH3 mt6XRlDHM6K6neTKcqgd1tRXDY+DQwzw/23N2sWMaplZG/IJDy6l1Z6N5RcMc/QhR QIDtzjynBidMe6us6MHqtuimE/+DoVapztDwE5lZr0GRbuXeId8xC56RwV+40vuvy Fa92HoEGCNFiM+IV+TOrfur3UQOYSevv/TShKzmmXGabgDdctfaBPCo8AF3lZVhhy 3/EvNDj/IMhZrCsGKg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([213.142.97.212]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MfpSb-1qi5fS3h8L-00gKg7; Wed, 10 Jan 2024 09:37:27 +0100 Message-ID: <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> Date: Wed, 10 Jan 2024 09:37:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> Content-Language: en-US From: martin rudalics In-Reply-To: <86frz6o832.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:lQyWDIxyUbVNiyfYlIPCcpysV1BoietviE3y4i1/wpDDsQO/c3I JL6Tx2QovaIw/2AWR7QcoXGlLsBLPilG3q5yHoazhaR7aG4nwzM39yO9k1+ZRthza66Pw1B ximKe+LyBYomMVstL1f3NfVfNx7+Xl5BIXXX3SijkYHCgZJEovv4XXGbVzHscGRrAR3OHjH 72fqtw7WtvDWwXAp16XsA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:BbcKPllgbGs=;gDTuq7oOmr6AP9h5qRk4hTGHXcY qejwh75wLJWqm0oabFk3WehFFaZMSHu2iW0hOuJbxUTNBUOr6nqpRg7rDft/nHX7wKW9uu0zz 67BPd4KNnbqm0bF+vRYBaD+gtao9ya/fIr75ayPYcbHd7lWHONV1fW74DxtotfQOBnoHPF5qX 4yHHgzTOulOXkgrVdxcNIsTuhUrgV1NmtaElH9SgMNzmShQB2oeaNrVLPQmA/+LA2rIO5Bzrv 97lEStlFLC1lUhI2VAacjjbsG4zk1aNdpjuZfIdWuKgZ/hUO2bIMCcoXPF1cjRWiPWtDmwFt/ e46tIeBjTzLtXHIC71trc4uJtEnrqZhJPOd7oa7ZMqc74eqisDAQmfVt53SHxwNkudikRs67V zpLs5DGDLZomfzDdoJDcbT3w94+42GWYeHekTuWNdT4hLDbsnA+9W8BunJuBia53H9ug6/ISz 0XDXoVY8juW1jlDBowOy0Ve7EVB75SPofGKKoeVPSit82NNFW+KlZHFwF+xlxFEDTsntBTBBE Cz9h06HUPv16nXFVy5VLxkDI5fTSvCSudFvJ5PxjylNyhTwE4x/HQwxtNwfSs0Gn/2zPDaO/p B1gCeG4ukJ0yqykpbdLxZ8GfQtEsRZ5QkfW3xJucKls7nyF8mWO7DnS+g11tFAfExJtAQsLzu V5dBzBbUqygb1MpELQS4Igf65FI1VU+ooRM8SzY/IosJax6AHgyKQkDXqj+cArqgSuxsLrBlH YNyuk/tj+xfhbMk/SNK2oUZSAHoX1Qd+YxJIcCnJuPml4rs367RII5K/0u6YHajK2mFm5R2Ua pKGvrENtZgvQiCsSh44So6yhmmUZ52+N+jLg1goTrVgWlOzciYUHBFiDYsdlkkEsHtueuwEKC Ft3Gxc2E1/AqGcPA3JnHx+v+jjMEP6I1l8OlmIxt7ca/ixqXx9L3tcxKSdyOQWcw07pkeplUf Qoq1pN7O7i3xJm1O7LJr8NHJ/nY= X-Spam-Score: 2.9 (++) 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: >> That's why any such 'select-window' call (or its avoidance) you >> propose would be better handled within 'display-buffer' and not later >> in a 'post-command-hook'. > > No way to call 'select-win [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [213.142.97.212 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.21 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.21 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 67993 Cc: 67993@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.9 (+) 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: >> That's why any such 'select-window' call (or its avoidance) you >> propose would be better handled within 'display-buffer' and not later >> in a 'post-command-hook'. > > No way to call 'select-win [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [213.142.97.212 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.21 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.21 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager >> That's why any such 'select-window' call (or its avoidance) you >> propose would be better handled within 'display-buffer' and not later >> in a 'post-command-hook'. > > No way to call 'select-window' immediately, because this will > break too many functions that expect a window to be selected > from the previous call of pop-to-buffer until the command > is finished. Do you mean that if I have two 'pop-to-buffer' calls within one and the same command, the first one has a (select-window . nil) entry and the second one no such entry, then the entry from the first call will cause the window from the second call to get deselected? If so, then this deserves a special explanation in the manual. martin From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 10 12:21:51 2024 Received: (at 67993) by debbugs.gnu.org; 10 Jan 2024 17:21:51 +0000 Received: from localhost ([127.0.0.1]:42720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNcH0-0004sx-Mu for submit@debbugs.gnu.org; Wed, 10 Jan 2024 12:21:50 -0500 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]:40293) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNcGy-0004sG-A8 for 67993@debbugs.gnu.org; Wed, 10 Jan 2024 12:21:48 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 070691BF206; Wed, 10 Jan 2024 17:21:41 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> (martin rudalics's message of "Wed, 10 Jan 2024 09:37:26 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> Date: Wed, 10 Jan 2024 19:12:50 +0200 Message-ID: <867ckhqgqp.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) >>> That's why any such 'select-window' call (or its avoidance) you >>> propose would be better handled within 'display-buffer' and not later >>> in a 'post-command-hook'. >> >> No way to call 'select-window' immediately, because this will >> break too many functions that expect a window to be selected >> from the previous call of pop-to-buffer until the command >> is finished. > > Do you mean that if I have two 'pop-to-buffer' calls within one and the > same command, the first one has a (select-window . nil) entry and the > second one no such entry, then the entry from the first call will cause > the window from the second call to get deselected? If so, then this > deserves a special explanation in the manual. This is what I see with the current patch: 1. (let ((display-buffer-alist '(("1" nil (select-window . nil))))) (delete-other-windows) (split-window) (split-window) (balance-windows) (pop-to-buffer (get-buffer-create "1")) (pop-to-buffer (get-buffer-create "2"))) then the original window remains selected. 2. (let ((display-buffer-alist '(("2" nil (select-window . nil))))) (delete-other-windows) (split-window) (split-window) (balance-windows) (pop-to-buffer (get-buffer-create "1")) (pop-to-buffer (get-buffer-create "2"))) then the window with "1" is selected after the command finishes. From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 11 04:15:12 2024 Received: (at 67993) by debbugs.gnu.org; 11 Jan 2024 09:15:12 +0000 Received: from localhost ([127.0.0.1]:58738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNr9c-0003iW-CR for submit@debbugs.gnu.org; Thu, 11 Jan 2024 04:15:12 -0500 Received: from mout.gmx.net ([212.227.15.18]:53865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNr9a-0003JW-AE for 67993@debbugs.gnu.org; Thu, 11 Jan 2024 04:15:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1704964506; x=1705569306; i=rudalics@gmx.at; bh=zGE+rqaQUbyFGx+UM4xl7wiU1wvrkbY3KtxHraIFK10=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=mbW0094eXIT5X65nvlW1bJMJnVTpG6uvFgYMzETwZFckWkkraKdMgQtEuz2Yty0L +qoZxImDaQ4SECZJ/+xXl/5QZaTQNowTRbf9cCaKm8LxfmSEKquh3otNnbIwZaSof NgjIn8A7UortkIPNy93WvqqtBmKiQiPVfoHToN/JW4/zh7jStcv8eQlp9IZJ3plJL 55EGuXRy6YsGADx3ujsWh/M6uJQ8X0/Drup0RfaTKLEEcD/RKLb/CNOAMTdH/Uzp7 P5JQ21hBjq/IpBWxXIKPi97kU1/e8J86t0C4gBq/Hj9Dm5MMBlu7Jq/iHsGgu30Lz ELSXut5Lm0S46LCSjw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([212.95.5.214]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M72sP-1rFKQn3FGR-008drx; Thu, 11 Jan 2024 10:15:06 +0100 Message-ID: Date: Thu, 11 Jan 2024 10:15:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically Content-Language: en-US To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> From: martin rudalics In-Reply-To: <867ckhqgqp.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:R0MyTS3ia9hTJpVaumQjU2HUNZcel1TRdEKBpvx5JuT75wCIqtg vlv2BMTzVY5FitjQsasdpkVIvKxgqem9AteEnFo62VNMqqDgMdpJsJY/DzSq6KVwKV1J+B1 jPeKbZvAbeYXfLRvbwaIgZnna4C8vivqLODmfx8R7oJSFvOVHoi7CQutpm1WID5o/1jo7zp QB130PZjJKbbkEd2qwQjQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:+SjjmkoMSkI=;xmt0slNT7tI+UNDGKIRtT2FyGVn Dkch3U31ELrJg/dVbv4TPuQBby5GHKxsRa1irqr2W8tNRExohB28M3jTHjA2QnWT4rWo32STO HXdAdXvA3rtw+ItD30voAiHnnWDCcslKn1V7dSsCZjYBnj8SfcJHywG1OgXMW7yu/9F7JDXcr t8Q+PftC3LP0t8nBijooc+wFExM2u9co/QrWjcCCYPfrxP4QmD0jLhEbc+28ypEc1hH6dA4Po 2qtJ0UUD8Kh+mlu0eKXzg85JXWaif+TxgBVgi+1C0VObfvAYctrMzZV15MPMfgVgqVxgIqxGs k8rtK83c0KGUl6N/QurVE8D2KQxprelxkQCHjBmEY7avG2L2nVWn6so44O/4B9QU39vGBlDbY YCcpFyM+CcoIa1FhkC3GXqBI6ivM2oDs1xexV8ZHJdGZv7J6rgFJsGF4yDG7DgwOPNOac1mfw vvSnrKO7zMnIP+GFSZjoqkG6bCbb/a+gUQV/WwmSnnry/tAvOdDsTYKFfo4vLarf0TAVz3+JB hESWi6lcNuWKV3+WlTl4G9Epvip2SGvriO8XzZV/Ei+tIdIIE7pynar42ha7/eAA5LOB2H15I tZ9D8fQ0jeybSRhgB5rxCC2YcCZS7B488azjvq9GOJGwQpMtMfiPZsWTctITJcA+aVmGh1Shg xSY4cR3r1kjbhmxSEBVFXcm4ngMOdcEH1AwdfJEcqZrqh7FxuoKb5VBXAXjXoZKkIAmiQTQcf 4qkYcSwnSguFFqjYry0kb1y3/jQeZZgAQ1EfXC8xS+MXfR0pJzp9TFC1WVsDCgexU0HKqW5Ku YKmir9FPpqwnpKSfMjQ52gBK2nxvUq7QoAY3YaXDlZgxFzonG+gXyacjJBeORuj+s6sLBCoNG oz7AG7xPfq0brONIi65P3+MCt0TGsTGZ7c5kSS1zk9tT00BHeRc63pzhOEWxrlVf6feQVCtUJ EgPa0UyrrE68rq9c/VaSYhsH3UI= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 what I see with the current patch: > > 1. > (let ((display-buffer-alist '(("1" nil (select-window . nil))))) > (delete-other-windows) (split-window) (split-window) (balance-windows) > (pop-to-buffer (get-buffer-create "1")) > (pop-to-buffer (get-buffer-create "2"))) > > then the original window remains selected. But this means that the customization for "1" affects popping to "2". If this is the intended effect, it should be documented. martin From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 12 02:47:02 2024 Received: (at 67993) by debbugs.gnu.org; 12 Jan 2024 07:47:03 +0000 Received: from localhost ([127.0.0.1]:34809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOCFq-0007Ic-Ca for submit@debbugs.gnu.org; Fri, 12 Jan 2024 02:47:02 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:58009) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOCFl-0007Hu-NX for 67993@debbugs.gnu.org; Fri, 12 Jan 2024 02:46:58 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id C91EF1C0002; Fri, 12 Jan 2024 07:46:52 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: (martin rudalics's message of "Thu, 11 Jan 2024 10:15:06 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> Date: Fri, 12 Jan 2024 09:46:16 +0200 Message-ID: <86y1cvkpm3.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 what I see with the current patch: >> >> 1. >> (let ((display-buffer-alist '(("1" nil (select-window . nil))))) >> (delete-other-windows) (split-window) (split-window) (balance-windows) >> (pop-to-buffer (get-buffer-create "1")) >> (pop-to-buffer (get-buffer-create "2"))) >> >> then the original window remains selected. > > But this means that the customization for "1" affects popping to "2". > If this is the intended effect, it should be documented. But actually the customization for "1" doesn't affect popping to "2" because pop-to-buffer still selects windows and creates such layout: *scratch* Buffer "1" Buffer "2" Only post-command-hook selects the original window afterwards instead of leaving the buffer "2" selected. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 13 05:39:18 2024 Received: (at 67993) by debbugs.gnu.org; 13 Jan 2024 10:39:18 +0000 Received: from localhost ([127.0.0.1]:38503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rObQ5-0003iD-Ru for submit@debbugs.gnu.org; Sat, 13 Jan 2024 05:39:18 -0500 Received: from mout.gmx.net ([212.227.17.20]:49621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rObQ3-0003hz-OV for 67993@debbugs.gnu.org; Sat, 13 Jan 2024 05:39:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1705142351; x=1705747151; i=rudalics@gmx.at; bh=7Y/GW/VPWz77Azn2C+HLzTHQmoIAD7jZBduCbuB8TdQ=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=RIVcX0G5Xp6h9bkAOgBYmSZu1vgNGgfqmGPx7/zW/P7ZlliynVt1LOcixY8MiYBm T4ZF9w+qZXGgWKQ/GcBg4RMDiQtlA2/nKy55I4VwdVfYYrhTrS3BmTwiIjwQpZ/Xp 0WvQDy6zNpmR3FPgvzekZupVfD+4CeVqsz0oDGitA/86N6o8mGXP8BdZPsmYTY4ZH Ozh0+GE1ovW3XRG3urKgbwK2t78zLzit+TujC18mNCBnSdte+HS+5DRkbgt3WsgwW M8MAc3UWNk9vAg1hTDigmCgMrp1E8MvrBvOCoQN18Z+r6oOLrKXEVznjx4VbUIyr/ iA7kZef0J+8IbGm8IA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([212.95.5.124]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MC34X-1rJLAB3YBJ-00CRYh; Sat, 13 Jan 2024 11:39:10 +0100 Message-ID: <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> Date: Sat, 13 Jan 2024 11:39:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> <86y1cvkpm3.fsf@mail.linkov.net> Content-Language: en-US From: martin rudalics In-Reply-To: <86y1cvkpm3.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:/1BhuNB0dFsE/Alav1jNQyVJF/Ppp8z0vQ25mmO706A7eijtrO/ j3kf2+Lr80fRiUCNcfmYJL6aMurvhXxHDozfkzDE6fgU+h6TmYrc0bzx4Jnb3OPBvYtv0SN mb73fqEMHJ95yhT9qsDFkJTl7dDhB1UMuIhiDf9nzGVP9QhGwjvAQoRRc+2EeNxsGKGXnLN KVj1ry1CoZFntD6BLnehQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:e8K1bGk3New=;S0RdDSqh0hawHcvuz1RvAr7ZEpP 5oc8at8pxLzuc6p0b8wHjQLn+xgT6nB8ClbdCT0JjksMoB42dx6El+dnCHKyTDLt3xHB4ibVd OfCQWrunCgMsL/XfAo7fMOhp3rjosrkXIvczw84QC0HZ8VblNTYiQ+kjmjgCc1Rvbet+vEPPK d/qWcsdOYVNx/P+vwqIoovwvBn8rZAKY3Gp1IXh13d9wBX/JspTqGJWTxWE+bJxIby2EhHCTa PK5sWu07aIGsrKPArWK2Fk34BuwhRlscyh3sD1xhODR/dxbTAMU/qgIaQjn+oHK/VOAQm6WyN /bs3P9nDPjtt+CBSJX00OZdiIBRm5bHjjZ8U6CyqKnWf2f8DnaLyu332Gah/AnGDar0TRAqpN Q9IjFIKJ3xo5mgTHvBqDNtwhziTgcowEVuh3idUfDV66YlJrH9jJJQw+2KndFL3OI5KfyLHWx TZ8/QyENs8c/+Ff8rwyWSnIyVJqfTyoMUsGVMmxYzqY3w4eBGTeqR74GuzoFW0jEQ+j9FmjtW By3YrgLcRI8JCRfAWs6RWTmR8nYNrkaxM476zBziAJvfOcvs2Wdg4rd0SXh2Vx64FZrdw4FqA x7pl7Iov9LPDZQdzwtKk19/YOvWEl0FliONyutKST4fq4djCuezJpL6VceEonnZMasgG1AizZ V/m1+DLzEq09xp58Xyvc70KoLRELIw3PLN6+pzqjbGBqDvvs07hPvMAwTdf99lJJVMpUtocXd f4o/gQ7Sfl14wKAe3+qxo6Y/ABWo4U9VMVaE5AmsvZx6gDzl9QdY/Jq66PKaUsJZCCcp7eDYx 94M5pX5KEKiRexyOy/zzG208uzLtRfagY6u0IXfUDV6arwrYq5wedNFDVNR8zIT+AA2OdlWKi 9H/jWAW392icPjpf5hGLa0pz9172T8COrDZjjxXHJ8k6AU4KIonxAjkWU2cxFinblncHGJ51x Bdvj0g== X-Spam-Score: 2.9 (++) 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: > But actually the customization for "1" doesn't affect popping to "2" > because pop-to-buffer still selects windows and creates such layout: > > *scratch* > Buffer "1" > Buffer "2" > > Only post-com [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [212.95.5.124 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.20 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.20 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 67993 Cc: 67993@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.9 (+) 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: > But actually the customization for "1" doesn't affect popping to "2" > because pop-to-buffer still selects windows and creates such layout: > > *scratch* > Buffer "1" > Buffer "2" > > Only post-com [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [212.95.5.124 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.20 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.20 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager > But actually the customization for "1" doesn't affect popping to "2" > because pop-to-buffer still selects windows and creates such layout: > > *scratch* > Buffer "1" > Buffer "2" > > Only post-command-hook selects the original window afterwards > instead of leaving the buffer "2" selected. And if the customization for "2" meant to select the window, the final outcome will depend on whichever (de-)selection comes last in the 'post-command-hook'. You should at least document that in the manual. It looks pretty fragile to me. martin From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 14 13:55:35 2024 Received: (at 67993) by debbugs.gnu.org; 14 Jan 2024 18:55:35 +0000 Received: from localhost ([127.0.0.1]:44089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rP5du-0007xG-I4 for submit@debbugs.gnu.org; Sun, 14 Jan 2024 13:55:34 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rP5ds-0007wz-Vk for 67993@debbugs.gnu.org; Sun, 14 Jan 2024 13:55:33 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id A2CB560002; Sun, 14 Jan 2024 18:55:26 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> (martin rudalics's message of "Sat, 13 Jan 2024 11:39:10 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> <86y1cvkpm3.fsf@mail.linkov.net> <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> Date: Sun, 14 Jan 2024 20:48:07 +0200 Message-ID: <8634uzg6zc.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 >> But actually the customization for "1" doesn't affect popping to "2" >> because pop-to-buffer still selects windows and creates such layout: >> >> *scratch* >> Buffer "1" >> Buffer "2" >> >> Only post-command-hook selects the original window afterwards >> instead of leaving the buffer "2" selected. > > And if the customization for "2" meant to select the window, the final > outcome will depend on whichever (de-)selection comes last in the > 'post-command-hook'. You should at least document that in the manual. > It looks pretty fragile to me. A practical use of this feature is for commands that display a single buffer that is an overwhelming majority of the commands. However, the name 'select-window' would be too confusing for users because based on such name they will expect that it will select the window immediately after it's displayed. Therefore I propose to rename it to the less ambiguous name 'post-command-select-window'. Of course it should be documented in any case, but this will help the users who never read the documentation. Ok, here is a complete patch with the documentation: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=post-command-select-window.patch diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 93b25cbe67f..ecb1df82eba 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -3344,6 +3344,15 @@ Buffer Display Action Alists the entries @code{window-height}, @code{window-width} and @code{preserve-size} are applied that could resize the window to fit it to the inserted contents. + +@vindex post-command-select-window@r{, a buffer display action alist entry} +@item post-command-select-window +If the value is non-@code{nil}, the buffer displayed by @code{display-buffer} +is selected after the current command is executed that runs the hook +@code{post-command-hook} (@pxref{Command Overview}). +If the value is @code{nil}, the buffer selected by such functions as +@code{pop-to-buffer} is deselected, and the window that was previously +selected before calling @code{display-buffer} remains selected. @end table By convention, the entries @code{window-height}, @code{window-width} diff --git a/lisp/window.el b/lisp/window.el index 23977691f50..b37502203b1 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7798,6 +7803,13 @@ display-buffer and `preserve-size' are applied. The function is supposed to fill the window body with some contents that might depend on dimensions of the displayed window. + `post-command-select-window' -- A non-nil value means that after the + current command is executed and the hook `post-command-hook' is called, + the window displayed by this function will be selected. A nil value + means that if functions like `pop-to-buffer' selected another window, + at the end of this command that window will be deselected, and the + window that was selected before calling this function will remain + selected. The entries `window-height', `window-width', `window-size' and `preserve-size' are applied only when the window used for @@ -7853,6 +7865,17 @@ display-buffer (while (and functions (not window)) (setq window (funcall (car functions) buffer alist) functions (cdr functions))) + (when-let ((select (assq 'post-command-select-window alist))) + (letrec ((old-selected-window (selected-window)) + (postfun + (lambda () + (if (cdr select) + (when (window-live-p window) + (select-window window)) + (when (window-live-p old-selected-window) + (select-window old-selected-window))) + (remove-hook 'post-command-hook postfun)))) + (add-hook 'post-command-hook postfun))) (and (windowp window) window)))) (defun display-buffer-other-frame (buffer) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 15 05:23:25 2024 Received: (at 67993) by debbugs.gnu.org; 15 Jan 2024 10:23:25 +0000 Received: from localhost ([127.0.0.1]:44771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPK7p-0004jc-5R for submit@debbugs.gnu.org; Mon, 15 Jan 2024 05:23:25 -0500 Received: from mout.gmx.net ([212.227.17.22]:41213) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPK7m-0004jP-JC for 67993@debbugs.gnu.org; Mon, 15 Jan 2024 05:23:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1705314196; x=1705918996; i=rudalics@gmx.at; bh=lijmbwYIA9CjbKDgqFZuVttXZtXAWKaYT2FVjz8xjkE=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=oKpJg0BXJjeF+Qz+LZlAg6xv1c1OLRHt6CM9BzscRIJylFWq9nBVWz45wr4wMz+1 fsnbPSesPTPow2gbjeJ/YNUIB2PK8krmQ4jUfacV1xWnyE4884GefPUTorvfhFNDo Vzhu0NFSN7MKGDdTBI6PxG7J+4Y8EnCzEc0mF6gi6Qs4SFqCsuNoas8ojnT50e+mI nEFInOlSbrHFeSnFoE+bw8WnIybeG7bikJlvbcvytzJd6h86br/ApwFF+qAlEx1Ki HYukY3ja97e3nx4Wl2jpTpQ5W4KGa0DUlts+cbIq8lB+goiiws9nUysz5Sf4kihif NULD/fMeDHJVXZX/vA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([212.95.5.8]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MMobU-1rft4K0PWW-00IjYe; Mon, 15 Jan 2024 11:23:16 +0100 Message-ID: <49754b09-624a-42d7-a4c6-060d562b5700@gmx.at> Date: Mon, 15 Jan 2024 11:23:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> <86y1cvkpm3.fsf@mail.linkov.net> <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> <8634uzg6zc.fsf@mail.linkov.net> Content-Language: en-US From: martin rudalics In-Reply-To: <8634uzg6zc.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:CZJl5fUAzz/rsh+ZoDGGIUfuECn+WN2G/6NOO5ac4gIRcqtfUrT sc51g5abO5WHa0oimHZ219mv1tFp0U40bhMSASi7jqw/j2ShYHdzOPdUqeNV8cIX9VckxxG iyf0x1UCHBPUuWyWtZgMeNThN0Fc9eNTaNonMbC2BTp720nc6A8mowz7MZEt/P9E7pmX8D0 6L1511MTHpv5P74TeLLdQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:dywi7RLyP60=;g/19S5x9m3x29sA6BE8hnbJtO59 kfgee57Deobeiy4WNeKVJGgmRsZMIBh8jDRteGDiquxmrB4rXuUmTlGE/p8nWoYrhrmnAHVBK u/h/DHkvQ3rgaOpBfNVKN2OZKmZZ8i+d1EQgX/nam0XtTLx40VZYL7LLNK32LfXdcueCzokYB v/6x+BuJb/ragYE9md98ipH9yKu/UiMlzXtWwtWM15D/J2cMC2K4tA5ngkcXOP17U4B7zffIP 2yh+p6xkBBPsHrQ1M/qKItlNdxUejCl/+VQM/B3eyCkExsyLy5KLmqguNw72zR9O5yYaJyLmB E4Ojuaj+9qMsqZECEBVNnQoE2ilwRSbJRbjPOffTE2hc230WBYHeUCwdYY3T8teequMi5gG5d Nl49FBCWr2RXC6gocIjTYnS+F00MbUcKG4x2+Ut8fMBJNo5wVjYHIdBUE9BYGkniogm93gXWB 1Q9TCuJ+UgzjZ4/794iH3xGggqjrvvyq06DHKmV+Fq76NpfoQK8FVozr35Tu9EX8O3QNTltys exDJXXUbXSdNe3nRaBvNAGyi+ChKUp2D3TqRGphdy9rWN4EDw1hTg7Z3lW8oHGatzz2t+r179 r3v3lGc554+ZwqYV708vQ5WtVJTcsf789oclo/fdClnCycL2naVWzQZ4WUxjzrS9fSnJVe5FL hPs38joPNOIZoH8UTD1ksyCjBeqpW959y54sfwdWKNSJWK8j2rb1vnuEY9Vcm9OeMf3jbHH0l 9kqA28y9keHVBqlSn/z9ee4bXWoIguVpYLOgchrjQIZg4IqlZkqRPvKS7VlTFre7kmyGbPLAG OeGrU0QtoudS0USgqcyu09zS9fp8HAE5z8NjBngNaUfnuj/j+xoJ6sn0z9Zr9knHKrbTRRnPM zSOqeLNJ+V4g8tixb54FtaqcrTpiy/UUza85CXoF6W+IJttu42QpNERIqVXWBXYuWXqI+HEzj NV0a2vMxDAFpeFDouDJVKwzDU9A= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) > However, the name 'select-window' would be too confusing for users > because based on such name they will expect that it will select > the window immediately after it's displayed. > > Therefore I propose to rename it to the less ambiguous name > 'post-command-select-window'. Of course it should be documented in > any case, but this will help the users who never read the documentation. That's better. > Ok, here is a complete patch with the documentation: + `post-command-select-window' -- A non-nil value means that after the + current command is executed and the hook `post-command-hook' is called, + the window displayed by this function will be selected. A nil value + means that if functions like `pop-to-buffer' selected another window, + at the end of this command that window will be deselected, and the + window that was selected before calling this function will remain + selected. I'd say "will be usually selected" and "will be usually deselected". For example, (post-command-select-window . nil) will effectively select the window that was selected before 'display-buffer' was called, regardless of which other window were selected after the 'display-buffer'. Think of (progn (select-window x) (pop-to-buffer ... '(post-command-select-window . nil)) (select-window y)) which will select x overriding the call to select y. Or think of two 'display-buffer' calls within one and the same command. martin From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 15 12:57:28 2024 Received: (at 67993) by debbugs.gnu.org; 15 Jan 2024 17:57:28 +0000 Received: from localhost ([127.0.0.1]:46803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPRDD-00051W-N2 for submit@debbugs.gnu.org; Mon, 15 Jan 2024 12:57:27 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:60015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPRD9-000512-RV for 67993@debbugs.gnu.org; Mon, 15 Jan 2024 12:57:24 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 453531C0006; Mon, 15 Jan 2024 17:57:14 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <49754b09-624a-42d7-a4c6-060d562b5700@gmx.at> (martin rudalics's message of "Mon, 15 Jan 2024 11:23:14 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> <86y1cvkpm3.fsf@mail.linkov.net> <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> <8634uzg6zc.fsf@mail.linkov.net> <49754b09-624a-42d7-a4c6-060d562b5700@gmx.at> Date: Mon, 15 Jan 2024 19:56:18 +0200 Message-ID: <8634uyy8n0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) > + `post-command-select-window' -- A non-nil value means that after the > + current command is executed and the hook `post-command-hook' is called, > + the window displayed by this function will be selected. A nil value > + means that if functions like `pop-to-buffer' selected another window, > + at the end of this command that window will be deselected, and the > + window that was selected before calling this function will remain > + selected. > > I'd say "will be usually selected" and "will be usually deselected". > For example, (post-command-select-window . nil) will effectively select > the window that was selected before 'display-buffer' was called, The docstring above says the same: "the window that was selected before calling this function will remain selected" > regardless of which other window were selected after the > 'display-buffer'. These clarifications could be added to the docstring as well: "the window that was selected before calling this function will remain selected regardless of which other windows were selected later with other calls of 'display-buffer'." From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 16 05:18:54 2024 Received: (at 67993) by debbugs.gnu.org; 16 Jan 2024 10:18:54 +0000 Received: from localhost ([127.0.0.1]:47814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPgX0-0006XV-GS for submit@debbugs.gnu.org; Tue, 16 Jan 2024 05:18:54 -0500 Received: from mout.gmx.net ([212.227.17.20]:51929) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPgWy-0006X5-Ez for 67993@debbugs.gnu.org; Tue, 16 Jan 2024 05:18:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1705400325; x=1706005125; i=rudalics@gmx.at; bh=GJ/PJfmuQYTmXX/zueit2BWHg91pliPrPlHqV8w2J6E=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=fOQkSAyTOSySZvDbGpvuolKG3TLWo2424JOT0uIDrGmMzurpjbEX9nblY/ht35VH EUN8u8X6426pNtPNtop50VpejduBVsasizPkpNrQrt1LNIz9lvXJXXv2YK0iGzii7 JKMseD7EU/QrwY0UjcNbrkGv+M0FcdJelHqKNkyIcQAWgNym0hDvkrdQ+jowUG3/2 rkjB6TUnN133RSDIps3NGW+9Bfr9Bx4gHqha7SLRmvXzeC9SF7HVIjj5P+5Azt0BR Ao25QJ1QvIO8QEWaCTQimN2JWSEI5KxphqBA5xWsvDIYbEUBUABB0jLAqEnEEzgno yoA7erjHkyVyXUDnDQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.31.113] ([213.142.97.29]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mj8mb-1quBjU1AUn-00fAyP; Tue, 16 Jan 2024 11:18:45 +0100 Message-ID: <17252ca5-bc4b-414f-a99e-70bfe251271e@gmx.at> Date: Tue, 16 Jan 2024 11:18:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67993: Selecting buffer automatically Content-Language: en-US To: Juri Linkov References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> <86y1cvkpm3.fsf@mail.linkov.net> <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> <8634uzg6zc.fsf@mail.linkov.net> <49754b09-624a-42d7-a4c6-060d562b5700@gmx.at> <8634uyy8n0.fsf@mail.linkov.net> From: martin rudalics In-Reply-To: <8634uyy8n0.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:7uook0sRgDW/J2GJMYfoy1WpFD32p+xmjHv3UutSl22tsPcQ1bq pm0mo9ZxUlQ6mHFReHG8AhIuRgWAAX57Mmmp2sTPfkvrCr1tAZ+qgEYiKL7VhX19arw2neh TviQs/N6uFv2Jkj5w5ecTguvLVMclaAaDSmPvdNbsSiGArt0QGyU4WNpvU83PqkgZ48jExV O1VAnBie4Td69V7TfdO8A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:B2l6G2Yz6Yo=;OgYuaur4BuEjBUsEZPuE24BX1VK jTAQ8KuBzVzSkxuVlpC4LY8zBzr1zwzaPOlWMrwapdti44SHMKNRmlCQyVDVb2QwIeygAMWBc O+NBbamLdTk7GvMlsM/iOUeJFHpnBHxMDQ4Xn4F2FjU6M7wJHdRol6mqHvBrFhWe2bYLi51wb 586qWQCTu1R+7vkurewrhg40p1KFj5U0glvpi0HzMYJoxwoEA3xT0kP383RAks2QlZouiPnt2 iE44NZB3nz0klbkOlxw/GH5bjvcWxMqGZpzrFKBTokmc3K/D4P0jw1XdZqLSQNExspzK/HL6i 5Af/Es1ZLv/Gxjfli70TDkOTyXfVJEIX6Y7YoZi4Oh7ACg/APHTkAvlZtvE3hs8QgrTVe2URb yRtTLx8s4CwOQZoob9+Lq2JES2b+8ikaFfT76roS/ezxAeHao32Uh7gJ3KoH77Vf5wL2xxH00 q+EOe3rrsatZ+h3qkYEZ9OYoloCwfXwtg5x/ZNOPd2Dw5G2ovZ5DlOg4cUhtG3s3DEjKRWQ6b ZYiGEjZtg6W1UQLmkSb/2KBw+oNDsOtM7O6TcXc3nlsFlrbYpHIunbme2fCa1KcQXFJJ/k0av Ie3jySjCZ3cMZ7FTmtL0xoWjxK7yJVZhV+MttRVWFkPQW8Pu9j3H8IjNRKatPlNSThaSXN4sF 5XtPXHeNxxYQflyxk3HR0QY79k8wAT22YPhkdvvJ8I2A4Te1A33KoekIgEGIAq5EhmuVmJ/Rt rD8YcNlW3R1eTlmyiB9yTkQx+UkSj6zD4bllWf0IsO65EES/FMe0kosO4mIAVX7ll47MyhwPA Gt330w/s4fQlSoAkRRBRIVU4CMVR8aFPGw9zS4YtSLGPsyYvV/Ov/0/7fGAczsklo2V8D/ig6 rKEBZKqG7UWK0JWeJS8r9DI1yHreniyDemddHjLAQ3lnuaDxNlmctsTv09QEOqDo3NG3jTDWJ f9fKZUsBXugXBHfHQrKGvJEU7yg= X-Spam-Score: 2.9 (++) 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: > These clarifications could be added to the docstring as well: > > "the window that was selected before calling this function > will remain selected regardless of which other windows > were selected [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.20 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.20 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [213.142.97.29 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 67993 Cc: 67993@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.9 (+) 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: > These clarifications could be added to the docstring as well: > > "the window that was selected before calling this function > will remain selected regardless of which other windows > were selected [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [213.142.97.29 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [212.227.17.20 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.20 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rudalics[at]gmx.at) 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager > These clarifications could be added to the docstring as well: > > "the window that was selected before calling this function > will remain selected regardless of which other windows > were selected later with other calls of 'display-buffer'." Maybe "the window that was selected before calling this function will remain selected regardless of which windows were selected afterwards within this command." would be more precise. martin From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 16 11:56:18 2024 Received: (at 67993) by debbugs.gnu.org; 16 Jan 2024 16:56:18 +0000 Received: from localhost ([127.0.0.1]:49590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPmjZ-0003pP-Su for submit@debbugs.gnu.org; Tue, 16 Jan 2024 11:56:18 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]:41057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPmjX-0003p9-Sv; Tue, 16 Jan 2024 11:56:16 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id EA403E000C; Tue, 16 Jan 2024 16:56:07 +0000 (UTC) From: Juri Linkov To: martin rudalics Subject: Re: bug#67993: Selecting buffer automatically In-Reply-To: <17252ca5-bc4b-414f-a99e-70bfe251271e@gmx.at> (martin rudalics's message of "Tue, 16 Jan 2024 11:18:44 +0100") Organization: LINKOV.NET References: <86zfy0g641.fsf@mail.linkov.net> <865y09nmp0.fsf@mail.linkov.net> <4659812e-c023-492a-b810-d9d3cada1ade@gmx.at> <861qauxswd.fsf@mail.linkov.net> <86cyudjdmb.fsf@mail.linkov.net> <1ea06837-0d7e-46ba-849c-a4bf42929c40@gmx.at> <86frz6o832.fsf@mail.linkov.net> <942ced7b-53f8-4b33-9280-6cdba4b6ed6b@gmx.at> <867ckhqgqp.fsf@mail.linkov.net> <86y1cvkpm3.fsf@mail.linkov.net> <2edb97dc-bbf6-4020-b4ae-8188082c80c6@gmx.at> <8634uzg6zc.fsf@mail.linkov.net> <49754b09-624a-42d7-a4c6-060d562b5700@gmx.at> <8634uyy8n0.fsf@mail.linkov.net> <17252ca5-bc4b-414f-a99e-70bfe251271e@gmx.at> Date: Tue, 16 Jan 2024 18:54:54 +0200 Message-ID: <86v87tnrq9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67993 Cc: 67993@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 (-) close 67993 30.0.50 thanks >> These clarifications could be added to the docstring as well: >> >> "the window that was selected before calling this function >> will remain selected regardless of which other windows >> were selected later with other calls of 'display-buffer'." > > Maybe > > "the window that was selected before calling this function will > remain selected regardless of which windows were selected > afterwards within this command." > > would be more precise. Thanks for reviewing, so now installed with this docstring. From unknown Fri Jun 20 07:23:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 14 Feb 2024 12:24:16 +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