GNU bug report logs - #48095
28.0.50; display-line-numbers-mode / display-line-numbers-width-start incorrect

Previous Next

Package: emacs;

Reported by: Len Trigg <lenbok <at> gmail.com>

Date: Thu, 29 Apr 2021 02:45:02 UTC

Severity: normal

Found in version 28.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48095 in the body.
You can then email your comments to 48095 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48095; Package emacs. (Thu, 29 Apr 2021 02:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Len Trigg <lenbok <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 29 Apr 2021 02:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Len Trigg <lenbok <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; display-line-numbers-mode / display-line-numbers-width-start
 incorrect
Date: Thu, 29 Apr 2021 14:43:30 +1200
[Message part 1 (text/plain, inline)]
I am using display-line-numbers mode, and would like to avoid it
changing the width assigned to the line numbers as the buffer is
scrolled. I have (setq display-line-numbers-width-start t), which
purports to check in advance how much width is required. It seems
somehow incorrect though. To reproduce:

1 Create a buffer with 90 lines.

2 Ensure the window is approx 40 lines tall, displaying the first 40 lines
of the buffer.

3 Ensure display-line-numbers-width-start is t

4 Turn on display-line-numbers-mode.

5 Scroll down to near the bottom of the buffer. At some point, emacs
  adds an extra character of width to the line numbers, even though no
  line number higher than 90 is ever shown. If emacs needed an extra
  character for whatever reason, surely display-line-numbers-width-start
  should have incorporated that up front (otherwise what's the point)?




In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.16.0)
 of 2021-04-27 built on noir
Repository revision: 40c71e574ad27deee003a0850a40171750234d59
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Ubuntu 20.04.2 LTS

Configured using:
 'configure --prefix=/home/len/.local --with-xwidgets --with-rsvg
 --with-cairo --with-native-compilation'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM
XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_NZ.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  global-company-mode: t
  company-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  recentf-mode: t
  display-line-numbers-mode: t
  global-atomic-chrome-edit-mode: t
  pyvenv-mode: t
  projectile-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  editorconfig-mode: t
  diredfl-global-mode: t
  direnv-mode: t
  shell-dirtrack-mode: t
  backward-forward-mode: t
  override-global-mode: t
  which-key-mode: t
  treemacs-icons-dired-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: deferred
  treemacs-fringe-indicator-mode: t
  all-the-icons-ibuffer-mode: t
  ivy-mode: t
  global-ligature-mode: t
  ligature-mode: t
  diff-hl-margin-local-mode: t
  diff-hl-margin-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  xterm-mouse-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/len/.emacs.d/straight/build/transient/transient hides
/home/len/.local/share/emacs/28.0.50/lisp/transient
/home/len/.emacs.d/straight/build/org/ob-stan hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-stan
/home/len/.emacs.d/straight/build/org/org-clock hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-clock
/home/len/.emacs.d/straight/build/org/ob-perl hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-perl
/home/len/.emacs.d/straight/build/org/ob-tangle hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-tangle
/home/len/.emacs.d/straight/build/org/ox-org hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-org
/home/len/.emacs.d/straight/build/org/ob-ledger hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-ledger
/home/len/.emacs.d/straight/build/org/ob-makefile hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-makefile
/home/len/.emacs.d/straight/build/org/ob-fortran hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-fortran
/home/len/.emacs.d/straight/build/org/ob-plantuml hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-plantuml
/home/len/.emacs.d/straight/build/org/ox-man hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-man
/home/len/.emacs.d/straight/build/org/ob-eval hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-eval
/home/len/.emacs.d/straight/build/org/org-lint hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-lint
/home/len/.emacs.d/straight/build/org/ox-publish hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-publish
/home/len/.emacs.d/straight/build/org/ox-latex hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-latex
/home/len/.emacs.d/straight/build/org/ob-groovy hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-groovy
/home/len/.emacs.d/straight/build/org/org-habit hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-habit
/home/len/.emacs.d/straight/build/org/ob-eshell hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-eshell
/home/len/.emacs.d/straight/build/org/ob-shell hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-shell
/home/len/.emacs.d/straight/build/org/org-duration hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-duration
/home/len/.emacs.d/straight/build/org/ol-rmail hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-rmail
/home/len/.emacs.d/straight/build/org/org-inlinetask hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-inlinetask
/home/len/.emacs.d/straight/build/org/ol-irc hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-irc
/home/len/.emacs.d/straight/build/org/ob-emacs-lisp hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-emacs-lisp
/home/len/.emacs.d/straight/build/org/ob-mscgen hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-mscgen
/home/len/.emacs.d/straight/build/org/ob-screen hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-screen
/home/len/.emacs.d/straight/build/org/ob-ocaml hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-ocaml
/home/len/.emacs.d/straight/build/org/ob-shen hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-shen
/home/len/.emacs.d/straight/build/org/org-entities hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-entities
/home/len/.emacs.d/straight/build/org/ob-matlab hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-matlab
/home/len/.emacs.d/straight/build/org/ob-gnuplot hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-gnuplot
/home/len/.emacs.d/straight/build/org/ol-bibtex hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-bibtex
/home/len/.emacs.d/straight/build/org/ob-sass hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-sass
/home/len/.emacs.d/straight/build/org/ob-css hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-css
/home/len/.emacs.d/straight/build/org/ob-vala hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-vala
/home/len/.emacs.d/straight/build/org/ob-R hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-R
/home/len/.emacs.d/straight/build/org/org-datetree hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-datetree
/home/len/.emacs.d/straight/build/org/ob-ebnf hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-ebnf
/home/len/.emacs.d/straight/build/org/org-mouse hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-mouse
/home/len/.emacs.d/straight/build/org/ob-sqlite hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-sqlite
/home/len/.emacs.d/straight/build/org/ob-maxima hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-maxima
/home/len/.emacs.d/straight/build/org/ox-beamer hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-beamer
/home/len/.emacs.d/straight/build/org/ol-bbdb hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-bbdb
/home/len/.emacs.d/straight/build/org/ob-C hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-C
/home/len/.emacs.d/straight/build/org/ol-w3m hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-w3m
/home/len/.emacs.d/straight/build/org/ob-ditaa hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-ditaa
/home/len/.emacs.d/straight/build/org/ox-odt hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-odt
/home/len/.emacs.d/straight/build/org/org-archive hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-archive
/home/len/.emacs.d/straight/build/org/ol-mhe hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-mhe
/home/len/.emacs.d/straight/build/org/ob-ref hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-ref
/home/len/.emacs.d/straight/build/org/ob-sql hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-sql
/home/len/.emacs.d/straight/build/org/ob-lua hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-lua
/home/len/.emacs.d/straight/build/org/org-faces hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-faces
/home/len/.emacs.d/straight/build/org/ob-abc hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-abc
/home/len/.emacs.d/straight/build/org/ob-ruby hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-ruby
/home/len/.emacs.d/straight/build/org/org-plot hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-plot
/home/len/.emacs.d/straight/build/org/org-compat hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-compat
/home/len/.emacs.d/straight/build/org/org-src hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-src
/home/len/.emacs.d/straight/build/org/org-macs hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-macs
/home/len/.emacs.d/straight/build/org/ob-dot hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-dot
/home/len/.emacs.d/straight/build/org/org-attach-git hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-attach-git
/home/len/.emacs.d/straight/build/org/org-pcomplete hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-pcomplete
/home/len/.emacs.d/straight/build/org/org-goto hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-goto
/home/len/.emacs.d/straight/build/org/ox-md hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-md
/home/len/.emacs.d/straight/build/org/org-attach hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-attach
/home/len/.emacs.d/straight/build/org/ob-latex hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-latex
/home/len/.emacs.d/straight/build/org/ob-coq hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-coq
/home/len/.emacs.d/straight/build/org/ob-asymptote hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-asymptote
/home/len/.emacs.d/straight/build/org/ob-octave hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-octave
/home/len/.emacs.d/straight/build/org/org-indent hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-indent
/home/len/.emacs.d/straight/build/org/org-version hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-version
/home/len/.emacs.d/straight/build/org/org-table hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-table
/home/len/.emacs.d/straight/build/org/org-timer hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-timer
/home/len/.emacs.d/straight/build/org/ox-ascii hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-ascii
/home/len/.emacs.d/straight/build/org/ob-core hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-core
/home/len/.emacs.d/straight/build/org/org-footnote hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-footnote
/home/len/.emacs.d/straight/build/org/ob-io hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-io
/home/len/.emacs.d/straight/build/org/ob-scheme hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-scheme
/home/len/.emacs.d/straight/build/org/ol hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol
/home/len/.emacs.d/straight/build/org/ox-html hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-html
/home/len/.emacs.d/straight/build/org/org-element hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-element
/home/len/.emacs.d/straight/build/org/ob-haskell hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-haskell
/home/len/.emacs.d/straight/build/org/org-loaddefs hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-loaddefs
/home/len/.emacs.d/straight/build/org/ob-sed hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-sed
/home/len/.emacs.d/straight/build/org/org-capture hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-capture
/home/len/.emacs.d/straight/build/org/ol-eshell hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-eshell
/home/len/.emacs.d/straight/build/org/ol-gnus hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-gnus
/home/len/.emacs.d/straight/build/org/ob-org hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-org
/home/len/.emacs.d/straight/build/org/ob-lilypond hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-lilypond
/home/len/.emacs.d/straight/build/org/org-agenda hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-agenda
/home/len/.emacs.d/straight/build/org/ox-texinfo hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-texinfo
/home/len/.emacs.d/straight/build/org/org-id hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-id
/home/len/.emacs.d/straight/build/org/ob-python hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-python
/home/len/.emacs.d/straight/build/org/ob-java hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-java
/home/len/.emacs.d/straight/build/org/ob-picolisp hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-picolisp
/home/len/.emacs.d/straight/build/org/ol-docview hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-docview
/home/len/.emacs.d/straight/build/org/ol-eww hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-eww
/home/len/.emacs.d/straight/build/org/ox hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox
/home/len/.emacs.d/straight/build/org/org-keys hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-keys
/home/len/.emacs.d/straight/build/org/org-ctags hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-ctags
/home/len/.emacs.d/straight/build/org/org hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org
/home/len/.emacs.d/straight/build/org/org-num hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-num
/home/len/.emacs.d/straight/build/org/ob-awk hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-awk
/home/len/.emacs.d/straight/build/org/org-refile hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-refile
/home/len/.emacs.d/straight/build/org/ob-hledger hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-hledger
/home/len/.emacs.d/straight/build/org/ol-info hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ol-info
/home/len/.emacs.d/straight/build/org/ob-lisp hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-lisp
/home/len/.emacs.d/straight/build/org/org-colview hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-colview
/home/len/.emacs.d/straight/build/org/ob-exp hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-exp
/home/len/.emacs.d/straight/build/org/org-feed hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-feed
/home/len/.emacs.d/straight/build/org/ob-comint hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-comint
/home/len/.emacs.d/straight/build/org/org-tempo hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-tempo
/home/len/.emacs.d/straight/build/org/org-protocol hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-protocol
/home/len/.emacs.d/straight/build/org/org-list hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-list
/home/len/.emacs.d/straight/build/org/org-crypt hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-crypt
/home/len/.emacs.d/straight/build/org/ob-forth hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-forth
/home/len/.emacs.d/straight/build/org/ob-js hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-js
/home/len/.emacs.d/straight/build/org/org-mobile hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-mobile
/home/len/.emacs.d/straight/build/org/ob-lob hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-lob
/home/len/.emacs.d/straight/build/org/ob-table hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-table
/home/len/.emacs.d/straight/build/org/ob-processing hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-processing
/home/len/.emacs.d/straight/build/org/ob-J hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-J
/home/len/.emacs.d/straight/build/org/ob-calc hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-calc
/home/len/.emacs.d/straight/build/org/org-install hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-install
/home/len/.emacs.d/straight/build/org/ob hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob
/home/len/.emacs.d/straight/build/org/org-macro hides
/home/len/.local/share/emacs/28.0.50/lisp/org/org-macro
/home/len/.emacs.d/straight/build/org/ob-clojure hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ob-clojure
/home/len/.emacs.d/straight/build/org/ox-icalendar hides
/home/len/.local/share/emacs/28.0.50/lisp/org/ox-icalendar
/home/len/.emacs.d/straight/build/let-alist/let-alist hides
/home/len/.local/share/emacs/28.0.50/lisp/emacs-lisp/let-alist
/home/len/.emacs.d/straight/build/eldoc/eldoc hides
/home/len/.local/share/emacs/28.0.50/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug sendmail cl-print help-fns radix-tree
dabbrev lsp-diagnostics company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-yasnippet company-bbdb company lsp-headerline
lsp-icons lsp-modeline lsp-ui lsp-ui-flycheck lsp-ui-doc xwidget
image-mode exif lsp-ui-imenu lsp-ui-peek lsp-ui-sideline lsp-ui-util
goto-addr vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
bug-reference mule-util magit-extras treemacs-magit magit-bookmark
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode diff git-commit log-edit message rfc822 mml mml-sec epa
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
gmm-utils add-log magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor magit-mode magit-git
magit-section magit-utils crm dired-aux view lsp-zig lsp-steep
lsp-svelte lsp-sqls lsp-yaml lsp-xml lsp-vimscript lsp-vhdl lsp-vetur
lsp-html lsp-verilog lsp-vala lsp-terraform lsp-tex lsp-sorbet
lsp-solargraph lsp-rust lsp-rf lsp-r lsp-purescript lsp-pwsh lsp-php
lsp-perl lsp-ocaml lsp-nix lsp-nim lsp-markdown lsp-lua lsp-kotlin
lsp-json lsp-javascript lsp-haxe lsp-groovy lsp-hack lsp-go
lsp-completion lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang
lsp-elixir lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp
gnutls lsp-crystal lsp-cmake lsp-clojure lsp-clangd dom lsp-bash
lsp-angular lsp-ada lsp-actionscript ccls ccls-member-hierarchy
ccls-inheritance-hierarchy ccls-call-hierarchy ccls-tree ccls-code-lens
ccls-semantic-highlight ccls-common recentf treemacs-bookmarks bookmark
scad-dbus dbus xml scad-mode symbol-overlay ws-butler
display-fill-column-indicator display-line-numbers editorconfig-core
editorconfig-core-handle editorconfig-fnmatch ffap counsel xdg
disp-table server diary-lib diary-loaddefs cal-menu calendar
cal-loaddefs generic hydra python-pytest python-pytest-autoloads
importmagic epc ctable concurrent deferred cl importmagic-autoloads
epc-autoloads ctable-autoloads concurrent-autoloads deferred-autoloads
auto-remove auto-remove-autoloads py-isort py-isort-autoloads
python-black reformatter python-black-autoloads reformatter-autoloads
blacken blacken-autoloads flycheck-mypy flycheck-mypy-autoloads elpy
elpy-rpc elpy-shell elpy-profile elpy-django elpy-refactor python
tramp-sh tramp tramp-loaddefs trampver tramp-integration tramp-compat
parse-time iso8601 time-date ls-lisp ido files-x cus-edit pp
elpy-autoloads highlight-indentation-autoloads groovy-mode
groovy-mode-autoloads shell-extras eradio-autoloads atomic-chrome
websocket bindat atomic-chrome-autoloads websocket-autoloads
counsel-keepassxc-autoloads pyvenv eshell esh-cmd esh-ext esh-opt
esh-proc esh-io esh-arg esh-module esh-groups esh-util pyvenv-autoloads
ccls-autoloads lsp-pyls lsp-ivy lsp-mode tree-widget wid-edit spinner
network-stream puny nsm rmc markdown-mode noutline outline lv f epg
epg-config lsp-protocol lsp-ivy-autoloads lsp-ui-autoloads
lsp-mode-autoloads spinner-autoloads f-autoloads eldoc-autoloads
js2-mode etags fileloop generator js cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs js2-mode-autoloads
ess ess-utils ess-custom ess-autoloads dts-mode dts-mode-autoloads
gnuplot info-look gnuplot-autoloads scad-dbus-autoloads
scad-mode-autoloads projectile ibuf-ext projectile-autoloads grip-mode
grip-mode-autoloads markdown-mode-autoloads org-bullets-autoloads
multi-web-mode multi-web-mode-autoloads yaml-mode yaml-mode-autoloads
csv-mode-autoloads ediff ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-init ediff-util git-timemachine transient format-spec
vc-git git-timemachine-autoloads git-messenger-autoloads flycheck-aspell
ispell flycheck-aspell-autoloads flycheck derived find-func jka-compr
let-alist flycheck-autoloads let-alist-autoloads pkg-info-autoloads
epl-autoloads company-autoloads yasnippet-snippets-autoloads
yasnippet-snippets ivy-yasnippet yasnippet multiple-cursors
mc-separate-operations rectangular-region-mode mc-mark-pop mc-edit-lines
mc-hide-unmatched-lines-mode mc-mark-more mc-cycle-cursors
multiple-cursors-core multiple-cursors-autoloads iedit-autoloads
visual-regexp-autoloads wgrep-ag wgrep-ag-autoloads wgrep
wgrep-autoloads evil-numbers-autoloads rectangle-utils rect
rectangle-utils-autoloads smartparens thingatpt smartparens-autoloads
ws-butler-autoloads dtrt-indent dtrt-indent-autoloads editorconfig
editorconfig-autoloads expand-region-autoloads diredfl diredfl-autoloads
dired-du-autoloads dired-single dired-single-autoloads
dired-hide-dotfiles dired-hide-dotfiles-autoloads direnv
direnv-autoloads shell pcomplete midnight dumb-jump popup
dumb-jump-autoloads popup-autoloads ivy-yasnippet-autoloads
yasnippet-autoloads counsel-autoloads request mailheader autorevert
mail-utils request-autoloads swiper swiper-autoloads posframe
backward-forward backward-forward-autoloads crux-autoloads edmacro
kmacro move-text move-text-autoloads use-package-bind-key bind-key
which-key which-key-autoloads minimap minimap-autoloads
treemacs-magit-autoloads magit-autoloads git-commit-autoloads
with-editor-autoloads transient-autoloads treemacs-icons-dired
treemacs-icons-dired-autoloads treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface
treemacs-extensions treemacs-mouse-interface treemacs-tags imenu xref
project treemacs-persistence treemacs-filewatch-mode filenotify
treemacs-follow-mode treemacs-rendering treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope treemacs-faces treemacs-icons
treemacs-themes treemacs-core-utils pfuture inline ht treemacs-logging
treemacs-customization treemacs-macros treemacs-autoloads cfrs-autoloads
posframe-autoloads ht-autoloads hydra-autoloads lv-autoloads
pfuture-autoloads ace-window-autoloads avy-autoloads
all-the-icons-ibuffer ibuffer ibuffer-loaddefs
all-the-icons-ibuffer-autoloads all-the-icons-ivy ivy ivy-faces
ivy-overlay colir all-the-icons-ivy-autoloads ivy-autoloads
all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons
all-the-icons-autoloads ligature ligature-autoloads
symbol-overlay-autoloads highlight-indent-guides
highlight-indent-guides-autoloads diff-hl-margin diff-hl-dired dired
dired-loaddefs diff-hl log-view pcvs-util vc-dir ewoc vc vc-dispatcher
diff-mode easy-mmode diff-hl-autoloads hl-line whitespace xterm-color
xterm-color-autoloads rainbow-mode rainbow-mode-autoloads pcase
spaceline-config spaceline-segments s spaceline powerline comp comp-cstr
warnings rx powerline-separators powerline-themes dash
spaceline-autoloads s-autoloads dash-autoloads powerline-autoloads
finder-inf jetbrains-darcula-theme-autoloads modus-vivendi-theme
modus-themes modus-vivendi-theme-autoloads use-package-diminish
auto-minor-mode auto-minor-mode-autoloads diminish diminish-autoloads
try package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source eieio eieio-core eieio-loaddefs password-cache
json map url-vars try-autoloads olivetti olivetti-autoloads mixed-pitch
face-remap mixed-pitch-autoloads pulse color advice use-package-ensure
xt-mouse use-package-core use-package-autoloads bind-key-autoloads
straight-autoloads info cl-seq cl-extra help-mode seq byte-opt straight
subr-x cl-macs gv cl-loaddefs cl-lib bytecomp byte-compile cconv
lazy-lock paren avoid grep compile text-property-search comint
ansi-color ring delsel cus-load iso-transl 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 tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer 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 cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
nativecomp emacs)

