[slime-devel] Enhanced slime-list-connections

Helmut Eller e9626484 at stud3.tuwien.ac.at
Thu Feb 26 20:37:23 UTC 2004


Peter Seibel <peter at javamonkey.com> writes:

> Okay, so you gave me commit privileges and I'm taking advantage of
> them. I just checked in a change that makes slime-list-connections a
> bit more useful: now you can use it to switch to the REPL (hit enter
> on the line you want) for a particular connection and to change the
> default connection (hit "d") on the appropriate line. "q" still gets
> you out of the buffer.

Nice!  I always wanted those commands, but was to lazy to write them.

> If someone wants to look over my change and let me know if I violated
> any SLIME norms that'd be fine.

The only thing I don't like is this:

+(defun slime-extract-type-name-from-line ()
+  (save-excursion
+    (beginning-of-line)
+    (search-forward-regexp "[0-9]\\s *\\([0-9a-zA-Z]+\\)")
+    (match-string 1)))

Try to avoid regexps, if you can.  "Text properties" are the Emacs way
of adding auxiliary data to regions.  You should define a text
property, say 'slime-connection', and set it for each line when you
initialize the buffer with something like

  (add-text-properties line-start line-end 'slime-connection <connection>)

To extract the connection for the line you can then use
(get-text-property (point) 'slime-connection).  The debugger code or
the apropos command contain plenty of examples for text properties.

Helmut.




More information about the slime-devel mailing list