all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: john muhl <jm@pub.pink>, Adam Porter <adam@alphapapa.net>
Cc: 71415@debbugs.gnu.org
Subject: bug#71415: 30.0.50; vtable-current-object off by one
Date: Sat, 15 Jun 2024 11:40:26 +0300	[thread overview]
Message-ID: <86ikyavbt1.fsf@gnu.org> (raw)
In-Reply-To: <87h6e4u9ec.fsf@pub.pink> (message from john muhl on Fri, 07 Jun 2024 09:15:07 -0500)

> From: john muhl <jm@pub.pink>
> 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.





  reply	other threads:[~2024-06-15  8:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 14:15 bug#71415: 30.0.50; vtable-current-object off by one john muhl
2024-06-15  8:40 ` Eli Zaretskii [this message]
2024-06-15 18:55   ` john muhl
2024-06-16  0:45   ` Adam Porter
2024-06-17 13:35     ` john muhl
2024-06-17 16:24       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ikyavbt1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71415@debbugs.gnu.org \
    --cc=adam@alphapapa.net \
    --cc=jm@pub.pink \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.