[slime-devel] Re: sbcl, threads and connections

Christophe Rhodes csr21 at cam.ac.uk
Sat Mar 18 07:54:22 UTC 2006


Helmut Eller <heller at common-lisp.net> writes:

> * Christophe Rhodes [2006-03-17 19:21+0100] writes:
>
>> What should I be looking at?
>
> swank-debugger-hook needs something similar. Either you pass the
> connection from the parent thread down to the child or you use the
> default connection like so:
>
> (sb-thread:make-thread 
>   (lambda ()   
>     (with-connection ((default-connection))
>       (swank:ed-in-emacs 'and))))

Thank you.

Would something like the attached patch be acceptable?  (The intent is
to have swank:ed-in-emacs "just work" as a function that can be used
as CL:ED).

-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /project/slime/cvsroot/slime/ChangeLog,v
retrieving revision 1.859
diff -u -r1.859 ChangeLog
--- ChangeLog	16 Mar 2006 18:33:25 -0000	1.859
+++ ChangeLog	18 Mar 2006 07:49:55 -0000
@@ -1,3 +1,13 @@
+2006-03-18  Christophe Rhodes <csr21 at cam.ac.uk>
+
+	* swank.lisp (ed-in-emacs): Allow conses as function names.
+	Ensure that there is a connection to emacs before sending the
+	:ed message.
+
+	* slime.el (slime-edit-definition): read names, not symbols.
+	(slime-ed): handle conses whose car is not a string as function
+	names.
+
 2006-03-16  G?bor Melis <mega at hotpop.com>
 
 	* swank-allegro.lisp (inspect-for-emacs): Fix typo.
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.597
diff -u -r1.597 slime.el
--- slime.el	16 Mar 2006 12:51:08 -0000	1.597
+++ slime.el	18 Mar 2006 07:49:59 -0000
@@ -6214,10 +6214,10 @@
   dspec location)
 
 (defun slime-edit-definition (name &optional where)
-  "Lookup the definition of the symbol at point.  
-If there's no symbol at point, or a prefix argument is given, then the
+  "Lookup the definition of the name at point.  
+If there's no name at point, or a prefix argument is given, then the
 function name is prompted."
-  (interactive (list (slime-read-symbol-name "Symbol: ")))
+  (interactive (list (slime-read-symbol-name "Name: ")))
   (let ((definitions (slime-eval `(swank:find-definitions-for-emacs ,name))))
     (if (null definitions)
         (if slime-edit-definition-fallback-function
@@ -6358,7 +6358,7 @@
 WHAT can be:
   A filename (string),
   A list (FILENAME LINE [COLUMN]),
-  A function name (symbol),
+  A function name (symbol or cons),
   nil.
 
 This for use in the implementation of COMMON-LISP:ED."
@@ -6371,7 +6371,7 @@
       (select-frame slime-ed-frame))
     (cond ((stringp what)
            (find-file (slime-from-lisp-filename what)))
-          ((consp what)
+          ((and (consp what) (stringp (first what)))
            (find-file (first (slime-from-lisp-filename what)))
            (goto-line (second what))
            ;; Find the correct column, without going past the end of
@@ -6383,6 +6383,8 @@
                (forward-char 1))))
           ((and what (symbolp what))
            (slime-edit-definition (symbol-name what)))
+          ((consp what)
+           (slime-edit-definition (prin1-to-string what)))
           (t nil))))                    ; nothing in particular
 
 
Index: swank.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank.lisp,v
retrieving revision 1.364
diff -u -r1.364 swank.lisp
--- swank.lisp	18 Mar 2006 07:37:22 -0000	1.364
+++ swank.lisp	18 Mar 2006 07:50:00 -0000
@@ -2170,7 +2170,7 @@
 WHAT can be:
   A pathname or a string,
   A list (PATHNAME-OR-STRING LINE [COLUMN]),
-  A function name (symbol),
+  A function name (symbol or cons),
   NIL.
 
 Returns true if it actually called emacs, or NIL if not."
@@ -2182,8 +2182,13 @@
                  ((pathname-or-string-p what)
                   (canonicalize-filename what))
                  ((symbolp what) what)
+                 ((consp what) what)
                  (t (return-from ed-in-emacs nil)))))
-      (send-oob-to-emacs `(:ed ,target))
+      (cond
+        (*emacs-connection* (send-oob-to-emacs `(:ed ,target)))
+        ((default-connection)
+         (with-connection ((default-connection))
+           (send-oob-to-emacs `(:ed ,target)))))
       t)))
 
 (defslimefun value-for-editing (form)
-------------- next part --------------

Cheers,

Christophe


More information about the slime-devel mailing list