[slime-cvs] CVS slime

heller heller at common-lisp.net
Thu Aug 23 13:56:24 UTC 2007


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

Modified Files:
	ChangeLog slime.el swank-backend.lisp swank.lisp 
Log Message:
Some inspector cleanups.


--- /project/slime/cvsroot/slime/ChangeLog	2007/08/23 13:02:32	1.1147
+++ /project/slime/cvsroot/slime/ChangeLog	2007/08/23 13:56:22	1.1148
@@ -1,5 +1,24 @@
 2007-08-23  Helmut Eller  <heller at common-lisp.net>
 
+	Some inspector cleanups.
+
+	* slime.el (slime-inspect): Remove dwim stuff and drop keyword
+	args.
+	(slime-read-object): Killed.
+	(slime-open-inspector): Drop keyword args.  Update callers
+	accodordingly, expect presentation related code. Presentations no
+	longer work in the inspector.
+
+	* swank.lisp (*inspector-dwim-lookup-hooks*)
+	(default-dwim-inspector-lookup-hook): Deleted.
+	(init-inspector): Sanitize arglist.
+	(inspect-object): Don't return an :id for *inspectee-parts*.
+
+	* swank-backend (type-for-emacs): Removed. No backend implemented
+	it.
+
+2007-08-23  Helmut Eller  <heller at common-lisp.net>
+
 	* slime.el (slime-fuzzy-upgrade-notice): New function.  Bound to
 	the key where slime-fuzzy-complete-symbol used to be.
 
--- /project/slime/cvsroot/slime/slime.el	2007/08/23 13:02:32	1.801
+++ /project/slime/cvsroot/slime/slime.el	2007/08/23 13:56:22	1.802
@@ -8338,28 +8338,22 @@
 		      (lambda (result)
 			(slime-show-description result nil)))))
 
