Hello,

At Sun, 15 Nov 2009 06:21:03 -0800 (PST),
Stefan Kamphausen wrote:
> 
> Hi,
> 
> a short discussion on the SLIME mailinglist lead to the result that
> the arglist of a backend function in swank did change.
> 
> Current checkouts of SLIME do not work with Clojure, at least if you
> use autodoc.
> 
> http://common-lisp.net/pipermail/slime-devel/2009-November/016919.html
> 
> I took a quick look at the relevant function (src/main/clojure/swank/
> commands/contrib/swank_arglists.clj) in swank-clojure but it would
> need some diving into the code for me to help with this.  Maybe
> someone more experienced than me can step in?

Not that I am experienced, but the problem is that the reader of
clojure doesn't allow double colons (::) and the percent-sign (%) has
a special meaning. For Common Lisp the double colon means a "private"
symbol of a package. I don't remember what the percent-sign means by
convention. So I have created a patch that replaces these illegal
character sequences. But that is of course not the right way to
go. The intention of the symbols needs to be preserved and I am not
quite sure how to do that. That would require some work with the slime
guys. I don't have time for that today so maybe somebody wants to pick
up from here.

Best regards

Robert

PS: Apologies if the patch is not in the format that you expect.

This patch is in the public domain.
diff --git a/src/main/clojure/swank/core/protocol.clj 
b/src/main/clojure/swank/core/protocol.clj
index 89f0890..8d4a44a 100644
--- a/src/main/clojure/swank/core/protocol.clj
+++ b/src/main/clojure/swank/core/protocol.clj
@@ -4,6 +4,20 @@
 
 ;; Read forms
 (def #^{:private true}
+     *percent-re* #"%")
+
+(defn- fix-percent
+  "Replace double colons with a /."
+  ([text] (.replaceAll (re-matcher *percent-re* text) "?")))
+
+(def #^{:private true}
+     *double-colon-re* #"::")
+
+(defn- fix-double-colon 
+  "Replace double colons with a /."
+  ([text] (.replaceAll (re-matcher *double-colon-re* text) "/")))
+
+(def #^{:private true}
      *namespace-re* #"(^\(:emacs-rex \([a-zA-Z][a-zA-Z0-9]+):")
 
 (defn- fix-namespace
@@ -50,7 +64,7 @@
   ([#^java.io.Reader reader]
      (let [len  (Integer/parseInt (read-chars reader 6 read-fail-exception) 16)
            msg  (read-chars reader len read-fail-exception)
-           form (read-string (fix-namespace msg))]
+           form (read-string (fix-namespace (fix-double-colon (fix-percent 
msg))))]
        (if (seq? form)
          (deep-replace {'t true} form)
          form))))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to