GNU bug report logs - #71415
30.0.50; vtable-current-object off by one

Previous Next

Package: emacs;

Reported by: john muhl <jm <at> pub.pink>

Date: Fri, 7 Jun 2024 14:16:01 UTC

Severity: normal

Found in version 30.0.50

Done: john muhl <jm <at> pub.pink>

Bug is archived. No further changes may be made.

Full log


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

From: john muhl <jm <at> pub.pink>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71415-done <at> debbugs.gnu.org
Subject: Re: bug#71415: 30.0.50; vtable-current-object off by one
Date: Sat, 15 Jun 2024 13:55:03 -0500
After looking at vtable.el I don’t think this is meant to work how
I expected.

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

>> From: john muhl <jm <at> 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.




This bug report was last modified 340 days ago.

Previous Next


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