From: Ihor Radchenko <yantar92@gmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, emacs-devel@gnu.org
Subject: Re: `unreadablep'
Date: Wed, 15 Dec 2021 19:39:10 +0800 [thread overview]
Message-ID: <877dc6t7vl.fsf@localhost> (raw)
In-Reply-To: <877dc6qft0.fsf@yahoo.com>
Po Lu <luangruo@yahoo.com> writes:
>> Do you imply that `print-unreadable-function' should return the new
>> value to be printed? If so, it is indeed more flexible. Passing the
>> unreadable value to the function would also be useful (e.g. we can print
>> buffer file name instead of buffer object).
>
> It would accept a function that is called to print characters, like the
> `printcharfun' argument to prin1.
I was confused by the name. `printcharfun' in prin1 can be a buffer, a
marker, etc. Doing the same for the `print-unreadable-function' makes it
tricky to implement. How does `print-unreadable-function' print into a
buffer or marker? It would be cumbersome to consider all such cases if
the user simply wants to print nil in place of unreadable objects.
If the `printcharfun' passed to `print-unreadable-function' is strictly
an ordinary function that does actual printing, I can see a problem with
circular objects. Consider something like
(#1=a #<unreadable> #2=b #1 #1 #2).
If the main print loop is not aware of what was printed by
`print-unreadable-function' and the function tries to print reference to
b, we may get incorrect object:
(#1=a b #2=b #1 #1 #2)
The object printed instead of unreadable value will break circular
structure.
Of course, the described problem will depend on the details of
implementation.
Best,
Ihor
next prev parent reply other threads:[~2021-12-15 11:39 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 7:49 `unreadablep' Lars Ingebrigtsen
2021-12-15 8:19 ` `unreadablep' Po Lu
2021-12-15 8:35 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 9:42 ` `unreadablep' Po Lu
2021-12-15 11:16 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 11:25 ` `unreadablep' Po Lu
2021-12-15 12:19 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 12:22 ` `unreadablep' Po Lu
2021-12-15 12:35 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 12:42 ` `unreadablep' Po Lu
2021-12-15 12:44 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 12:46 ` `unreadablep' Po Lu
2021-12-15 12:51 ` `unreadablep' Po Lu
2021-12-15 12:58 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 12:36 ` `unreadablep' Ihor Radchenko
2021-12-15 12:37 ` `unreadablep' Po Lu
2021-12-15 17:00 ` [External] : `unreadablep' Drew Adams
2021-12-15 8:35 ` `unreadablep' Ihor Radchenko
2021-12-15 9:51 ` `unreadablep' Po Lu
2021-12-15 10:20 ` `unreadablep' Ihor Radchenko
2021-12-15 10:21 ` `unreadablep' Ihor Radchenko
2021-12-15 10:21 ` `unreadablep' Po Lu
2021-12-15 10:36 ` `unreadablep' Ihor Radchenko
2021-12-15 10:44 ` `unreadablep' Po Lu
2021-12-15 11:12 ` `unreadablep' Ihor Radchenko
2021-12-15 11:16 ` `unreadablep' Po Lu
2021-12-15 11:39 ` Ihor Radchenko [this message]
2021-12-15 14:12 ` `unreadablep' Stefan Monnier
2021-12-16 5:48 ` `unreadablep' Lars Ingebrigtsen
2021-12-16 8:03 ` `unreadablep' Eli Zaretskii
2021-12-17 7:18 ` `unreadablep' Lars Ingebrigtsen
2021-12-16 15:35 ` `unreadablep' Qiantan Hong
2021-12-17 7:19 ` `unreadablep' Lars Ingebrigtsen
2021-12-15 15:32 ` `unreadablep' Steingold
2021-12-15 16:04 ` `unreadablep' Qiantan Hong
2021-12-15 16:09 ` `unreadablep' Steingold
2021-12-15 20:21 ` `unreadablep' Philipp Stephani
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=877dc6t7vl.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=luangruo@yahoo.com \
/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.