]> git.eshelyaron.com Git - emacs.git/commit
Less wrong printed circular list tail index (bug#55395)
authorMattias Engdegård <mattiase@acm.org>
Mon, 23 May 2022 14:34:29 +0000 (16:34 +0200)
committerMattias Engdegård <mattiase@acm.org>
Mon, 23 May 2022 14:50:00 +0000 (16:50 +0200)
commit5a1a67a2562fab77856b48a38d89713d7f2c96d7
treed1d73336589a33f9a6d61407c5f33c34a34d7289
parentb3e4526f21749305b7f6b3f4a18e0df7cd0044a4
Less wrong printed circular list tail index (bug#55395)

When printing a circular list and `print-circle` is nil, use a
somewhat more meaningful ". #N" tail index.  The previous method for
calculating that index was based on Floyd circularity detection being
used so it had been broken ever since the change to Brent's algorithm.

The new index is correct with respect to the start of the list itself
which is what it used to be before being completely broken.
It does not take into account the nesting depth of the list context.

* src/print.c (struct print_stack_entry, print_object):
Keep track of the tortoise index (which is cheap) instead of trying
to derive it from the printed element index.
* test/src/print-tests.el (print-test-rho, print-circular):
New test.
src/print.c
test/src/print-tests.el