GNU bug report logs - #41537
26.3; window-body-width wrong return value when display-line-numbers-mode is on

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "Matsievskiy S.V." <seregaxvm.main@HIDDEN>; Keywords: notabug; dated Tue, 26 May 2020 13:02:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) notabug. Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41537 <at> debbugs.gnu.org:


Received: (at 41537) by debbugs.gnu.org; 26 May 2020 15:25:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 26 11:25:55 2020
Received: from localhost ([127.0.0.1]:46177 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jdbSl-0003HW-ET
	for submit <at> debbugs.gnu.org; Tue, 26 May 2020 11:25:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40300)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>)
 id 1jdbSj-0003HD-OS; Tue, 26 May 2020 11:25:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:46074)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jdbSe-0005Uu-Gz; Tue, 26 May 2020 11:25:48 -0400
Received: from [176.228.60.248] (port=2641 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jdbSd-0002qB-Ew; Tue, 26 May 2020 11:25:48 -0400
Date: Tue, 26 May 2020 18:25:33 +0300
Message-Id: <835zcivhua.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Matsievskiy S.V." <seregaxvm.main@HIDDEN>
In-Reply-To: <454679eb364e5ebfa92d4648d09093542c21fc01.camel@HIDDEN>
 (seregaxvm.main@HIDDEN)
Subject: Re: bug#41537: 26.3;
 window-body-width wrong return value when display-line-numbers-mode
 is on
References: <454679eb364e5ebfa92d4648d09093542c21fc01.camel@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41537
Cc: 41537 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

tags 41537 notabug
thanks

> From: "Matsievskiy S.V." <seregaxvm.main@HIDDEN>
> Date: Tue, 26 May 2020 13:50:38 +0300
> 
> `window-body-width` and `window-width` return wrong numbers when
> `display-line-numbers-mode` is on.
> 
> For example:
> ```emacs-lisp
> (message (format "Width without line numbers: %d" (window-body-width)))
> (display-line-numbers-mode 1)
> (message (format "Width with line numbers: %d" (window-body-width)))
> ```
> 
> return these lines:
> ```
> Width without line numbers: 209
> Width with line numbers: 209
> ```
> 
> This is obviously wrong since line numbers take some window space.

This is not wrong, since these functions measure the body without the
line numbers.  This is not a bug, but the intended behavior.

> This breaks some packages that rely on `window-body-width` and
> `window-width` to align strings. 

Those packages should adapt to display-line-numbers-mode by taking
into account the value returned by line-number-display-width.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41537; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 May 2020 13:01:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 26 09:01:08 2020
Received: from localhost ([127.0.0.1]:44396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jdZCd-0007r1-RZ
	for submit <at> debbugs.gnu.org; Tue, 26 May 2020 09:01:08 -0400
Received: from lists.gnu.org ([209.51.188.17]:41166)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <seregaxvm.main@HIDDEN>) id 1jdXAT-0002XL-7p
 for submit <at> debbugs.gnu.org; Tue, 26 May 2020 06:50:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39038)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <seregaxvm.main@HIDDEN>)
 id 1jdXAS-0003sl-T3
 for bug-gnu-emacs@HIDDEN; Tue, 26 May 2020 06:50:44 -0400
Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:37977)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <seregaxvm.main@HIDDEN>)
 id 1jdXAR-0002ZI-6K
 for bug-gnu-emacs@HIDDEN; Tue, 26 May 2020 06:50:44 -0400
Received: by mail-lj1-x243.google.com with SMTP id m18so23886197ljo.5
 for <bug-gnu-emacs@HIDDEN>; Tue, 26 May 2020 03:50:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=message-id:subject:from:to:date:user-agent:mime-version
 :content-transfer-encoding;
 bh=VH5fZ5NeX2H238z1Ayc+exUhdCs/5NHS0dUcCAm7GuU=;
 b=PZw1eFtfejib/XqCE22V38DvQioy2sEgak4S4k0L7/N/szrERrxrvtABsv8J9EqkfU
 xZEGbUA6zgJJ0n4gzP24474fygGolQGUw7px5vx2en+GbrGk5vbi2c3geRtM/ARv/jnL
 mA1gEZOhgfgxbFk2oeRo2+760VRIfmrkyF6/YlUrlyAIcKmql6YTHyeS+TRYGgHpDH/N
 8Jwws5+ylQgP2gyXpGbOAcOopariDJ9yQgi2ikxOm0UPNLnRg+IancM7nhrTWA4olzg3
 BReLLzBwifxIYIP+Oh2QgPZ+jDJcmSz7DRs0E4JUi+hO4Zp4PHzfNCxdSavVtBTX0w4I
 +8dg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:message-id:subject:from:to:date:user-agent
 :mime-version:content-transfer-encoding;
 bh=VH5fZ5NeX2H238z1Ayc+exUhdCs/5NHS0dUcCAm7GuU=;
 b=kw3lT3Ub7qhkZYOTOkIm5rLzGS4tEjCylNeM3LkHvHYEOV+tQlqvPOV6Gu1ixFb32N
 pM1tstyGJjotiWkj2n78m3B65a5DFKR4l6zoiO0ITnw0aoDaUtf/xcUwkWt52I8xt+PQ
 4XvIf3TcCTISrTQHUEh6hM1pEO7Fhm1rTK3i5OtBujPVEgSspxI7Ka7PX/E5AAjqKVUj
 FSudafCCkMICXAKGeieEPO2+ee6YePPh+4NGyT2e199JpFA1rY5+Y7ydaDTDrr88vxag
 YWVOfa4DSZe/WtI0GDxGvQ4YdfGCYzQogi/F9gKthfx3/ZqN/XOO//iP0zKDYom2N4xF
 FDvg==
