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#53662: 29.0.50; Cannot use tab-new from side window Date: Wed, 02 Feb 2022 21:37:09 +0200 Organization: LINKOV.NET Message-ID: <86tudhxe5u.fsf@mail.linkov.net> References: <86h79jlqke.fsf@mail.linkov.net> <3706eced-5023-767a-7dff-85423039e06d@gmx.at> <86leyuo3rn.fsf@mail.linkov.net> <414b9299-8c93-e1d6-5b2e-226023692a0a@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13926"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 53662@debbugs.gnu.org, Aaron Jensen To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 02 21:50:03 2022 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 1nFMZm-0003T0-Ig for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Feb 2022 21:50:02 +0100 Original-Received: from localhost ([::1]:43002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFMZl-0002ZA-DS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Feb 2022 15:50:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFLha-0004Z0-IY for bug-gnu-emacs@gnu.org; Wed, 02 Feb 2022 14:54:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nFLha-0002Vq-8X for bug-gnu-emacs@gnu.org; Wed, 02 Feb 2022 14:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nFLha-00004r-8D for bug-gnu-emacs@gnu.org; Wed, 02 Feb 2022 14:54:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Feb 2022 19:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53662 X-GNU-PR-Package: emacs Original-Received: via spool by 53662-submit@debbugs.gnu.org id=B53662.164383162432733 (code B ref 53662); Wed, 02 Feb 2022 19:54:02 +0000 Original-Received: (at 53662) by debbugs.gnu.org; 2 Feb 2022 19:53:44 +0000 Original-Received: from localhost ([127.0.0.1]:53736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFLhF-0008Vn-EK for submit@debbugs.gnu.org; Wed, 02 Feb 2022 14:53:44 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:43167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFLhD-0008VZ-QK for 53662@debbugs.gnu.org; Wed, 02 Feb 2022 14:53:40 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 2D81160004; Wed, 2 Feb 2022 19:53:31 +0000 (UTC) In-Reply-To: <414b9299-8c93-e1d6-5b2e-226023692a0a@gmx.at> (martin rudalics's message of "Wed, 2 Feb 2022 08:47:18 +0100") 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:225831 Archived-At: --=-=-= Content-Type: text/plain > Two caveats: > > + (dolist (parameter (window-parameters)) > + (set-window-parameter nil (car parameter) nil)) > > Maybe you should remove the 'window-side' and the 'window-atom' > parameters only - users can assign arbitrary parameters to windows. If other window parameters are harmless, then only these two could be removed. > + (unless (eq tab-bar-new-tab-choice 'window) > + ;; Create a new window to get rid of old window parameters > + ;; (e.g. prev/next buffers) of old window. > + (split-window) (delete-window))) > > Note that this will lose other settings as well like the window's > dedicated status. If this is the intended behavior, you should at least > tell so in the doc-string. If you mean the case when tab-bar-new-tab-choice is 'window', then it will lose only 'window-atom' and 'window-side', because the value 'window' is intended to keep a single window on the tab. In other cases at this point, all windows were already saved to window-configuration, so this window is disposable and can be modified before immediately deleting it. After saving windows to window-configuration, the task here is just to create a new window. So now a new patch with the updated doc-string: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tab-new-window-side.patch diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 06ad8f60af..e611711092 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -474,6 +474,9 @@ tab-bar-new-tab-choice If t, start a new tab with the current buffer, i.e. the buffer that was current before calling the command that adds a new tab (this is the same what `make-frame' does by default). +If the value is the symbol `window', then keep the selected +window as a single window on the new tab, and keep all its +window parameters except 'window-atom' and 'window-side'. If the value is a string, use it as a buffer name to switch to if such buffer exists, or switch to a buffer visiting the file or directory that the string specifies. If the value is a function, @@ -481,6 +484,7 @@ tab-bar-new-tab-choice If nil, duplicate the contents of the tab that was active before calling the command that adds a new tab." :type '(choice (const :tag "Current buffer" t) + (const :tag "Current window" window) (string :tag "Buffer" "*scratch*") (directory :tag "Directory" :value "~/") (file :tag "File" :value "~/.emacs") @@ -1361,12 +1365,17 @@ tab-bar-new-tab-to ;; Handle the case when it's called in the active minibuffer. (when (minibuffer-selected-window) (select-window (minibuffer-selected-window))) + ;; Remove window parameters that can cause problems + ;; with `delete-other-windows' and `split-window'. + (set-window-parameter nil 'window-atom nil) + (set-window-parameter nil 'window-side nil) (let ((ignore-window-parameters t)) - (delete-other-windows)) - (unless (eq tab-bar-new-tab-choice 'window) - ;; Create a new window to get rid of old window parameters - ;; (e.g. prev/next buffers) of old window. - (split-window) (delete-window)) + (delete-other-windows) + (unless (eq tab-bar-new-tab-choice 'window) + ;; Create a new window to get rid of old window parameters + ;; (e.g. prev/next buffers) of old window. + (split-window) (delete-window))) + (let ((buffer (if (functionp tab-bar-new-tab-choice) (funcall tab-bar-new-tab-choice) --=-=-=--