Memory information:
((conses 16 1428188 1245272)
 (symbols 48 61064 3)
 (strings 32 220570 170030)
 (string-bytes 1 8148602)
 (vectors 16 115384)
 (vector-slots 8 2862776 1062890)
 (floats 8 1201 2813)
 (intervals 56 29889 20776)
 (buffers 992 62))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48095; Package emacs. (Thu, 29 Apr 2021 09:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 48095 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Len Trigg <lenbok <at> gmail.com>
Cc: 48095 <at> debbugs.gnu.org
Subject: Re: bug#48095: 28.0.50;
 display-line-numbers-mode / display-line-numbers-width-start incorrect
Date: Thu, 29 Apr 2021 12:03:36 +0300
> From: Len Trigg <lenbok <at> gmail.com>
> Date: Thu, 29 Apr 2021 14:43:30 +1200
> 
> I am using display-line-numbers mode, and would like to avoid it
> changing the width assigned to the line numbers as the buffer is
> scrolled. I have (setq display-line-numbers-width-start t), which
> purports to check in advance how much width is required. It seems
> somehow incorrect though. To reproduce:
> 
> 1 Create a buffer with 90 lines.
> 
> 2 Ensure the window is approx 40 lines tall, displaying the first 40 lines
> of the buffer.
> 
> 3 Ensure display-line-numbers-width-start is t
> 
> 4 Turn on display-line-numbers-mode.
> 
> 5 Scroll down to near the bottom of the buffer. At some point, emacs
>   adds an extra character of width to the line numbers, even though no 
>   line number higher than 90 is ever shown. If emacs needed an extra
>   character for whatever reason, surely display-line-numbers-width-start
>   should have incorporated that up front (otherwise what's the point)?

This is not exactly as simple as it may sound.  When the line numbers
are produced at display time, Emacs accounts for the maximum possible
number of lines that could fit in the window, and enlarges the width
when the window could display more lines, so that the width doesn't
change in the middle of the window.  So if the window is, say, 35
lines high, and the last portion of the buffer is about to be
displayed, Emacs computes the width necessary to display up to 35 more
lines, even if those lines are not yet in the buffer.  There's also
the possibility that the text will have different faces, and that
could affect the actual number of lines (via the font height).

But this cannot be done up front, because when the mode is turned on
in a buffer, the dimensions of the window where it will be displayed
are not necessarily known, and neither are the fonts that will be used
to display the buffer.  And windows nowadays can be as small as a few
lines or as toll as the full screen.

What I can offer to make the situation slightly better is to allow
display-line-numbers-width-start to have a numeric value, which will
then be interpreted as the number of extra lines to account for when
computing the required width.  A user who wants this is supposed to
know how tall are the windows in his/her sessions, and should set the
value to the maximum height of windows he/she wants to support.

The patch for that is below; could you please try it and see if this
provides a satisfactory solution for your problem?

diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
index a6fa813..0a834d4 100644
--- a/lisp/display-line-numbers.el
+++ b/lisp/display-line-numbers.el
@@ -56,12 +56,15 @@ display-line-numbers-grow-only
 
 (defcustom display-line-numbers-width-start nil
   "If non-nil, count number of lines to use for line number width.
-When `display-line-numbers-mode' is turned on,
-`display-line-numbers-width' is set to the minimum width necessary
-to display all line numbers in the buffer."
+When `display-line-numbers-mode' is turned on, if this option is
+non-nil, `display-line-numbers-width' is set up front to a width
+necessary to display all line numbers in the buffer.  If the value
+is a positive number, it is interpreted as extra lines to account
+for when computing the required width."
   :group 'display-line-numbers
-  :type 'boolean
-  :version "26.1")
+  :type '(choice (boolean :tag "Minimum width for buffer's line count")
+                 (integer :tag "Number of extra lines to account for"))
+  :version "28.1")
 
 (defun display-line-numbers-update-width ()
   "Prevent the line number width from shrinking."
@@ -83,7 +86,11 @@ display-line-numbers-mode
         (when display-line-numbers-width-start
           (setq display-line-numbers-width
                 (length (number-to-string
-                         (count-lines (point-min) (point-max))))))
+                         (+ (count-lines (point-min) (point-max))
+                            (if (and (numberp display-line-numbers-width-start)
+                                     (> display-line-numbers-width-start 0))
+                                display-line-numbers-width-start
+                              0))))))
         (when display-line-numbers-grow-only
           (add-hook 'pre-command-hook #'display-line-numbers-update-width nil t))
         (setq display-line-numbers display-line-numbers-type))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48095; Package emacs. (Thu, 29 Apr 2021 22:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 48095 <at> debbugs.gnu.org (full text, mbox):

From: Len Trigg <lenbok <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48095 <at> debbugs.gnu.org
Subject: Re: bug#48095: 28.0.50; display-line-numbers-mode /
 display-line-numbers-width-start incorrect
Date: Fri, 30 Apr 2021 10:29:23 +1200
[Message part 1 (text/plain, inline)]
That seems to work perfectly for my goal (and I assume the intent of
display-line-numbers-width-start) of having the width stay fixed unless
content gets added to the buffer. It might help to add guidance in the docs
that extra lines would typically be set to the maximum window height. Or
maybe that value could instead be automatically computed from the height of
the tallest emacs frame at that time? I assume that's not too intensive to
determine since it happens once when the mode is activated?


On Thu, 29 Apr 2021 at 21:03, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Len Trigg <lenbok <at> gmail.com>
> > Date: Thu, 29 Apr 2021 14:43:30 +1200
> >
> > I am using display-line-numbers mode, and would like to avoid it
> > changing the width assigned to the line numbers as the buffer is
> > scrolled. I have (setq display-line-numbers-width-start t), which
> > purports to check in advance how much width is required. It seems
> > somehow incorrect though. To reproduce:
> >
> > 1 Create a buffer with 90 lines.
> >
> > 2 Ensure the window is approx 40 lines tall, displaying the first 40
> lines
> > of the buffer.
> >
> > 3 Ensure display-line-numbers-width-start is t
> >
> > 4 Turn on display-line-numbers-mode.
> >
> > 5 Scroll down to near the bottom of the buffer. At some point, emacs
> >   adds an extra character of width to the line numbers, even though no
> >   line number higher than 90 is ever shown. If emacs needed an extra
> >   character for whatever reason, surely display-line-numbers-width-start
> >   should have incorporated that up front (otherwise what's the point)?
>
> This is not exactly as simple as it may sound.  When the line numbers
> are produced at display time, Emacs accounts for the maximum possible
> number of lines that could fit in the window, and enlarges the width
> when the window could display more lines, so that the width doesn't
> change in the middle of the window.  So if the window is, say, 35
> lines high, and the last portion of the buffer is about to be
> displayed, Emacs computes the width necessary to display up to 35 more
> lines, even if those lines are not yet in the buffer.  There's also
> the possibility that the text will have different faces, and that
> could affect the actual number of lines (via the font height).
>
> But this cannot be done up front, because when the mode is turned on
> in a buffer, the dimensions of the window where it will be displayed
> are not necessarily known, and neither are the fonts that will be used
> to display the buffer.  And windows nowadays can be as small as a few
> lines or as toll as the full screen.
>
> What I can offer to make the situation slightly better is to allow
> display-line-numbers-width-start to have a numeric value, which will
> then be interpreted as the number of extra lines to account for when
> computing the required width.  A user who wants this is supposed to
> know how tall are the windows in his/her sessions, and should set the
> value to the maximum height of windows he/she wants to support.
>
> The patch for that is below; could you please try it and see if this
> provides a satisfactory solution for your problem?
>
> diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
> index a6fa813..0a834d4 100644
> --- a/lisp/display-line-numbers.el
> +++ b/lisp/display-line-numbers.el
> @@ -56,12 +56,15 @@ display-line-numbers-grow-only
>
>  (defcustom display-line-numbers-width-start nil
>    "If non-nil, count number of lines to use for line number width.
> -When `display-line-numbers-mode' is turned on,
> -`display-line-numbers-width' is set to the minimum width necessary
> -to display all line numbers in the buffer."
> +When `display-line-numbers-mode' is turned on, if this option is
> +non-nil, `display-line-numbers-width' is set up front to a width
> +necessary to display all line numbers in the buffer.  If the value
> +is a positive number, it is interpreted as extra lines to account
> +for when computing the required width."
>    :group 'display-line-numbers
> -  :type 'boolean
> -  :version "26.1")
> +  :type '(choice (boolean :tag "Minimum width for buffer's line count")
> +                 (integer :tag "Number of extra lines to account for"))
> +  :version "28.1")
>
>  (defun display-line-numbers-update-width ()
>    "Prevent the line number width from shrinking."
> @@ -83,7 +86,11 @@ display-line-numbers-mode
>          (when display-line-numbers-width-start
>            (setq display-line-numbers-width
>                  (length (number-to-string
> -                         (count-lines (point-min) (point-max))))))
> +                         (+ (count-lines (point-min) (point-max))
> +                            (if (and (numberp
> display-line-numbers-width-start)
> +                                     (> display-line-numbers-width-start
> 0))
> +                                display-line-numbers-width-start
> +                              0))))))
>          (when display-line-numbers-grow-only
>            (add-hook 'pre-command-hook #'display-line-numbers-update-width
> nil t))
>          (setq display-line-numbers display-line-numbers-type))
>
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 30 Apr 2021 07:38:02 GMT) Full text and rfc822 format available.

