From unknown Sun Aug 10 16:47:45 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#67248 <67248@debbugs.gnu.org> To: bug#67248 <67248@debbugs.gnu.org> Subject: Status: 30.0.50; string-pixel-width is affected by the global value of display-line-numbers Reply-To: bug#67248 <67248@debbugs.gnu.org> Date: Sun, 10 Aug 2025 23:47:45 +0000 retitle 67248 30.0.50; string-pixel-width is affected by the global value o= f display-line-numbers reassign 67248 emacs submitter 67248 Dmitry Gutov severity 67248 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 17 16:24:16 2023 Received: (at submit) by debbugs.gnu.org; 17 Nov 2023 21:24:16 +0000 Received: from localhost ([127.0.0.1]:47244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r46K0-0005al-G1 for submit@debbugs.gnu.org; Fri, 17 Nov 2023 16:24:16 -0500 Received: from lists.gnu.org ([2001:470:142::17]:34984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r46Jw-0005aG-HM for submit@debbugs.gnu.org; Fri, 17 Nov 2023 16:24:13 -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 1r46Jq-00068A-4M for bug-gnu-emacs@gnu.org; Fri, 17 Nov 2023 16:24:06 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r46Jn-0005OZ-SV for bug-gnu-emacs@gnu.org; Fri, 17 Nov 2023 16:24:05 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40906fc54fdso20999745e9.0 for ; Fri, 17 Nov 2023 13:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700256242; x=1700861042; darn=gnu.org; h=content-transfer-encoding:from:content-language:subject:to :user-agent:mime-version:date:message-id:sender:from:to:cc:subject :date:message-id:reply-to; bh=RUWJ4maoh+TgfEKaozLhS+71C3ego6rVwDTyqXEyKUI=; b=hAqsgPzVRZ5kG0rXoXyIGjKxgIYxNzE7rx17v1a+StY5qDiHtTClcMQFtSKdbp8gXK AK5OqAPvZrOAWGlM06ncgpagsvW0Wv4Xb11cByXFQoIgDhmeEIftGNZBXY5KRXX4O2gb 0D/G/jxJxAirolK2IrMUwttV450xr7BEzo/JCbHu61G3klA4y5HXitVmf7QdiQ3xpUsr gnJFxb/DJw0QbsBt64VwtUrsa7Z6FVPQaw5ZWrG2kNU7c3qHHH9dxPmcStoLn1nUlNJz XXgpvP6bW2NqFtX8my8ys2W+QeIOiVqR/Jx9vbwOzXfxqkZjgTQs2pvRriJZgmMwyssE 8IUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700256242; x=1700861042; h=content-transfer-encoding:from:content-language:subject:to :user-agent:mime-version:date:message-id:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RUWJ4maoh+TgfEKaozLhS+71C3ego6rVwDTyqXEyKUI=; b=YTc+4Z1d75nZgLh0qyF1rN51G9BPAFMB1Y9l+VeGuIBhVafDIBKQWo9SmxaRPZIs++ 7Urg+OreZEtFpYYdBZkO/fns9umVC4taVxUyWvi6BkN9TgZfrdQTDtECi0ipg3DroXsz nqUfj8zJU/8MlyYcnwidCj1mQ2uQdHRYk8Qdpp5J1ozRYLPjbBn8ftuZhp9ccbBIJMAM 4cnv9/6FbyDneJnrA3wLgCCbmVKnXDms/JQHqCJ6QHzr/lgs2UZ9j3D0oKeygIhDkTPi caHUni1iOxELzoEJtCwliCTvetvNTtWTVzuIYjPOxXHdfES88j362pS8A7sbJ5iO+fSt 2l7Q== X-Gm-Message-State: AOJu0YwlXqyDuoM8dYkvJs6NVdoToCpp0cYc3YzpSMttRb6qOqWxXkqh fS42vpN9RIgD2pAoLyUdqD9AxhMnnZA= X-Google-Smtp-Source: AGHT+IEUbJUhDU7UGdFung8dhsWH6ELaBNOsMwgaMsNLXuXtMEre8jZxmNKO+e8AYINNdgWDoScWqw== X-Received: by 2002:a05:6000:1a8a:b0:331:6a6d:9e24 with SMTP id f10-20020a0560001a8a00b003316a6d9e24mr305607wry.7.1700256241453; Fri, 17 Nov 2023 13:24:01 -0800 (PST) Received: from [192.168.13.82] ([185.170.235.162]) by smtp.googlemail.com with ESMTPSA id u11-20020adfa18b000000b0033142b1a1eesm3418783wru.87.2023.11.17.13.24.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Nov 2023 13:24:00 -0800 (PST) Message-ID: <8cc52908-98c6-b853-a679-b4ac29755555@yandex.ru> Date: Fri, 17 Nov 2023 23:23:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: bug-gnu-emacs@gnu.org Subject: 30.0.50; string-pixel-width is affected by the global value of display-line-numbers Content-Language: en-US From: Dmitry Gutov Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=raaahh@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.5 (+) 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: 1. (string-pixel-width "abc") ; => 51 2. (customize-set-variable 'display-line-numbers t) 3. (string-pixel-width "abc") ; => 119 This function's implementation makes provision for display-line-numbers-mode, but not for the original variable display-line-numbers, which will be t independent of the value of display-line-numbers-m [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (raaahh[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -0.0 T_SCC_BODY_TEXT_LINE No description available. 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.5 (/) 1. (string-pixel-width "abc") ; => 51 2. (customize-set-variable 'display-line-numbers t) 3. (string-pixel-width "abc") ; => 119 This function's implementation makes provision for display-line-numbers-mode, but not for the original variable display-line-numbers, which will be t independent of the value of display-line-numbers-mode. I think it's a bad idea to have these two different ways to do the same thing, and it can lead to bugs like this one. I would suggest obsoleting the public use of display-line-numbers -- making it private, probably. At least removing it from the customization group display-line-numbers. Barring that, the patch below seems to work. Although it proliferates the differences between Emacs versions which one would have to be on the lookout for. Originally reported at https://github.com/company-mode/company-mode/issues/1427. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 572822351b1..4fda98ae3d0 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -343,8 +343,7 @@ string-pixel-width (with-current-buffer (get-buffer-create " *string-pixel-width*") ;; If `display-line-numbers-mode' is enabled in internal ;; buffers, it breaks width calculation, so disable it (bug#59311) - (when (bound-and-true-p display-line-numbers-mode) - (display-line-numbers-mode -1)) + (setq-local display-line-numbers nil) (delete-region (point-min) (point-max)) ;; Disable line-prefix and wrap-prefix, for the same reason. (setq line-prefix nil In GNU Emacs 30.0.50 (build 271, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.16.0) of 2023-11-17 built on potemkin Repository revision: 94849ba35f40393362050b5937578dcf3076b4bf Repository branch: feature/cl-lib-improvements Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Ubuntu 22.10 From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 18 02:14:36 2023 Received: (at 67248) by debbugs.gnu.org; 18 Nov 2023 07:14:36 +0000 Received: from localhost ([127.0.0.1]:47708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4FXI-0004OQ-6I for submit@debbugs.gnu.org; Sat, 18 Nov 2023 02:14:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4FXG-0004OD-RT for 67248@debbugs.gnu.org; Sat, 18 Nov 2023 02:14:35 -0500 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 1r4FXA-0008N3-Im; Sat, 18 Nov 2023 02:14:28 -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=DkSNol4LqRxhccHx5ogg7cn56TeqmqGsQJ23PvEBFB8=; b=eDkC6z6/CqbG mjAZRkZo9bThRYksjtXtIrIee/sZPX0xrtQUs3HbGigiLJMtgVZhawHvoxYCYk1ytCj4VFzfrKB5t 8Tucivjm8bX/dmGLi+SqvpdFNakzOHlxQIRbw2AJhez2eRQ6Pv3pK/fkvUmlo8o9QMVmbb4INdyxh 92eisFVXs5QhDH2jRfGZK5/YxOcXwJZhyzdPt3R4IIhx9p8fv0u7CRlCdDVLHIaz2QcaUykObpp2H 8/xT6fAf8h+PqXnkL90RYfDXOD8ZzPn1L4FqvxqonqRn562Cbm2/VZQXeXTcj4J99wUpLVrI5F+pk Rj328r7WOy38/wc8jUrOQw==; Date: Sat, 18 Nov 2023 09:14:24 +0200 Message-Id: <83fs13o7n3.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: <8cc52908-98c6-b853-a679-b4ac29755555@yandex.ru> (message from Dmitry Gutov on Fri, 17 Nov 2023 23:23:58 +0200) Subject: Re: bug#67248: 30.0.50; string-pixel-width is affected by the global value of display-line-numbers References: <8cc52908-98c6-b853-a679-b4ac29755555@yandex.ru> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67248 Cc: 67248@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: -3.3 (---) > Date: Fri, 17 Nov 2023 23:23:58 +0200 > From: Dmitry Gutov > > 1. (string-pixel-width "abc") ; => 51 > 2. (customize-set-variable 'display-line-numbers t) > 3. (string-pixel-width "abc") ; => 119 > > This function's implementation makes provision for > display-line-numbers-mode, but not for the original variable > display-line-numbers, which will be t independent of the value of > display-line-numbers-mode. > > I think it's a bad idea to have these two different ways to do the same > thing, and it can lead to bugs like this one. I would suggest obsoleting > the public use of display-line-numbers -- making it private, probably. > At least removing it from the customization group display-line-numbers. I don't see a need for such drastic measures, certainly not due to this bug. Having the variable and the mode in this case is not different from other similar cases, for example, word-wrap vs visual-line-mode. You have just discovered that the test in string-pixel-width was not the correct one, that's all. > Barring that, the patch below seems to work. Although it proliferates > the differences between Emacs versions which one would have to be on the > lookout for. Thanks, I think this is indeed the right solution. Please install the patch on the emacs-29 branch. From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 18 11:36:24 2023 Received: (at 67248-done) by debbugs.gnu.org; 18 Nov 2023 16:36:25 +0000 Received: from localhost ([127.0.0.1]:49409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4OIy-0005A6-J0 for submit@debbugs.gnu.org; Sat, 18 Nov 2023 11:36:24 -0500 Received: from forward502b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:d502]:51798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4OIx-00059s-46 for 67248-done@debbugs.gnu.org; Sat, 18 Nov 2023 11:36:24 -0500 Received: from mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:96a1:0:640:9109:0]) by forward502b.mail.yandex.net (Yandex) with ESMTP id C92535E9CF; Sat, 18 Nov 2023 19:36:15 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id CaqQeqdOfGk0-mWXJ1Bgk; Sat, 18 Nov 2023 19:36:15 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1700325375; bh=a1yAJr7DE2AoLWAO8olwMIe+8TKUXS3DS18QiWcQsc4=; h=In-Reply-To:From:Subject:Message-ID:Cc:References:Date:To; b=TIfm0oAwRdgqYWgJcG9LlLeo7SrwkNmfor58A3OQrD8FqWzHBf02J5tOeIIC6K/GZ GiYrqSJxqr8/LzUZ8Qup8ydxmWpfs5P9mzSbIzTFEwjYh2q28gXdq6ZRHQ7Axx7x9N h4aU4pIh62a6h0mFvhb/j2xD0TpZXBlcexcxHx5s= Authentication-Results: mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id AC6CE27C0054; Sat, 18 Nov 2023 11:36:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 18 Nov 2023 11:36:12 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegvddgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegughhuthhovheshigrnhguvgigrdhruheqnecuggftrfgrth htvghrnheptdffgeegkeelteevtdekleethfeftdduvdegkedtkedujefhfedtveeftdff udevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hguhhtohhvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqddufeeffeelleeh hedvqddvleegjeejjeejiedqughguhhtohhvpeephigrnhguvgigrdhruhesfhgrshhtmh grihhlrdgtohhm X-ME-Proxy: Feedback-ID: ib1d9465d:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 Nov 2023 11:36:11 -0500 (EST) Message-ID: <0136405b-ebd4-dd01-5350-2569357040a2@yandex.ru> Date: Sat, 18 Nov 2023 18:36:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: bug#67248: 30.0.50; string-pixel-width is affected by the global value of display-line-numbers Content-Language: en-US To: Eli Zaretskii References: <8cc52908-98c6-b853-a679-b4ac29755555@yandex.ru> <83fs13o7n3.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <83fs13o7n3.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 67248-done Cc: 67248-done@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: -3.9 (---) Version: 29.2 On 18/11/2023 09:14, Eli Zaretskii wrote: > I don't see a need for such drastic measures, certainly not due to > this bug. Having the variable and the mode in this case is not > different from other similar cases, for example, word-wrap vs > visual-line-mode. At least word-wrap and visual-line-mode have different names. And the latter provides a bunch of other features than the former. display-line-numbers and display-line-numbers-mode sound totally identical, so I'm not at all surprised that the author of the referenced bug report customized both of them. That's a usability problem. > Thanks, I think this is indeed the right solution. Please install the patch on the emacs-29 branch. Okay, pushed as 0128495afde. Thanks. From unknown Sun Aug 10 16:47:45 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 17 Dec 2023 12:24:10 +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