mmontone / emacs-inspector

Inspection tool for Emacs Lisp objects.
GNU General Public License v3.0
107 stars 9 forks source link
debugging debugging-tool emacs emacs-lisp tools

EMACS-INSPECTOR

elpa-badge

Overview

Inspector tool for Emacs Lisp objects.

Similar to inspectors available for Smalltalk and Common Lisp, but for Emacs Lisp.

Also see: Emacs Tree Inspector tool.

emacs-inspector.png

Installation

This package is available from ELPA.

M-x package-install RET inspector RET

Usage

Invocation

Inside the inspector

Also, M-x forward-button and M-x backward-button are conveniently bound to n and p. They can be used for fast navigation across the buttons that the inspector displays.

Finally, you can use M-x eval-expression bound to letter e, to evaluate an elisp expression using the object currently being inspected (it is bound to *).

From the Emacs debugger

When on an Emacs debugging backtrace, press letter i to inspect the pointed frame and its local variables.

When on edebug-mode, use C-c C-i for inspecting expressions in the debugger.

Setup evaluation commands using prefix arguments

Instead of bothering setting up different key bindings for elisp evaluation and inspection, it can be handy to have both in the same command, and use prefix arguments to differenciate, like this:

(defun eval-or-inspect-expression (arg)
  "Like `eval-expression', but also inspect when called with prefix ARG."
  (interactive "P")
  (pcase arg
    ('(4) (let ((current-prefix-arg nil))
        (call-interactively #'inspector-inspect-expression)))
    (_ (call-interactively #'eval-expression))))

(defun eval-or-inspect-last-sexp (arg)
  "Like `eval-last-sexp', but also inspect when called with prefix ARG."
  (interactive "P")
  (pcase arg
    ('(4) (inspector-inspect-last-sexp))
    (_ (call-interactively #'eval-last-sexp))))

Setup key bindings:

(define-key global-map [remap eval-last-sexp] #'eval-or-inspect-last-sexp)
(define-key global-map [remap eval-expression] #'eval-or-inspect-expression)

and then use C-u C-x C-e and C-u M-: as alternatives to eval-last-sexp and eval-expression.

For evil/vim user

API

Customisation groups

Customisations

Functions

Variables

Faces