I've been working with some org export engine code which passes around some rather large and complex list objects. It's rather tedious to explore an object by reading through a long word-wrapped printed representation of an object or iteratively writing and evaluating accessors in the scratch buffer. I and am wondering if there are any good methods for interactively examining values.

Take for example: many IDE's that present object values in an interactive tree view which permits incrementally expanding keys/values. The object is persistently shown on the screen and can be examined without much concern about the value types being viewed. A random screenshot of Chrome developer tools as illustration:

Chrome developer tools object view

Other tools present values as navigable popovers (functionally very similar). A random screenshot from Visual Studio:

Visual Studio datatip

Is there anything similar for emacs lisp? Perhaps something built into edebug or provided by another package? Or is this just waiting to be developed?

Note: I discovered pp and pp+ shortly after posting this question. The formatting is incredibly helpful in visually navigating object structure. It saves needing to modify print-length and print-depth to extreme values and formatting the output in a separate buffer.

  • Perhaps library hide-show.el helps in this regard.
    – Drew
    May 20 '16 at 4:59
  • 3
    @ebpa If pp and pp+ do what you want, then you can add that as your own solution and mark it as an answer in few days. May 20 '16 at 13:49
  • @Drew I provided an answer with the pp+-based solution. I haven't been entirely satisfied with it though. I'll update my answer when I publish a better alternative.
    – ebpa
    Oct 15 '17 at 20:42

I found the function pp-eval-last-sexp-with-tooltip in the pp+ package is a great general-purpose solution for this. It is effectively the same as eval-last-sexp, but neatly formats the return value and displays it as a tooltip. Values larger than pp-max-tooltip-size (x-max-tooltip-size) are shown in a separate window.

I have it bound to C-x C-e at the moment:

(require 'pp+)
(define-key global-map (kbd "C-x C-e") #'pp-eval-last-sexp-with-tooltip)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.