Skip to content

Instantly share code, notes, and snippets.

@marcoheisig
Last active January 14, 2021 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcoheisig/ddf35ad94e51fe9c3e5980759ef0fb70 to your computer and use it in GitHub Desktop.
Save marcoheisig/ddf35ad94e51fe9c3e5980759ef0fb70 to your computer and use it in GitHub Desktop.
Use Clouseau as the default inspector in Emacs.
;;;; Note: You should also put something like (ql:quickload :clouseau) in your initialization file.
(defun clouseau-inspect (string)
(interactive
(list (slime-read-from-minibuffer
"Inspect value (evaluated): "
(slime-sexp-at-point))))
(let ((inspector 'cl-user::*clouseau-inspector*))
(slime-eval-async
`(cl:progn
(cl:defvar ,inspector nil)
;; (Re)start the inspector if necessary.
(cl:unless (cl:and (clim:application-frame-p ,inspector)
(clim-internals::frame-process ,inspector))
(cl:setf ,inspector (cl:nth-value 1 (clouseau:inspect nil :new-process t))))
;; Tell the inspector to visualize the correct datum.
(cl:setf (clouseau:root-object ,inspector :run-hook-p t)
(cl:eval (cl:read-from-string ,string)))
;; Return nothing.
(cl:values)))))
(define-key slime-mode-map (kbd "C-c i") 'clouseau-inspect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment