Skip to content

Instantly share code, notes, and snippets.

@dpsutton
Created October 26, 2020 15:14
Show Gist options
  • Save dpsutton/7556cf1f4ecfc97da7b7e9d6dbf210c6 to your computer and use it in GitHub Desktop.
Save dpsutton/7556cf1f4ecfc97da7b7e9d6dbf210c6 to your computer and use it in GitHub Desktop.
;; ‘C-x r s <register-key>’ save to register
;; 'C-c C-j x <register-key' to send to repl
(defun cider-insert-register-contents (register)
(interactive (list (register-read-with-preview "From register")))
(let ((form (get-register register)))
;; could put form into a buffer and check if its parens are
;; balanced
(if form
(cider-insert-in-repl form (not cider-invert-insert-eval-p))
(user-error "No saved form in register"))))
(define-key 'cider-insert-commands-map (kbd "x") #'cider-insert-register-contents)
(define-key 'cider-insert-commands-map (kbd "C-x") #'cider-insert-register-contents)
(define-key cider-repl-mode-map (kbd "C-c C-j") 'cider-insert-commands-map)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment