[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Display an eieio object
From: |
Michael Heerdegen |
Subject: |
Re: Display an eieio object |
Date: |
Fri, 15 Jun 2018 05:53:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Joe Riel <joer@san.rr.com> writes:
> Is there a way to nicely display an eieio object? Using
> describe-variable (C-h v) shows the values but not the slot names,
> which makes it less than helpful.
Depends a bit on your Emacs version.
Since Emacs 26, C-h v uses the new cl-print.el to print variable values.
Eieio implements the cl-print-object method for eieio-objects, and that
just falls back to `object-print'. `object-print' also existed before
Emacs 26, but AFAIK it prints only a wrapper and no values at all. You
would need to reimplement the `object-print' method to do what you want,
probably looping over the `eieio-class-slots'. You can even use
different implementations for different classes - the infrastructure is
all there. If you have a recent enough Emacs version, C-v should
automatically use your method implementation(s).
Michael.