Subject: bug#58370: 29.0.50; Error in vtable-insert-object when truncating column

From: Tad Fisher <[email-masked]>
Date: Fri, 7 Oct 2022 15:23:46 -0700

The following program causes an error due to missing "ellipsis" and
"ellipsis-width" arguments to `vterm--insert-line`:

(require 'vtable)
(let ((table (make-vtable
	      :columns '((:name "A" :width 10)
			 (:name "B" :width 10))
	      :objects '(("first" "first, truncated correctly")))))
  (vtable-insert-object table '("second", "second, causes error")))

Backtrace:

Lisp error: (wrong-type-argument number-or-marker-p nil)
  #f(compiled-function (elem index) #<bytecode
0xaec334ab96760f6>)((,"second, causes error" 152 #("(, second, causes
error)" 0 24 (face vtable))) 1)
  #f(compiled-function (elt) #<bytecode -0x698358f3132e50>)((,"second,
causes error" 152 #("(, second, causes error)" 0 24 (face vtable))))
  mapc(#f(compiled-function (elt) #<bytecode -0x698358f3132e50>)
(("second" 46 #("second" 0 6 (face vtable))) (,"second, causes error"
152 #("(, second, causes error)" 0 24 (face vtable)))))
  seq-do(#f(compiled-function (elt) #<bytecode -0x698358f3132e50>)
(("second" 46 #("second" 0 6 (face vtable))) (,"second, causes error"
152 #("(, second, causes error)" 0 24 (face vtable)))))
  seq-do-indexed(#f(compiled-function (elem index) #<bytecode
0xaec334ab96760f6>) (("second" 46 #("second" 0 6 (face vtable)))
(,"second, causes error" 152 #("(, second, causes error)" 0 24 (face
vtable)))))
  vtable--insert-line(#<vtable vtable-5d04f6> (("second" ,"second,
causes error") ("second" 46 #("second" 0 6 (face vtable))) (,"second,
causes error" 152 #("(, second, causes error)" 0 24 (face vtable)))) 0
[80 80] 8)
  vtable-insert-object(#<vtable vtable-5d04f6> ("second" ,"second,
causes error"))
  (let ((table (make-vtable :columns '((:name "A" :width 10) (:name
"B" :width 10)) :objects '(("first" "first, truncated correctly")))))
(vtable-insert-object table '("second" ,"second, causes error")))
  (progn (let ((table (make-vtable :columns '((:name "A" :width 10)
(:name "B" :width 10)) :objects '(("first" "first, truncated
correctly"))))) (vtable-insert-object table '("second" ,"second,
causes error"))))
  elisp--eval-last-sexp(t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  funcall-interactively(eval-print-last-sexp nil)
  command-execute(eval-print-last-sexp)

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.34, cairo version 1.16.0)
Repository revision: f3769bc32a3d32377a83b33d416205f80814e422
Repository branch: master
System Description: NixOS 22.11 (Raccoon)

Configured using:
 'configure
 --prefix=/nix/store/h7vymh8xmwp22gdapx1gdcyigrvsizkv-emacs-pgtk-native-comp-20221007.0
 --disable-build-details --with-modules --with-x-toolkit=gtk3
 --with-cairo --with-native-compilation --with-pgtk'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS XIM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH:
  value of $EMACSNATIVELOADPATH:
/nix/store/xlkgnswx40nwhvkkw53lwp4kbx7s9nq5-emacs-packages-deps/share/emacs/native-lisp::
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix