technomancy / swank-clojure

Swank/slime support for clojure
Eclipse Public License 1.0
412 stars 83 forks source link

who-calls is failing as (:file meta (v)) is full path #101

Closed emkayonline closed 12 years ago

emkayonline commented 12 years ago

In swank.commands.xref/get-source-from-var (.getResourceAsStream) is used to get the source text. However, the result of (:file (meta v)) is a full file path name so the getReosurce is failing.

If the line is changed to:

    (when-let [strm (java.io.FileInputStream. filepath)]

Then who-calls works again with swank-clojure,

Martin

purcell commented 12 years ago

Are you looking up a var defined in your own code, or in a jar?

And with your modification, are you still able to query the source of a function for which the source is contained in a jar?

-Steve

emkayonline commented 12 years ago

You are right (That also explains my confusion that who-calls has worked occasionally).

Yes, I was looking up who-calls on a var defined in my own code, (for which my modification works), but if I look up a var defined in a jar then your code is needed.

Would it make sense to lookup in the jar, failing that, try and get the stream from the filesystem?

Thanks for your help,

Martin

tavisrudd commented 12 years ago

@emkayonline I just pushed a fix for this. Can you please try it out?

emkayonline commented 12 years ago

That is great. I've tried vars in my local source and vars in jars and both work well.

Thanks

Martin