emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: print-circle and describe-variable


From: Chong Yidong
Subject: Re: print-circle and describe-variable
Date: Tue, 10 Apr 2007 12:13:16 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

"Lennart Borgman (gmail)" <address@hidden> writes:

>>>> I think you are seeing: 1) the side-effect result of `prin1' printing,
>>>> followed by 2) the returned value, printed normally. (#1=(2) #1#) is the
>>>> former; ((2) (2)) is the latter.
>>> But it is the output of (prin1 (list toto toto)), isn't it?
>>
>> I'm not sure what you mean (by "it" and by "the output", for instance).
>>
>> During the invocation of `prin1', the `print-circle' binding is in effect,
>> so (#1=(2) #1#) is what is printed (by the side effect of `prin1').
>>
>> The binding is finished after the expression evaluation, and that is when
>> the command loop prints the value that is returned by the expression.
>> Printing of this value is thus done using the default value of
>> `print-circle', nil, so you see ((2) (2)).
>
> Yes, but the let binding is in effect when printing the second toto
> too, or? The argument to print1 is (list toto toto).

No, the second list is the result of the `eval-expression', and
print-circle is not in effect there.

Here is another example:

  M-: (setq toto-list (let ((toto (list 2))) (list toto toto))) RET
  M-: (insert (format "%s" (let ((print-circle t)) (prin1 toto-list)))) RET
     => ((2) (2))
  M-: (let ((print-circle t)) (insert (format "%s" (prin1 toto-list)))) RET
     => (#1=(2) #1#)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]