Subject: Re: bug#64835: ‘describe-variable’unconditionally let-binds ‘print-circle’ to t

From: Eli Zaretskii <[email-masked]>
Date: Mon, 24 Jul 2023 20:03:39 +0300

> From: Sebastian Miele <[email-masked]>
> Date: Mon, 24 Jul 2023 18:42:09 +0200
> 
> That was not the case in Emacs 28.  It seems to have been introduced
> in the following commit:
> 
>   2c18969c810f338d73beda592ee5af7103132e97
>   Author:     Stefan Monnier <[email-masked]>
>   AuthorDate: Thu Mar 2 02:08:08 2017 -0500
>   Commit:     Stefan Monnier <[email-masked]>
>   CommitDate: Thu Mar 2 02:08:32 2017 -0500
> 
>   * lisp/help-fns.el (describe-variable): Use cl-print for the value
> 
>   Use `pp-buffer' rather than `pp' so as to avoid calling prin1 twice.
> 
> 2017 is a while ago.  The first pretest release of Emacs 28 was in
> December 2021.  So the commit must have entered the current emacs-29
> branch in some "non-linear" way.

I don't think so.  I see this code in Emacs 28.1.  So I'm not sure why
you didn't see this behavior in Emacs 28, if indeed it is caused by
print-circle.

> The problem is that the effect of ‘print-circle’ being t pertains to
> all sharing, not just sharing that leads to circles.  And that has the
> effect, that the output can become arbitrarily unreadable.  Consider
> for example:
> 
>   (require 'ispell)
>   (ispell-set-spellchecker-params)
>   (describe-variable 'ispell-dictionary-alist)
> 
> The display of the value in my machine contains, e.g., "(nil #1# #2# #3#
> t #4# nil utf-8)".
> 
> I do not see the reason for hard-coding ‘print-circle’ to t in
> ‘describe-variable’.  The only reason I can imagine would be the
> prevention of infinite loops.  But that cannot be the case, because
> even with ‘print-circle’ nil, the printing routines seem to check for
> circularity and handle it gracefully in the output.
> 
> Is this a bug or a necessity that I do not understand, yet?
> 
> The NEWS file does not mention this change.
> 
> In general (and somewhat unrelated), it would be nice if ‘print-circle’
> would be split into two things: (1) make explicit all sharing (as is
> done now), and (2) make explicit only a subset of sharing that resolves
> all circles.  (The latter would in at least two aspects still be
> different from the graceful handling mentioned above when ‘print-circle’
> is nil.)

Adding Stefan to the discussion.