[slime-cvs] CVS update: slime/slime.el
Matthias Koeppe
mkoeppe at common-lisp.net
Sun Aug 14 15:42:17 UTC 2005
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv5841
Modified Files:
slime.el
Log Message:
(slime-repl-insert-prompt): Don't take the negative of
the id.
(slime-presentation-expression): New, take care to handle
arbitrary *read-base* settings.
(reify-old-output): Use it here.
(slime-read-object): Use it here.
Date: Sun Aug 14 17:42:15 2005
Author: mkoeppe
Index: slime/slime.el
diff -u slime/slime.el:1.523 slime/slime.el:1.524
--- slime/slime.el:1.523 Fri Aug 12 22:51:42 2005
+++ slime/slime.el Sun Aug 14 17:42:14 2005
@@ -3012,7 +3012,7 @@
(loop
for res in result
for index from 0
- do (insert-result res (cons (- slime-current-output-id) index))))
+ do (insert-result res (cons slime-current-output-id index))))
(string
(unless (string= result "")
(insert-result result nil)))))
@@ -3069,23 +3069,32 @@
slime-repl-input-end-mark)))
(reify-old-output str-props str-no-props)))
+(defun slime-presentation-expression (presentation)
+ "Return a string that contains a CL s-expression accessing
+the presented object."
+ (let ((id (slime-presentation-id presentation)))
+ ;; Make sure it works even if *read-base* is not 10.
+ (cond
+ ((and (consp id) (integerp (car id)) (integerp (cdr id)))
+ (format "(swank:get-repl-result '(#10r%d . #10r%d))" (car id) (cdr id)))
+ ((integerp id)
+ (format "(swank:get-repl-result #10r%d)" id))
+ (t
+ (slime-prin1-to-string
+ `(swank:get-repl-result ',id))))))
+
(defun reify-old-output (str-props str-no-props)
(let ((pos (slime-property-position 'slime-repl-presentation str-props)))
(if (null pos)
str-no-props
(multiple-value-bind (presentation start-pos end-pos whole-p)
(slime-presentation-around-point pos str-props)
- (let ((id (slime-presentation-id presentation)))
- (concat (substring str-no-props 0 pos)
- ;; Eval in the reader so that we play nice with quote.
- ;; -luke (19/May/2005)
- "#." (slime-prin1-to-string
- (if (consp id)
- `(cl:nth ,(cdr id)
- (swank:get-repl-result ,(car id)))
- `(swank:get-repl-result ,id)))
- (reify-old-output (substring str-props end-pos)
- (substring str-no-props end-pos))))))))
+ (concat (substring str-no-props 0 pos)
+ ;; Eval in the reader so that we play nice with quote.
+ ;; -luke (19/May/2005)
+ "#." (slime-presentation-expression presentation)
+ (reify-old-output (substring str-props end-pos)
+ (substring str-no-props end-pos)))))))
(defun slime-property-position (text-property &optional object)
"Return the first position of TEXT-PROPERTY, or nil."
@@ -7774,14 +7783,11 @@
(defun slime-read-object (prompt)
(multiple-value-bind (presentation start end)
(slime-presentation-around-point (point))
- (let ((id (and presentation (slime-presentation-id presentation))))
- (if id
- (if (consp id)
- `(swank:init-inspector ,(format "(cl:nth #10r%d (swank:get-repl-result #10r%d))" (cdr id) (car id)))
- `(swank:init-inspector ,(format "(swank:get-repl-result %S)" id)))
- `(swank:init-inspector
- ,(slime-read-from-minibuffer "Inspect value (evaluated): "
- (slime-sexp-at-point)))))))
+ `(swank:init-inspector
+ ,(if presentation
+ (slime-presentation-expression presentation)
+ (slime-read-from-minibuffer "Inspect value (evaluated): "
+ (slime-sexp-at-point))))))
(define-derived-mode slime-inspector-mode fundamental-mode "Slime-Inspector"
(set-syntax-table lisp-mode-syntax-table)
More information about the slime-cvs
mailing list