Last active
January 14, 2021 16:16
-
-
Save marcoheisig/ddf35ad94e51fe9c3e5980759ef0fb70 to your computer and use it in GitHub Desktop.
Use Clouseau as the default inspector in Emacs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; 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