Created
September 7, 2009 17:24
-
-
Save nonsequitur/182461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/src/swank-clojure/swank/commands/basic.clj:299 | |
The following function is used in slime-edit-definition. | |
It blows up on namespace 'user' and thus thwarts jumping to | |
definitions in the user namespace. | |
(defn- namespace-to-path [ns] | |
(let [#^String ns-str (name (ns-name ns))] | |
(-> ns-str | |
(.substring 0 (.lastIndexOf ns-str ".")) <------ 'user' contains no '.' | |
(.replace \- \_) | |
(.replace \. \/)))) | |
My amateurish fix: | |
(defn- namespace-to-path [ns] | |
(let [#^String ns-str (name (ns-name ns))] | |
(let [last-dot (.lastIndexOf ns-str ".")] | |
(when (pos? last-dot) | |
(-> ns-str | |
(.substring 0 last-dot) | |
(.replace \- \_) | |
(.replace \. \/)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment