Skip to content

Instantly share code, notes, and snippets.

@fstamour
Created July 28, 2016 19:20
Show Gist options
  • Save fstamour/2d7569beaf42c0a0883dc0ae559c6638 to your computer and use it in GitHub Desktop.
Save fstamour/2d7569beaf42c0a0883dc0ae559c6638 to your computer and use it in GitHub Desktop.
(defun slime-eval-save-output (string)
"Evaluate STRING in Lisp and save the result in the kill ring."
(slime-eval-async `(swank:eval-and-grab-output ,string)
(lambda (result)
(cl-destructuring-bind (output value) result
(kill-new output)
(message "Evaluation finished; pushed output to kill ring.")))))
(defun lisp-eval-defun-in-kill-ring ()
(interactive)
(slime-eval-save-output (slime-defun-at-point)))
(global-set-key (kbd "C-M-z") 'lisp-eval-defun-in-kill-ring)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment