unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Display an eieio object
@ 2018-06-14 14:45 Joe Riel
  2018-06-15  1:18 ` Pierre Lorenzon
  2018-06-15  3:53 ` Michael Heerdegen
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Riel @ 2018-06-14 14:45 UTC (permalink / raw)
  To: Help GNU Emacs

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.

-- 
Joe Riel




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Display an eieio object
  2018-06-14 14:45 Display an eieio object Joe Riel
@ 2018-06-15  1:18 ` Pierre Lorenzon
  2018-06-15  3:53 ` Michael Heerdegen
  1 sibling, 0 replies; 4+ messages in thread
From: Pierre Lorenzon @ 2018-06-15  1:18 UTC (permalink / raw)
  To: joer; +Cc: help-gnu-emacs



Hi,

From: Joe Riel <joer@san.rr.com>
Subject: Display an eieio object
Date: Thu, 14 Jun 2018 07:45:08 -0700

> Is there a way to nicely display an eieio object?


  Depending where you want to launch the displaying from. By
  simply issuing a command from the interactive emacs ara I
  dont think so. By writing a small piece of code : everrything
  is possible ! In fact, more precisely the
  `eieio-customize-object' is appliable on every eieio object
  and display it in a readable form, not as C-h v does !

  But this method cannot be called interactively. Moreover it
  is subject to object definition. If slot customization has
  not been defined properly displaying can be very bad.

  You may say that `eieio-customize-object' is not the right
  method for you since you only want to see the object and not
  interact with it. Anway at least in my knowledge there is no
  weaker method that only allows to show the object without
  interacting with it.

  Notice that interaction is determined by all type of
  interactions provided by the widget package, since
  eieio-customize-object is based on the widget package.

  Regards

  Pierre


> Using describe-variable (C-h v) shows the
> values but not the slot names, which makes it less
> than helpful.
> 
> -- 
> Joe Riel
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Display an eieio object
  2018-06-14 14:45 Display an eieio object Joe Riel
  2018-06-15  1:18 ` Pierre Lorenzon
@ 2018-06-15  3:53 ` Michael Heerdegen
  2018-06-15 14:36   ` Joe Riel
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Heerdegen @ 2018-06-15  3:53 UTC (permalink / raw)
  To: Joe Riel; +Cc: Help GNU Emacs

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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Display an eieio object
  2018-06-15  3:53 ` Michael Heerdegen
@ 2018-06-15 14:36   ` Joe Riel
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Riel @ 2018-06-15 14:36 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help GNU Emacs

On Fri, 15 Jun 2018 05:53:29 +0200
Michael Heerdegen <michael_heerdegen@web.de> wrote:

> 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).

Thanks.  Having only recently upgraded to Emacs 25, it will probably
be a while until I can use that, but will plan accordingly.  


-- 
Joe Riel




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-15 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-14 14:45 Display an eieio object Joe Riel
2018-06-15  1:18 ` Pierre Lorenzon
2018-06-15  3:53 ` Michael Heerdegen
2018-06-15 14:36   ` Joe Riel

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).