From: Stefan Monnier <monnier@iro.umontreal.ca>
To: npostavs@users.sourceforge.net
Cc: emacs-devel@gnu.org
Subject: New pp (was: bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug)
Date: Sat, 11 Mar 2017 10:38:47 -0500 [thread overview]
Message-ID: <jwvwpbv25f6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87k27w8j2l.fsf@users.sourceforge.net> (npostavs's message of "Sat, 11 Mar 2017 00:43:14 -0500")
> I posted an initial draft at
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25122#21, I'm not seeing
> as much speedup as I'd hoped, though I haven't tried optimizing it yet.
Thanks. I answered there about the performance aspect.
> +(defun pp-prin1 (object &optional stream)
> + (let ((cl-print-readably nil)
> + (stream (make-pp-state (or stream standard-output))))
> + (pp--scan :open-block stream)
> + (prog1 (cl-prin1 object (cons :pprint stream))
^^^^^^^^^^^^^^^^^^^^^
Why not just pass `stream' since it's a struct and we can hence dispatch
based on its type?
> +;; fallback to standard `cl-print-object'.
> +(cl-defmethod cl-print-object (object (stream (head :pprint)))
> + (pp--scan (cl-prin1-to-string object) (cdr stream))
> + object)
Hmm... but if we use such a pseudo-stream here, doesn't it break all
calls to `princ' within other cl-print-object methods (i.e. forcing us
the override pretty much all existing cl-print-object methods with
a pprint-specific one)?
Stefan
next prev parent reply other threads:[~2017-03-11 15:38 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87pokampa4.fsf@ericabrahamsen.net>
[not found] ` <handler.25295.B.148304476023950.ack@debbugs.gnu.org>
[not found] ` <8760m2mmlq.fsf@ericabrahamsen.net>
[not found] ` <jwv8tqsdnwl.fsf-monnier+bug#25295@gnu.org>
[not found] ` <87lguq5r87.fsf@ericabrahamsen.net>
[not found] ` <jwvr34i2s8w.fsf-monnier+emacsbugs@gnu.org>
[not found] ` <jwvfuky2ran.fsf-monnier+emacsbugs@gnu.org>
[not found] ` <jwvshoyazvd.fsf-monnier+emacsbugs@gnu.org>
[not found] ` <878tp0i74g.fsf@users.sourceforge.net>
[not found] ` <jwvk28jmpl5.fsf-monnier+emacsbugs@gnu.org>
2017-03-02 5:36 ` Elisp printer (was: bug#25295: Represent eieio objects using object-print in backtraces and edebug) Michael Heerdegen
2017-03-02 6:38 ` Elisp printer Stefan Monnier
2017-03-03 2:14 ` Michael Heerdegen
2017-03-03 2:38 ` Stefan Monnier
2017-03-03 4:23 ` Michael Heerdegen
2017-03-06 2:50 ` Stefan Monnier
2017-03-08 4:09 ` Tom Tromey
2017-03-08 4:39 ` Stefan Monnier
2017-03-08 6:35 ` Tom Tromey
2017-03-08 9:43 ` Stefan Monnier
2017-03-08 18:17 ` Lars Brinkhoff
2017-03-08 23:02 ` Stefan Monnier
2017-03-09 15:12 ` Lars Brinkhoff
2017-03-14 9:52 ` User-defined record types Lars Brinkhoff
2017-03-14 12:28 ` Lars Brinkhoff
[not found] ` <86bmt42nk2.fsf_-_@molnjunk.nocrew.org>
[not found] ` <jwvzigoow0k.fsf-monnier+emacs@gnu.org>
2017-03-14 13:25 ` Lars Brinkhoff
2017-03-14 14:28 ` Lars Brinkhoff
2017-03-14 15:20 ` Stefan Monnier
2017-03-14 17:23 ` Lars Brinkhoff
2017-03-15 14:38 ` Stefan Monnier
2017-03-15 18:14 ` Lars Brinkhoff
2017-03-15 19:12 ` Stefan Monnier
2017-03-15 19:21 ` Lars Brinkhoff
2017-03-15 20:05 ` Stefan Monnier
2017-03-15 21:49 ` Lars Brinkhoff
2017-03-15 23:42 ` Stefan Monnier
2017-03-16 3:05 ` Stefan Monnier
2017-03-16 3:08 ` Stefan Monnier
2017-03-16 20:03 ` Lars Brinkhoff
2017-03-16 21:32 ` Stefan Monnier
2017-03-17 11:22 ` Lars Brinkhoff
2017-03-17 20:45 ` Lars Brinkhoff
2017-03-18 23:24 ` Stefan Monnier
2017-03-18 23:36 ` Stefan Monnier
2017-03-19 9:34 ` Lars Brinkhoff
2017-03-19 12:42 ` Stefan Monnier
[not found] ` <jwv7f48xjk4.fsf-monnier+bug#25295@gnu.org>
[not found] ` <87innrc03h.fsf@users.sourceforge.net>
[not found] ` <jwvbmtjajfz.fsf-monnier+emacs@gnu.org>
[not found] ` <87k27w8j2l.fsf@users.sourceforge.net>
2017-03-11 15:38 ` Stefan Monnier [this message]
2017-03-11 16:05 ` New pp (was: bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug) Noam Postavsky
2017-03-11 16:40 ` New pp Stefan Monnier
2017-03-11 16:52 ` Noam Postavsky
2017-03-11 16:57 ` Stefan Monnier
2017-03-12 13:31 ` Noam Postavsky
2017-03-12 14:06 ` Stefan Monnier
2017-03-12 16:13 ` Noam Postavsky
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvwpbv25f6.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=npostavs@users.sourceforge.net \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).