[slime-cvs] CVS slime

alendvai alendvai at common-lisp.net
Tue Dec 19 10:40:11 UTC 2006


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

Modified Files:
	slime.el swank.lisp 
Log Message:
FIX dwim inspecting to handle (setf some-fun) functions, too


--- /project/slime/cvsroot/slime/slime.el	2006/12/19 10:38:24	1.716
+++ /project/slime/cvsroot/slime/slime.el	2006/12/19 10:40:11	1.717
@@ -9109,7 +9109,7 @@
           (if (and sexp
                    return-names-unconfirmed
                    ;; an string with alphanumeric chars and hyphens only?
-                   (and (string-match "\\([\-|0-9|a-z|A-Z]*\\)" sexp)
+                   (and (string-match "\\([-|:0-9a-zA-Z]*\\)" sexp)
                         (= (match-end 0) (length sexp))))
               sexp
               (slime-read-from-minibuffer prompt sexp))))))
--- /project/slime/cvsroot/slime/swank.lisp	2006/12/19 10:32:26	1.431
+++ /project/slime/cvsroot/slime/swank.lisp	2006/12/19 10:40:11	1.432
@@ -4774,23 +4774,39 @@
         *inspectee-actions* (make-array 10 :adjustable t :fill-pointer 0)
         *inspector-history* (make-array 10 :adjustable t :fill-pointer 0)))
 
+(defun valid-function-name-p (form)
+  (or (and (not (null form))
+           (not (eq form t))
+           (symbolp form))
+      (and (consp form)
+           (second form)
+           (not (third form))
+           (eq (first form) 'setf))))
+
 (defslimefun init-inspector (string &key (reset t) (eval t) (dwim-mode nil))
   (with-buffer-syntax ()
     (when reset
       (reset-inspector))
     (let* ((form (read-from-string string))
            (value (cond (dwim-mode
-                         (typecase form
-                           (symbol (or (and (fboundp form)
-                                            (fdefinition form))
-                                       (and (boundp form)
-                                            (symbol-value form))
-                                       (find-class form nil)
-                                       form))
-                           (atom form)
-                           (t (if (fboundp (first form))
-                                  (eval form)
-                                  form))))
+                         ;; TODO: here we _may_ want to present the
+                         ;; multiple possibilities when available
+                         ;; instead of this hardcoded order.
+                         (cond ((and (symbolp form)
+                                     (boundp form))
+                                (symbol-value form))
+                               ((and (valid-function-name-p form)
+                                     (fboundp form))
+                                (fdefinition form))
+                               ((and (symbolp form)
+                                     (find-class form nil))
+                                (find-class form))
+                               ((atom form)
+                                form)
+                               (t (if (and (valid-function-name-p (first form))
+                                           (fboundp (first form)))
+                                      (eval form)
+                                      form))))
                         (eval (eval form))
                         (t form))))
       (when (and dwim-mode




More information about the slime-cvs mailing list