[slime-cvs] CVS update: slime/slime.el

Helmut Eller heller at common-lisp.net
Sat Dec 6 08:06:23 UTC 2003


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv3486

Modified Files:
	slime.el 
Log Message:
slime-eval/compile-defun-dwim: New command.  Suggested by "jan".

Date: Sat Dec  6 03:06:22 2003
Author: heller

Index: slime/slime.el
diff -u slime/slime.el:1.129 slime/slime.el:1.130
--- slime/slime.el:1.129	Thu Dec  4 16:30:35 2003
+++ slime/slime.el	Sat Dec  6 03:06:22 2003
@@ -2832,6 +2832,28 @@
          (princ result buffer)
          (insert "\n"))))))
 
+(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) (let ((form (slime-defun-at-point)))
+             (cond ((string-match "^(defvar " form)
+                    (slime-re-evaluate-defvar form))
+                   ((string-match "^(def" form)
+                    (slime-compile-defun))
+                   (t
+                    (slime-eval-defun)))))
+    ;; prefix is not `-', compile defun
+    (otherwise (slime-compile-defun))))
+
 (defun slime-toggle-trace-fdefinition (fname-string)
   "Toggle trace for FNAME-STRING."
   (interactive (list (slime-completing-read-symbol-name 





More information about the slime-cvs mailing list