[slime-cvs] CVS slime

trittweiler trittweiler at common-lisp.net
Fri Jul 4 22:55:30 UTC 2008


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv19869

Modified Files:
	slime.el 
Log Message:

* slime.el (slime-call-defun): Properly signal error message when
  used in a context that is not a function definition.


--- /project/slime/cvsroot/slime/slime.el	2008/07/04 21:56:23	1.942
+++ /project/slime/cvsroot/slime/slime.el	2008/07/04 22:55:29	1.943
@@ -5339,14 +5339,16 @@
              (insert function-call)
              (save-excursion (insert ")")))))           
     (let ((toplevel (slime-parse-toplevel-form)))
-      (destructure-case toplevel
-        (((:defun :defgeneric :defmacro :define-compiler-macro) symbol)
-         (insert-call symbol))
-        ((:defmethod symbol &rest args)
-         (declare (ignore args))
-         (insert-call symbol))
-        (t
-         (error "Not in a function definition"))))))
+      (if (symbolp toplevel)
+          (error "Not in a function definition")
+          (destructure-case toplevel
+            (((:defun :defgeneric :defmacro :define-compiler-macro) symbol)
+             (insert-call symbol))
+            ((:defmethod symbol &rest args)
+             (declare (ignore args))
+             (insert-call symbol))
+            (t
+             (error "Not in a function definition")))))))
 
 ;;;; Edit Lisp value
 ;;;
@@ -5585,11 +5587,12 @@
   (skip-syntax-forward " "))
 
 (defun slime-parse-toplevel-form ()
-  (save-excursion
-    (beginning-of-defun)
-    (down-list 1)
-    (forward-sexp 1)
-    (slime-parse-context (read (current-buffer)))))
+  (ignore-errors                        ; (foo)
+    (save-excursion
+      (beginning-of-defun)
+      (down-list 1)
+      (forward-sexp 1)
+      (slime-parse-context (read (current-buffer))))))
 		 
 (defun slime-arglist-specializers (arglist)
   (cond ((or (null arglist)




More information about the slime-cvs mailing list