X-Gm-Message-State: AOAM533jDPdgyVodkkvn5SzBdXsWm3wXLv+hwquPpIr4lTMJ7MpFMud+
 cdsnXMD8I5pMf24QuZJs2yFxpys/
X-Google-Smtp-Source: ABdhPJwNk0mnMZ2WrvwT8NwghVQlpI18YmeE9SwyeXkudvBXprr+Y8eb3vkoPTmKgEpSQKknfABG3g==
X-Received: by 2002:a05:651c:39d:: with SMTP id
 e29mr295514ljp.463.1590490240211; 
 Tue, 26 May 2020 03:50:40 -0700 (PDT)
Received: from [192.168.0.2] ([46.188.59.176])
 by smtp.gmail.com with ESMTPSA id u4sm3560382lfl.18.2020.05.26.03.50.39
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 26 May 2020 03:50:39 -0700 (PDT)
Message-ID: <454679eb364e5ebfa92d4648d09093542c21fc01.camel@HIDDEN>
Subject: 26.3; window-body-width wrong return value when
 display-line-numbers-mode is on
From: "Matsievskiy S.V." <seregaxvm.main@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Date: Tue, 26 May 2020 13:50:38 +0300
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.36.2-1 
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=2a00:1450:4864:20::243;
 envelope-from=seregaxvm.main@HIDDEN; helo=mail-lj1-x243.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: 3.0 (+++)
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: `window-body-width` and `window-width` return wrong numbers
 when `display-line-numbers-mode` is on. For example: ```emacs-lisp (message
 (format "Width without line numbers: %d" (window-body-width)))
 (display-line-numbers-mode
 1) (message (format "Width with line numbers: %d" (window-body-width))) ``
 [...] Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: x.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (seregaxvm.main[at]gmail.com)
 0.0 RCVD_IN_MSPIKE_H4      RBL: Very Good reputation (+4)
 [209.51.188.17 listed in wl.mailspike.net]
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 2.0 SPOOFED_FREEMAIL       No description available.
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 26 May 2020 09:01:03 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

`window-body-width` and `window-width` return wrong numbers when
`display-line-numbers-mode` is on.

For example:
```emacs-lisp
(message (format "Width without line numbers: %d" (window-body-width)))
(display-line-numbers-mode 1)
(message (format "Width with line numbers: %d" (window-body-width)))
```

return these lines:
```
Width without line numbers: 209
Width with line numbers: 209
```

This is obviously wrong since line numbers take some window space.
This breaks some packages that rely on `window-body-width` and
`window-width` to align strings. 


In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2020-05-17, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version
11.0.12008000
System Description:     Debian GNU/Linux bullseye/sid

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
Width without line numbers: 209
Width with line numbers: 209

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-
lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-
lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-
lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-
lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-mHAik2/emacs-26.3+1=. -fstack-
protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  display-line-numbers-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils thingatpt help-fns radix-tree help-mode
easymenu cl-loaddefs cl-lib misearch multi-isearch display-line-numbers
cus-start cus-load elec-pair time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-
readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 109750 7626)
 (symbols 48 21505 1)
 (miscs 40 68 215)
 (strings 32 32568 1315)
 (string-bytes 1 804681)
 (vectors 16 14249)
 (vector-slots 8 504282 12068)
 (floats 8 53 281)
 (intervals 56 492 14)
 (buffers 992 13))





Acknowledgement sent to "Matsievskiy S.V." <seregaxvm.main@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#41537; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 26 May 2020 15:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.