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#68235: 29.1.90; Switching tabs stops following process output in selected window Date: Sun, 07 Jan 2024 18:45:33 +0200 Organization: LINKOV.NET Message-ID: <86h6jpksya.fsf@mail.linkov.net> References: <83frzdy6if.fsf@gnu.org> <86edexnmv8.fsf@mail.linkov.net> <83mstlvvkj.fsf@gnu.org> <34a872a9-07b2-4671-837f-f8d98b37420d@gmx.at> <867ckmxto2.fsf@mail.linkov.net> <92085305-caad-4bb6-ac55-a81415404a26@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6280"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: daniel.c.mccarthy@gmail.com, Eli Zaretskii , 68235@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 07 17:53:08 2024 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 1rMWOa-0001Tj-6W for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Jan 2024 17:53:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMWOP-0005LI-P8; Sun, 07 Jan 2024 11:52:57 -0500 Original-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 1rMWOO-0005L2-OS for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 11:52:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMWOO-00030M-G1 for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 11:52:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rMWOU-0001C4-4R for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 11:53: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: Sun, 07 Jan 2024 16:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68235 X-GNU-PR-Package: emacs Original-Received: via spool by 68235-submit@debbugs.gnu.org id=B68235.17046463774565 (code B ref 68235); Sun, 07 Jan 2024 16:53:02 +0000 Original-Received: (at 68235) by debbugs.gnu.org; 7 Jan 2024 16:52:57 +0000 Original-Received: from localhost ([127.0.0.1]:33647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMWOO-0001BZ-VP for submit@debbugs.gnu.org; Sun, 07 Jan 2024 11:52:57 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:43317) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMWON-0001BK-Mp for 68235@debbugs.gnu.org; Sun, 07 Jan 2024 11:52:56 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 231F040002; Sun, 7 Jan 2024 16:52:42 +0000 (UTC) In-Reply-To: <92085305-caad-4bb6-ac55-a81415404a26@gmx.at> (martin rudalics's message of "Sun, 7 Jan 2024 15:54:44 +0100") X-GND-Sasl: juri@linkov.net 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:277509 Archived-At: >> window-point-insertion-type is nil by default, but I'd definitely want >> point to follow the output, that means not using the snippet above. > > But 'window-point-insertion-type' is buffer-locally t in all sorts of > compilation buffers and that is the subject of this bug report. Right? Thanks, now I see that 'comint-mode', 'compilation-mode' and some other modes set buffer-local 'window-point-insertion-type' to t. > And I meant to use the buffer-local value of > 'window-point-insertion-type' as insertion type for 'wc-point'. Ah, now I see that 'copy-marker' supports the argument for 'window-point-insertion-type'. >> But could you explain why such special-casing is not needed for >> non-selected windows? How set-window-configuration does the right >> thing for points in non-selected windows to follow the output? >> Maybe it's possible to do the same with point in the selected window? > > For an unselected window, 'set-window-configuration' uses that window's > point marker from the saved configuration and that one should follow > inserted text according to the value of 'window-point-insertion-type' in > that window's buffer. For the selected window, that window's buffer's > point is "usually" unchanged from where it was just before restoring the > configuration. Indeed, the difference between selected/non-selected windows is here: /* Save w's value of point in the window configuration. If w is the selected window, then get the value of point from the buffer; pointm is garbage in the selected window. */ if (EQ (window, selected_window)) p->pointm = build_marker (XBUFFER (w->contents), BUF_PT (XBUFFER (w->contents)), BUF_PT_BYTE (XBUFFER (w->contents))); else p->pointm = Fcopy_marker (w->pointm, Qnil); p->old_pointm = Fcopy_marker (w->old_pointm, Qnil); XMARKER (p->pointm)->insertion_type = window_point_insertion_type; XMARKER (p->old_pointm)->insertion_type = window_point_insertion_type; So the complete fix is just in 1 line: diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 7d491dc2f38..80cf94016b8 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1302,7 +1302,7 @@ tab-bar--tab (ws . ,(window-state-get (frame-root-window (or frame (selected-frame))) 'writable)) (wc . ,(current-window-configuration)) - (wc-point . ,(point-marker)) + (wc-point . ,(copy-marker (window-point) window-point-insertion-type)) (wc-bl . ,bl) (wc-bbl . ,bbl) ,@(when tab-bar-history-mode