Skip to content
Browse files

Quit using swank helper functions in lein-swank.

  • Loading branch information...
1 parent ea89bf5 commit 6b274ffa706fd9ef684254ad00c8e9ff33e3957d @technomancy committed Mar 2, 2012
Showing with 19 additions and 16 deletions.
  1. +1 −1 lein-swank/project.clj
  2. +6 −7 lein-swank/src/leiningen/jack_in.clj
  3. +12 −8 lein-swank/src/leiningen/swank.clj
View
2 lein-swank/project.clj
@@ -1,3 +1,3 @@
-(defproject lein-swank "1.4.1"
+(defproject lein-swank "1.4.2-SNAPSHOT"
:description "A Leiningen plugin for launching a Swank server for Slime."
:eval-in-leiningen true)
View
13 lein-swank/src/leiningen/jack_in.clj
@@ -1,8 +1,7 @@
(ns leiningen.jack-in
(:require [clojure.java.io :as io]
[clojure.string :as string]
- [leiningen.swank :as swank]
- [swank.util.sys :as util])
+ [leiningen.swank :as swank])
(:import (java.security MessageDigest)))
(def ^:private payloads-file-name "swank_elisp_payloads.clj")
@@ -24,11 +23,11 @@
(let [feature (second (re-find #".*/(.*?).el$" resource))
checksum (subs (hex-digest resource) 0 8)
filename (format "%s-%s" feature checksum)
- basename (util/universal-path
- (-> (util/preferred-user-home-path)
- (io/file ".emacs.d" "swank" filename)
- (.getAbsolutePath)
- (.replaceAll "\\\\" "/")))
+ basename (-> (or (System/getenv "HOME")
+ (System/getProperty "user.home"))
+ (io/file ".emacs.d" "swank" filename)
+ (.getAbsolutePath)
+ (.replaceAll "\\\\" "/"))
elisp (str basename ".el")
bytecode (str basename ".elc")
elisp-file (io/file elisp)]
View
20 lein-swank/src/leiningen/swank.clj
@@ -46,18 +46,22 @@
(defn eval-in-project
"Support eval-in-project in both Leiningen 1.x and 2.x."
- [& args]
- (let [eip (or (try (require 'leiningen.core.eval)
- (resolve 'leiningen.core.eval/eval-in-project)
- (catch java.io.FileNotFoundException _))
- (try (require 'leiningen.compile)
- (resolve 'leiningen.compile/eval-in-project)
- (catch java.io.FileNotFoundException _)))]
- (apply eip args)))
+ [project form init]
+ (let [[eip two?] (or (try (require 'leiningen.core.eval)
+ [(resolve 'leiningen.core.eval/eval-in-project)
+ true]
+ (catch java.io.FileNotFoundException _))
+ (try (require 'leiningen.compile)
+ [(resolve 'leiningen.compile/eval-in-project)]
+ (catch java.io.FileNotFoundException _)))]
+ (if two?
+ (eip project form init)
+ (eip project form nil nil init))))
(defn swank
"Launch swank server for Emacs to connect. Optionally takes PORT and HOST."
([project port host & opts]
+ ;; TODO: only add the dependency if it's not already present
(eval-in-project (update-in (add-cdt-project-args project)
[:dependencies] conj ['swank-clojure "1.4.0"])
(swank-form project port host opts)))

0 comments on commit 6b274ff

Please sign in to comment.
Something went wrong with that request. Please try again.