Permalink
Browse files

(apply str (interpose "." (repeat 3 "1")))

  • Loading branch information...
1 parent 14aa2e5 commit 5c9d592180d7d2c97dd9cfa0e089902b7e3580ef @technomancy committed Apr 26, 2011
Showing with 39 additions and 14 deletions.
  1. +38 −13 README.md
  2. +1 −1 project.clj
View
@@ -30,11 +30,11 @@ surgeon required.
For this you will need to add Slamhound in both :dependencies and
:dev-dependencies:
- [slamhound "1.1.0"]
+ [slamhound "1.1.1"]
Then run from the command line:
- $ cat src/my/namespace # before: ns form is missing clauses
+ $ cat src/my/namespace.clj # before: ns form is missing clauses
(ns my.namespace
"I have a docstring.")
@@ -44,29 +44,54 @@ Then run from the command line:
(io/copy (ByteArrayInputStream. (.getBytes "hello"))
(first args)))
- $ lein slamhound src/my/namespace.clj # after: spits out new form
+ $ lein slamhound src/my/namespace.clj # after: spits out new ns form
(ns my.namespace
"I have a doc string."
(:use [clojure.pprint :only [pprint]])
(:require [clojure.java.io :as io])
(:import (java.io ByteArrayInputStream)))
+For large projects, it can be slow to re-run from the command-line
+since it has to load every namespace on the classpath for every
+invocation. The interactive task can mitigate this:
+
+ $ lein int
+ Welcome to Leiningen. Type help for a list of commands.
+ lein> slamhound src/my/namespace.clj
+ [...]
+
+The first run will be slower, but successive runs will be quick.
+
+## Repl Usage
+
+You can also use any repl:
+
+ user=> (use 'slam.hound)
+ nil
+ user=> (reconstruct "src/my/namespace.clj")
+ (ns my.namespace
+ "I have a doc string."
+ (:use [clojure.pprint :only [pprint]])
+ (:require [clojure.java.io :as io])
+ (:import (java.io ByteArrayInputStream)))
+
## Emacs Usage
-For this, it only needs to be in :dependencies. Once it's in, start a
-Slime session. Then add this defun to your Emacs config:
+Add this definition to your Emacs config, then start a slime session.
(defun slamhound ()
(interactive)
- (goto-char (point-min))
- (kill-sexp)
- (insert (first (slime-eval `(swank:eval-and-grab-output
- (format "(do (require 'slam.hound)
- (slam.hound/reconstruct \"%s\"))"
- ,buffer-file-name))))))
-
-Then you'll be able to run M-x slamhound to reconstruct your ns form.
+ (let ((result (first (slime-eval `(swank:eval-and-grab-output
+ (format "(do (require 'slam.hound)
+ (slam.hound/reconstruct \"%s\"))"
+ ,buffer-file-name))))))
+ (goto-char (point-min))
+ (kill-sexp)
+ (insert result)))
+
+Then you'll be able to run M-x slamhound to reconstruct your ns
+form. This also avoids the startup penalty.
## The Rules
View
@@ -1,4 +1,4 @@
-(defproject slamhound "1.1.1-SNAPSHOT"
+(defproject slamhound "1.1.1"
:description
"Rips your ns form apart and reconstructs it. We have the technology."
:dev-dependencies [[lein-difftest "1.3.1"]]

0 comments on commit 5c9d592

Please sign in to comment.