Subject: bug#71415: closed (Re: bug#71415: 30.0.50; vtable-current-object off by one)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 15 Jun 2024 18:56:02 +0000

Your bug report

#71415: 30.0.50; vtable-current-object off by one

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71415: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71415
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71415: 30.0.50; vtable-current-object off by one
From: john muhl <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Sat, 15 Jun 2024 13:55:03 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

After looking at vtable.el I don’t think this is meant to work how
I expected.

Eli Zaretskii <[email-masked]> writes:

>> From: john muhl <[email-masked]>
>> Date: Fri, 07 Jun 2024 09:15:07 -0500
>> 
>> After updating an object, ‘vtable-current-object’ in the displayer
>> and formatter functions points to the object after the one that
>> was updated. Running the following:
>> 
>>   (with-current-buffer (get-buffer-create "vtable-demo")
>>     (require 'vtable)
>>     (erase-buffer)
>>     (make-vtable
>>      :columns '("Index" "Number")
>>      :objects `((1 ,(random)) (2 ,(random)) (3 ,(random)))
>>      :displayer (lambda (value &rest _)
>>                   ;; vtable-current-object is off by one; e.g.
>>                   ;; update the first row and v-c-o will be the second row;
>>                   ;; update the final row and v-c-o will be nil.
>>                   (message "%s %s" value (vtable-current-object))
>>                   (propertize (number-to-string value) 'face 'vtable)))
>>     (let* ((table (vtable-current-table))
>>            (first (nth 0 (vtable-objects table)))
>>            (other (nth 1 (vtable-objects table)))
>>            (final (nth 2 (vtable-objects table))))
>>       (setf (nth 1 first) 1)
>>       (setf (nth 1 other) 2)
>>       (setf (nth 1 final) 3)
>>       (vtable-update-object table first)
>>       (vtable-update-object table other)
>>       (vtable-update-object table final)))
>> 
>> I see in the messages buffer:
>> 
>>   1 (2 2) [2 times]
>>   2 (3 3) [2 times]
>>   3 nil [2 times]
>> 
>> when I expect to see:
>> 
>>   1 (1 1) [2 times]
>>   2 (2 2) [2 times]
>>   3 (3 3) [2 times]
>
> Adam, any comments or suggestions?
>
> Thanks.

Subject: 30.0.50; vtable-current-object off by one
From: john muhl <[email-masked]>
To: [email-masked]
Date: Fri, 07 Jun 2024 09:15:07 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

After updating an object, ‘vtable-current-object’ in the displayer
and formatter functions points to the object after the one that
was updated. Running the following:

  (with-current-buffer (get-buffer-create "vtable-demo")
    (require 'vtable)
    (erase-buffer)
    (make-vtable
     :columns '("Index" "Number")
     :objects `((1 ,(random)) (2 ,(random)) (3 ,(random)))
     :displayer (lambda (value &rest _)
                  ;; vtable-current-object is off by one; e.g.
                  ;; update the first row and v-c-o will be the second row;
                  ;; update the final row and v-c-o will be nil.
                  (message "%s %s" value (vtable-current-object))
                  (propertize (number-to-string value) 'face 'vtable)))
    (let* ((table (vtable-current-table))
           (first (nth 0 (vtable-objects table)))
           (other (nth 1 (vtable-objects table)))
           (final (nth 2 (vtable-objects table))))
      (setf (nth 1 first) 1)
      (setf (nth 1 other) 2)
      (setf (nth 1 final) 3)
      (vtable-update-object table first)
      (vtable-update-object table other)
      (vtable-update-object table final)))

I see in the messages buffer:

  1 (2 2) [2 times]
  2 (3 3) [2 times]
  3 nil [2 times]

when I expect to see:

  1 (1 1) [2 times]
  2 (2 2) [2 times]
  3 (3 3) [2 times]

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-05-26 built on thelio
Repository revision: f2309557ff366a81183859bda88b9a0012a5d9d6
Repository branch: main
System Description: Fedora Linux 39 (Thirty Nine)

Configured using:
 'configure --with-pgtk --prefix=/home/jm/.local'

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

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

Major mode: ELisp/l

Minor modes in effect:
  goto-address-mode: t
  whitespace-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  server-mode: t
  checkdoc-minor-mode: t
  which-function-mode: t
  ruler-mode: t
  flymake-mode: t
  winner-mode: t
  savehist-mode: t
  save-place-mode: t
  repeat-mode: t
  minibuffer-electric-default-mode: t
  midnight-mode: t
  kill-ring-deindent-mode: t
  global-visual-wrap-prefix-mode: t
  visual-wrap-prefix-mode: t
  global-paren-face-mode: t
  paren-face-mode: t
  global-auto-revert-mode: t
  electric-pair-mode: t
  dynamic-completion-mode: t
  desktop-save-mode: t
  delete-selection-mode: t
  coterm-mode: t
  blow-mode: t
  auto-insert-mode: t
  outline-minor-mode: t
  mu4e-modeline-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-quote-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  auto-save-visited-mode: t

Load-path shadows:
None found.

Features:
(shadow emacsbug ibuf-ext ibuffer ibuffer-loaddefs term/xterm
xterm eglot external-completion jsonrpc ert ewoc descr-text novice
vtable package-vc calc-poly calc-arith calc-misc calc-alg
calc-aent metar calc-units calc-ext calc calc-loaddefs rect
calc-macs finder reposition cus-theme scheme csharp-mode xref
files-x two-column debug backtrace magit-subtree magit-gitignore
magit-ediff ediff ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-init ediff-util goto-addr whitespace flyspell
ispell vc dabbrev magit-patch cal-coptic cal-x calculator
cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew
cal-julian holidays holiday-loaddefs cal-move misc cc-bytecomp
cc-langs cl-print shortdoc help-fns radix-tree tmm misearch
multi-isearch network-stream url-http url-gw nsm url-cache
url-auth qp sort gnus-cite shr-color mm-archive mail-extr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check css-mode sgml-mode facemenu color thai-util
thai-word display-line-numbers filecache magit-extras magit-imenu
git-rebase face-remap 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
magit-diff magit-core magit-autorevert magit-margin
magit-transient magit-process tabify apropos sh-script smie
executable cursor-sensor oc-basic org-element org-persist org-id
org-refile avl-tree generator ol-eww eww xdg url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect ol-docview
doc-view ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi
conf-mode git-commit log-edit pcvs-util add-log magit-mode
transient edmacro kmacro magit-git magit-section magit-utils crm
dash with-editor comp comp-cstr image-mode exif pcase
emacs-news-mode dired-aux js c-ts-common treesit cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs server cus-start respect-theme unsp-theme most-faces
cl-extra jka-compr smerge-mode diff vc-git diff-mode track-changes
easy-mmode vc-dispatcher bug-reference checkdoc lisp-mnt help-mode
which-func imenu ruler-mode flymake project warnings init winner
savehist saveplace repeat minibuf-eldef midnight indent-aux
visual-wrap paren-face autorevert filenotify elec-pair completion
desktop frameset delsel coterm compat term disp-table shell ehelp
blow autoinsert blow-autoloads coterm-autoloads debbugs-autoloads
elpher-autoloads magit-autoloads git-commit-autoloads
magit-section-autoloads dash-autoloads metar-autoloads
paren-face-autoloads finder-inf unsp-autoloads
most-faces-autoloads info with-editor-autoloads xr-autoloads
package url-handlers early-init mu4e mu4e-org org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete pcomplete org-list org-footnote org-faces
org-entities noutline outline ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc
org-loaddefs find-func org-version org-compat org-macs format-spec
mu4e-notification notifications mu4e-main mu4e-view thingatpt
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum
gnus-group gnus-undo gnus-start gnus-dbus dbus compile comint
ansi-osc ansi-color ring comp-run comp-common gnus-cloud nnimap
nnmail mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range gnus-win gnus nnheader range cal-menu calendar
cal-loaddefs mu4e-headers mu4e-compose mu4e-draft mu4e-actions
smtpmail mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark
mu4e-message shr pixel-fill kinsoku url-file svg xml dom
browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util
flow-fill mule-util hl-line mu4e-contacts mu4e-update mu4e-folders
mu4e-context mu4e-query-items mu4e-server mu4e-modeline mu4e-vars
mu4e-helpers mu4e-config mu4e-window bookmark ido message sendmail
mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util text-property-search
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader mu4e-obsolete rx auth-source-pass url-parse
url-vars auth-source cl-seq eieio eieio-core cl-macs
password-cache json map byte-opt gv bytecomp byte-compile subr-x
cus-edit pp cus-load icons wid-edit cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win
term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-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 nadvice seq simple
cl-generic indonesian philippine 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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray
oclosure cl-preloaded button loaddefs theme-loaddefs faces
cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk
pgtk multi-tty move-toolbar make-network-process native-compile
emacs)

Memory information:
((conses 16 3003423 1050394) (symbols 48 71255 2209)
 (strings 32 384264 44776) (string-bytes 1 11723127)
 (vectors 16 153369) (vector-slots 8 2666912 1228221)
 (floats 8 15228 49590) (intervals 56 344023 34775) (buffers 992 89))