Notification sent to Len Trigg <lenbok <at> gmail.com>:
bug acknowledged by developer. (Fri, 30 Apr 2021 07:38:02 GMT) Full text and rfc822 format available.

Message #16 received at 48095-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Len Trigg <lenbok <at> gmail.com>
Cc: 48095-done <at> debbugs.gnu.org
Subject: Re: bug#48095: 28.0.50; display-line-numbers-mode /
 display-line-numbers-width-start incorrect
Date: Fri, 30 Apr 2021 10:36:45 +0300
> From: Len Trigg <lenbok <at> gmail.com>
> Date: Fri, 30 Apr 2021 10:29:23 +1200
> Cc: 48095 <at> debbugs.gnu.org
> 
> That seems to work perfectly for my goal (and I assume the intent of display-line-numbers-width-start) of
> having the width stay fixed unless content gets added to the buffer. It might help to add guidance in the docs
> that extra lines would typically be set to the maximum window height.

Thanks, I added that to the doc string.

> Or maybe that value could instead be
> automatically computed from the height of the tallest emacs frame at that time? I assume that's not too
> intensive to determine since it happens once when the mode is activated?

This would be over-engineering, IMO.  First, some people tend to have
lots of frames, so this might be expensive.  Second, what matters is
not the frame height but the window height, and we could have many
windows even if the number of frames is small.  Third, some frames and
windows could be dedicated to special displays, and thus not really
relevant (example: Speedbar frames), so we will no doubt be asked to
provide yet another defcustom, to let users control which frames are
exempt from accounting for their height.

So I think asking users to provide a value strikes a good balance
between functionality and complexity, at least unless we hear about
use cases where automatic adjustment would really make a lot of sense.

With that in mind, I installed the change on the master branch, and
I'm closing this bug report.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48095; Package emacs. (Fri, 30 Apr 2021 10:57:01 GMT) Full text and rfc822 format available.

Message #19 received at 48095-done <at> debbugs.gnu.org (full text, mbox):

From: Len Trigg <lenbok <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48095-done <at> debbugs.gnu.org
Subject: Re: bug#48095: 28.0.50; display-line-numbers-mode /
 display-line-numbers-width-start incorrect
Date: Fri, 30 Apr 2021 22:56:15 +1200
[Message part 1 (text/plain, inline)]
Thanks Eli, that sounds carefully thought through and I agree with your
assessment.

Cheers!

On Fri, 30 Apr 2021, 19:36 Eli Zaretskii, <eliz <at> gnu.org> wrote:

> > From: Len Trigg <lenbok <at> gmail.com>
> > Date: Fri, 30 Apr 2021 10:29:23 +1200
> > Cc: 48095 <at> debbugs.gnu.org
> >
> > That seems to work perfectly for my goal (and I assume the intent of
> display-line-numbers-width-start) of
> > having the width stay fixed unless content gets added to the buffer. It
> might help to add guidance in the docs
> > that extra lines would typically be set to the maximum window height.
>
> Thanks, I added that to the doc string.
>
> > Or maybe that value could instead be
> > automatically computed from the height of the tallest emacs frame at
> that time? I assume that's not too
> > intensive to determine since it happens once when the mode is activated?
>
> This would be over-engineering, IMO.  First, some people tend to have
> lots of frames, so this might be expensive.  Second, what matters is
> not the frame height but the window height, and we could have many
> windows even if the number of frames is small.  Third, some frames and
> windows could be dedicated to special displays, and thus not really
> relevant (example: Speedbar frames), so we will no doubt be asked to
> provide yet another defcustom, to let users control which frames are
> exempt from accounting for their height.
>
> So I think asking users to provide a value strikes a good balance
> between functionality and complexity, at least unless we hear about
> use cases where automatic adjustment would really make a lot of sense.
>
> With that in mind, I installed the change on the master branch, and
> I'm closing this bug report.
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 28 May 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 305 days ago.

Previous Next


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