[slime-devel] eval compile dwim
jan
janmar at iprimus.com.au
Fri Dec 5 02:30:21 UTC 2003
I don't like jumping back and forth between a buffer and the repl when
testing small snippets of code, I prefer to temporarily insert them
into the buffer and eval them in place.
This creates problems in slime because some features (who-calls,
compiler notes) only work properly with compilation, which means I
have to use both eval and compile for this strategy to be effective.
This leads to errors when done manually so I defined this function:
(defun slime-eval/compile-defun-dwim (&optional arg)
"Call the computation command you want (Do What I Mean).
Look at defun and determine whether to call `slime-eval-defun' or
`slime-compile-defun'.
A prefix of `-' forces evaluation, any other prefix forces
compilation."
(interactive "P")
(case arg
;; prefix is `-', evaluate defun
('- (slime-eval-defun))
;; no prefix, automatically determine action
('nil (if (string-match "^(def" (slime-defun-at-point))
(slime-compile-defun)
(slime-eval-defun)))
;; prefix is not `-', compile defun
(otherwise (slime-compile-defun))))
I use this command all the time so I bind it on M-j. This is bound to
indent-new-comment-line by default but it isn't missed since it is
also bound on C-M-j. Having the command bound on a Meta key is useful
because I don't have to release Meta to M-n or M-p if I get compiler
notes.
I thought this might be helpful, but maybe I'm missing something.
How do other people typically interact with lisp?
What are the most commonly used commands?
--
jan
More information about the slime-devel
mailing list