Skip to content

Instantly share code, notes, and snippets.

@cbilson
Created May 24, 2013 15:24
Show Gist options
  • Save cbilson/5644295 to your computer and use it in GitHub Desktop.
Save cbilson/5644295 to your computer and use it in GitHub Desktop.
Sometimes I want to repeat the last eval when I have moved on to another location. Maybe there is a better way to do this, but I wanted to try using advice (1st time.)
(defvar *nrepl-last-eval-form* nil)
(defadvice nrepl-interactive-eval (after nrepl-remember-last-expression-eval (&optional form))
"Save the last expression evaluated so we can run it again later if we want."
(setq *nrepl-last-eval-form* form))
(ad-activate 'nrepl-interactive-eval)
(defun nrepl-repeat-interactive-eval ()
(interactive)
(if *nrepl-last-eval-form*
(nrepl-interactive-eval *nrepl-last-eval-form*)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment