From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59311: 29.0.50; tab-bar global-mode-string affected by global-display-line-numbers Date: Sun, 20 Nov 2022 10:36:35 +0200 Message-ID: <83tu2u58fg.fsf@gnu.org> References: <86v8ncdbk1.fsf@mail.linkov.net> <83v8ncbqly.fsf@gnu.org> <86o7t292y3.fsf@mail.linkov.net> <83mt8m7mmq.fsf@gnu.org> <86r0xyvxmr.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14360"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59311@debbugs.gnu.org, gabriel376@hotmail.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 20 09:37:26 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 1owfpN-0003VE-V3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Nov 2022 09:37:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owfp5-0008W1-3j; Sun, 20 Nov 2022 03:37:07 -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 1owfp1-0008VJ-1L for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 03:37:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owfp0-0008HL-Ci for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 03:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1owfp0-0003Cw-2D for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 03:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Nov 2022 08:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59311 X-GNU-PR-Package: emacs Original-Received: via spool by 59311-submit@debbugs.gnu.org id=B59311.166893339612295 (code B ref 59311); Sun, 20 Nov 2022 08:37:02 +0000 Original-Received: (at 59311) by debbugs.gnu.org; 20 Nov 2022 08:36:36 +0000 Original-Received: from localhost ([127.0.0.1]:42322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owfoZ-0003CF-Pi for submit@debbugs.gnu.org; Sun, 20 Nov 2022 03:36:36 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owfoX-0003C1-2t for 59311@debbugs.gnu.org; Sun, 20 Nov 2022 03:36:34 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owfoQ-0008Db-Sx; Sun, 20 Nov 2022 03:36:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=60zUXxK6MNyZ1yiYNHtV99UPXAqHt4XzigdkjaQMTUY=; b=Lw4hL5QnKACN pr0ON8dyMAynxoH2S4LO8L0hl1ubNF/FJQ8H+G/MH1pWTJ/QHA+cXXmdouQ5ixuQ6MxthIBBDUT8C OcqylUeATtXy7PmEQpuJ7x2Dir57aKEqAfis7SRnZK+t4hGdhfvJArBo4hegnBfnZbS1o7Tpy3GQV EF5CJgkUfJ709kqDE8Flh6TA7IpDpKvRO/RMxZclJpc3ta582/MA4wVuqZh3F9+fMsw0Pvch/TEb8 05vmUkuBCFFHmeFH8ew7yiKpswbDF11PKy1L0yVIYy74TTaW4X6c90Fk5a+lMkncDUexgFwKlLYld /hetyJqWTUkxDX+jT41VAw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owfoQ-000363-AJ; Sun, 20 Nov 2022 03:36:26 -0500 In-Reply-To: <86r0xyvxmr.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 20 Nov 2022 10:20:40 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248405 Archived-At: > From: Juri Linkov > Cc: gabriel376@hotmail.com, 59311@debbugs.gnu.org > Date: Sun, 20 Nov 2022 10:20:40 +0200 > > > No, because line-numbers take space, and some use cases of > > buffer-text-pixel-size want to know that. Only the caller knows whether the > > line-numbers should or shouldn't be included. The principle is that we > > measure the space taken in the text-area, no matter how it is used. (There > > are other display features that affect the result, for example, > > line-prefix.) > > I still don't understand why string-pixel-width should handle line-numbers > that also degrades its performance. Because string-pixel-width uses a temporary buffer as its internal implementation detail. (And why do you think this degrades performance? any measurements?) > I think it should be sufficient only > to disable line-numbers in internal buffers. I think it's too late for that, since display-line-numbers-mode is with us for the last 2 major releases. > But ok, here are both: > > diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el > index 6e4d88b4df..fba817b010 100644 > --- a/lisp/emacs-lisp/subr-x.el > +++ b/lisp/emacs-lisp/subr-x.el > @@ -324,7 +324,8 @@ string-pixel-width > (with-current-buffer (get-buffer-create " *string-pixel-width*") > (delete-region (point-min) (point-max)) > (insert string) > - (car (buffer-text-pixel-size nil nil t))))) > + (- (car (buffer-text-pixel-size nil nil t)) > + (line-number-display-width t))))) This is fine by me. (Or you could turn off display-line-numbers-mode instead, right after with-current-buffer.) > ;;;###autoload > (defun string-glyph-split (string) > diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el > index 897a88398f..cf5d353fba 100644 > --- a/lisp/display-line-numbers.el > +++ b/lisp/display-line-numbers.el > @@ -101,7 +101,8 @@ display-line-numbers-mode > > (defun display-line-numbers--turn-on () > "Turn on `display-line-numbers-mode'." > - (unless (minibufferp) > + (unless (or (minibufferp) > + (string-match-p "\\` " (buffer-name))) > (display-line-numbers-mode))) I don't agree with this part. Thanks.