+
+
 (defun sldb-inspect-in-frame (string)
   "Prompt for an expression and inspect it in the selected frame."
-  (interactive (list (slime-read-object
-                      "Inspect in frame (evaluated): ")))
-  (slime-eval-async `(swank:inspect-in-frame ,string ,(sldb-frame-number-at-point))
-                    (with-lexical-bindings (slime-current-thread
-                                            slime-buffer-package)
-                      (lambda (thing)
-                        (slime-open-inspector thing
-                                              :thread slime-current-thread
-                                              :package slime-buffer-package)))))
+  (interactive (list (slime-read-from-minibuffer 
+                      "Inspect in frame (evaluated): " 
+                      (slime-sexp-at-point))))
+  (let ((number (sldb-frame-number-at-point)))
+    (slime-eval-async `(swank:inspect-in-frame ,string ,number)
+                      'slime-open-inspector)))
 
 (defun sldb-inspect-var ()
   (let ((frame (sldb-frame-number-at-point))
         (var (sldb-var-number-at-point)))
     (slime-eval-async `(swank:inspect-frame-var ,frame ,var) 
-                      (lexical-let ((thread slime-current-thread)
-                                    (package (slime-current-package)))
-                        (lambda (thing)
-                          (slime-open-inspector thing
-                                                :thread thread
-                                                :package package))))))
+                      'slime-open-inspector)))
 
 (defun sldb-inspect-condition ()
   "Inspect the current debugger condition."
@@ -8784,60 +8778,12 @@
 (defvar slime-inspector-mark-stack '())
 (defvar slime-saved-window-config)
 
-(defun* slime-inspect (form &key no-reset eval dwim-mode
-                            thread (package (slime-current-package)))
-  "Take an expression FORM and inspect it.
-If DWIM-MODE is non-nil (the interactive default), try to be
-smart about what was the intention.  Otherwise, if EVAL is
-non-nil (interactively, if invoked with a prefix argument),
-evaluate FORM and inspect the result.  Otherwise, inspect FORM
-itself."
-  (interactive
-   (multiple-value-bind (presentation start end)
-       (slime-presentation-around-point (point))
-     (if presentation
-         ;; Point is within a presentation, so don't prompt, just 
-         ;; inspect the presented object; don't play DWIM.
-         (cons (slime-presentation-expression presentation)
-               '(:eval t :dwim-mode nil))
-       ;; Not in a presentation, read form from minibuffer.
-       (cons (slime-read-object (if current-prefix-arg
-                                    "Inspect value (evaluated): "
-                                  "Inspect value (dwim mode): ")
-                                :return-names-unconfirmed (not current-prefix-arg))
-             (if current-prefix-arg
-                 '(:eval t :dwim-mode nil)
-               '(:eval nil :dwim-mode t))))))
-  (slime-eval-async `(swank:init-inspector ,form
-                                           :reset ,(not no-reset)
-                                           :eval ,eval
-                                           :dwim-mode ,dwim-mode)
-                    (with-lexical-bindings (thread package form)
-                      (lambda (thing)
-                        (if thing
-                            (slime-open-inspector thing
-                                                  :thread thread
-                                                  :package package)
-                            (message "Couldn't read anything from '%s' (hint: prefix for debugger with details)" form))))))
-
-(defun* slime-read-object (prompt &key return-names-unconfirmed
-                                  initial-value (history 'slime-read-expression-history))
-  "Read a Common Lisp expression from the minibuffer, providing
-defaults from the s-expression at point.  If point is within a
-presentation, don't prompt, just return the presentation."
-  (multiple-value-bind (presentation start end)
-      (slime-presentation-around-point (point))
-    (if presentation
-        (slime-presentation-expression presentation)
-        (let ((sexp (slime-sexp-at-point)))
-          (if (and sexp
-                   return-names-unconfirmed
-                   ;; an string with alphanumeric chars and hyphens only?
-                   (and (string-match "\\([-|.:0-9a-zA-Z]*\\)" sexp)
-                        (= (match-end 0) (length sexp))))
-              sexp
-            (slime-read-from-minibuffer prompt
-                                         (or initial-value sexp)))))))
+(defun slime-inspect (string)
+  "Eval an expression and inspect the result."
+  (interactive 
+   (list (slime-read-from-minibuffer "Inspect value (evaluated): "
+				     (slime-sexp-at-point))))
+  (slime-eval-async `(swank:init-inspector ,string) 'slime-open-inspector))
 
 (define-derived-mode slime-inspector-mode fundamental-mode "Slime-Inspector"
   (set-syntax-table lisp-mode-syntax-table)
@@ -8857,24 +8803,17 @@
 (defmacro slime-inspector-fontify (face string)
   `(slime-add-face ',(intern (format "slime-inspector-%s-face" face)) ,string))
 
-(defun* slime-open-inspector (inspected-parts &key point thread package)
+(defun slime-open-inspector (inspected-parts &optional point)
   "Display INSPECTED-PARTS in a new inspector window.
 Optionally set point to POINT."
   (with-current-buffer (slime-inspector-buffer)
     (setq slime-buffer-connection (slime-current-connection))
-    (when thread
-      (setq slime-current-thread thread))
-    (when package
-      (setq slime-buffer-package package))
     (let ((inhibit-read-only t))
       (erase-buffer)
-      (destructuring-bind (&key title type content id) inspected-parts
+      (destructuring-bind (&key title type content) inspected-parts
         (macrolet ((fontify (face string) 
-                     `(slime-inspector-fontify ,face ,string)))
-          (slime-propertize-region (list 'slime-part-number id
-                                         'mouse-face 'highlight
-                                         'face 'slime-inspector-action-face)
-            (slime-insert-presentation title `(:inspected-part ,id)))
+                            `(slime-inspector-fontify ,face ,string)))
+          (insert (fontify topline title))
           (while (eq (char-before) ?\n)
             (backward-delete-char 1))
           (insert "\n [" (fontify label "type:") " " (fontify type type) "]\n"
@@ -8882,12 +8821,11 @@
           (save-excursion 
             (mapc #'slime-inspector-insert-ispec content))
           (pop-to-buffer (current-buffer))
-          (when point 
-            (if (consp point)
-                (ignore-errors 
-                  (goto-line (car point))
-                  (move-to-column (cdr point)))
-                (goto-char (min (point-max) point)))))))))
+          (when point
+            (check-type point cons)
+            (ignore-errors 
+              (goto-line (car point))
+              (move-to-column (cdr point)))))))))
 
 (defun slime-inspector-insert-ispec (ispec)
   (if (stringp ispec)
@@ -8928,11 +8866,11 @@
         (opener (lexical-let ((point (slime-inspector-position)))
                   (lambda (parts)
                     (when parts
-                      (slime-open-inspector parts :point point))))))
+                      (slime-open-inspector parts point))))))
     (cond (part-number
            (slime-eval-async `(swank:inspect-nth-part ,part-number)
                              opener)
-           (push (point) slime-inspector-mark-stack))
+           (push (slime-inspector-position) slime-inspector-mark-stack))
           (action-number 
            (slime-eval-async `(swank::inspector-call-nth-action ,action-number)
                              opener)))))
@@ -8962,7 +8900,7 @@
    `(swank:inspector-pop)
    (lambda (result)
      (cond (result
-	    (slime-open-inspector result :point (pop slime-inspector-mark-stack)))
+	    (slime-open-inspector result (pop slime-inspector-mark-stack)))
 	   (t 
 	    (message "No previous object")
 	    (ding))))))
@@ -8971,7 +8909,7 @@
   (interactive)
   (let ((result (slime-eval `(swank:inspector-next))))
     (cond (result 
-	   (push (point) slime-inspector-mark-stack)
+	   (push (slime-inspector-position) slime-inspector-mark-stack)
 	   (slime-open-inspector result))
 	  (t (message "No next object")
 	     (ding)))))
@@ -9055,7 +8993,7 @@
   (slime-eval-async `(swank:inspector-reinspect)
                     (lexical-let ((point (slime-inspector-position)))
                       (lambda (parts)
-                        (slime-open-inspector parts :point point)))))
+                        (slime-open-inspector parts point)))))
 
 (slime-define-keys slime-inspector-mode-map
   ([return] 'slime-inspector-operate-on-point)
--- /project/slime/cvsroot/slime/swank-backend.lisp	2007/04/19 16:36:12	1.118
+++ /project/slime/cvsroot/slime/swank-backend.lisp	2007/08/23 13:56:22	1.119
@@ -38,7 +38,6 @@
            #:fancy-inspection
            #:label-value-line
            #:label-value-line*
-           #:type-for-emacs
            #:with-struct
            ))
 
@@ -890,20 +889,6 @@
   ` (append ,@(loop for (label value) in label-values
                     collect `(label-value-line ,label ,value))))
 
-(defgeneric type-for-emacs (object)
-  (:documentation
-   "Return a type specifier suitable for display in the Emacs inspector.")
-  (:method (object)
-    (type-of object))
-  (:method ((object integer))
-    ;; Some lisps report integer types as (MOD ...), which while nice
-    ;; in a sense doesn't answer the often more immediate question of
-    ;; fixnumness.
-    (if (typep object 'fixnum)
-        'fixnum
-        'bignum)))
-
-
 (definterface describe-primitive-type (object)
   "Return a string describing the primitive type of object."
   (declare (ignore object))
--- /project/slime/cvsroot/slime/swank.lisp	2007/08/23 12:58:52	1.492
+++ /project/slime/cvsroot/slime/swank.lisp	2007/08/23 13:56:22	1.493
@@ -40,7 +40,6 @@
            #:*default-worker-thread-bindings*
            #:*macroexpand-printer-bindings*
            #:*record-repl-results*
-           #:*inspector-dwim-lookup-hooks*
            #:*debug-on-swank-error*
            ;; These are re-exported directly from the backend:
            #:buffer-first-change
@@ -4828,62 +4827,10 @@
            (not (third form))
            (eq (first form) 'setf))))
 
-(defvar *inspector-dwim-lookup-hooks* '(default-dwim-inspector-lookup-hook)
-  "A list of funcallables with one argument. It can be used to register user hooks that look up various things when inspecting in dwim mode.")
-
-(defun default-dwim-inspector-lookup-hook (form)
-  (let ((result '()))
-    (when (and (symbolp form)
-               (boundp form))
-      (push (symbol-value form) result))
-    (when (and (valid-function-name-p form)
-               (fboundp form))
-      (push (fdefinition form) result))
-    (when (and (symbolp form)
-               (find-class form nil))
-      (push (find-class form) result))
-    (when (and (consp form)
-               (valid-function-name-p (first form))
-               (fboundp (first form)))
-      (push (eval form) result))
-    (values result (not (null result)))))
-
-(defslimefun init-inspector (string &key (reset t) (eval t) (dwim-mode nil))
+(defslimefun init-inspector (string)
   (with-buffer-syntax ()
-    (when reset
-      (reset-inspector))
-    (let* ((form (block reading
-                   (handler-bind
-                       ((error (lambda (e)
-                                 (declare (ignore e))
-                                 (when dwim-mode
-                                   (return-from reading 'nothing)))))
-                     (read-from-string string nil 'nothing))))
-           (value))
-      (unless (eq form 'nothing)
-        (setf value (cond
-                      (dwim-mode
-                       (let ((things (loop for hook :in *inspector-dwim-lookup-hooks*
-                                           for (result foundp) = (multiple-value-list
-                                                                     (funcall hook form))
-                                           when foundp
-                                           append (if (consp result)
-                                                      result
-                                                      (list result)))))
-                         (if (rest things)
-                             things
-                             (first things))))
-                      (eval (eval form))
-                      (t form)))
-        (when (and dwim-mode
-                   form
-                   value)
-          ;; push the form to the inspector stack, so you can go back to it
-          ;; with slime-inspector-pop if dwim missed the intention
-          (push form *inspector-stack*))
-        (inspect-object (if dwim-mode
-                            (or value form)
-                            value))))))
+    (reset-inspector)
+    (inspect-object (eval (read-from-string string)))))
 
 (defun print-part-to-string (value)
   (let ((string (to-string value))
@@ -4919,7 +4866,7 @@
 (defun action-part-for-emacs (label lambda refreshp)
   (list :action label (assign-index (list lambda refreshp)
                                     *inspectee-actions*)))
-  
+
 (defun inspect-object (object &optional (inspector (make-default-inspector)))
   (push (setq *inspectee* object) *inspector-stack*)
   (unless (find object *inspector-history*)
@@ -4927,12 +4874,10 @@
   (let ((*print-pretty* nil)            ; print everything in the same line
         (*print-circle* t)
         (*print-readably* nil))
-    (multiple-value-bind (title content)
-        (inspect-for-emacs object inspector)
+    (multiple-value-bind (title content) (inspect-for-emacs object inspector)
       (list :title title
-            :type (to-string (type-for-emacs object))
-            :content (inspector-content-for-emacs content)
-            :id (assign-index object *inspectee-parts*)))))
+            :type (to-string (type-of object))
+            :content (inspector-content-for-emacs content)))))
 
 (defslimefun inspector-nth-part (index)
   (aref *inspectee-parts* index))




More information about the slime-cvs mailing list