Commits

Tavis Rudd  committed 8fbe5fa

add

  • Participants
  • Parent commits 847cd42

Comments (0)

Files changed (5)

File vendor/cljdoc.el

+;;; cljdoc.el --- eldoc mode for clojure
+
+;; Copyright (C) 2011 tomykaira
+
+;; Version 0.1.0
+;; Keywords: eldoc clojure
+;; Author: tomykaira <tomykaira@gmail.com>
+;; URL: https://gist.github.com/1386472
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Installation
+
+;; Based on http://www.ne.jp/asahi/alpha/kazu/pub/emacs/phpdoc.el
+;; document is scraped with https://gist.github.com/1386449
+
+;;; Code:
+
+(require 'eldoc)
+(require 'clojure-mode)
+
+(defun cljdoc-localize-documentation-function ()
+  (set (make-local-variable 'eldoc-documentation-function)
+       'cljdoc-message))
+
+(defun cljdoc-message ()
+  (if (slime-background-activities-enabled-p)
+      (progn
+        (when (slime-background-activities-enabled-p)
+          (slime-echo-arglist))
+        nil)
+    (or (cljdoc-get-docstring (car (cljdoc-fnsym-in-current-sexp)))
+        (cljdoc-get-docstring (cljdoc-current-symbol)))))
+
+(defun cljdoc-current-symbol ()
+  (let ((c (char-after (point))))
+    (and c
+         (memq (char-syntax c) '(?w ?_))
+         (current-word))))
+
+(defun cljdoc-fnsym-in-current-sexp ()
+  (save-excursion
+    (let ((argument-index (1- (eldoc-beginning-of-sexp))))
+      ;; If we are at the beginning of function name, this will be -1.
+      (when (< argument-index 0)
+        (setq argument-index 0))
+      ;; Don't do anything if current word is inside a string.
+      (if (= (or (char-after (1- (point))) 0) ?\")
+          nil
+        (list (cljdoc-current-symbol) argument-index)))))
+
+(defun cljdoc-get-docstring (sym)
+  (let ((doc (cdr (assoc-string sym cljdoc-alist))))
+    (if doc
+        (concat (car (split-string doc ")"))
+                ")"))))
+
+(add-hook 'clojure-mode-hook 'cljdoc-localize-documentation-function)
+(add-hook 'clojure-mode-hook 'eldoc-mode)
+
+(defvar cljdoc-alist
+  '(("*" . "(* x y & more) Returns the product of nums. (*) returns 1. Does not auto-promote longs, will throw on overflow. See also: *'")
+("*'" . "(*' x y & more) Returns the product of nums. (*) returns 1. Supports arbitrary precision. See also: *")
+("+" . "(+ x y & more) Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'")
+("+'" . "(+' x y & more) Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +")
+("-" . "(- x y & more) If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the result. Does not auto-promote longs, will throw on overflow. See also: -'")
+("-'" . "(-' x y & more) If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the result. Supports arbitrary precision. See also: -")
+("->" . "(-> x form & more) Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.")
+("->>" . "(->> x form & more) Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc.")
+(".." . "(.. x form & more) form => fieldName-symbol or (instanceMethodName-symbol args*)  Expands into a member access (.) of the first member on the first argument, followed by the next member on the result, etc. For instance:  (.. System (getProperties) (get \"os.name\"))  expands to:  (. (. System (getProperties)) (get \"os.name\"))  but is easier to write, read, and understand.")
+("/" . "(/ x y & more) If no denominators are supplied, returns 1/numerator, else returns numerator divided by all of the denominators.")
+("<" . "(< x y & more) Returns non-nil if nums are in monotonically increasing order, otherwise false.")
+("<=" . "(<= x y & more) Returns non-nil if nums are in monotonically non-decreasing order, otherwise false.")
+("=" . "(= x y & more) Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner.  Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison.")
+("==" . "(== x y & more) Returns non-nil if nums all have the equivalent value (type-independent), otherwise false")
+(">" . "(> x y & more) Returns non-nil if nums are in monotonically decreasing order, otherwise false.")
+(">=" . "(>= x y & more) Returns non-nil if nums are in monotonically non-increasing order, otherwise false.")
+("accessor" . "(accessor s key) Returns a fn that, given an instance of a structmap with the basis, returns the value at the key.  The key must be in the basis. The returned function should be (slightly) more efficient than using get, but such use of accessors should be limited to known performance-critical areas.")
+("aclone" . "(aclone array) Returns a clone of the Java array. Works on arrays of known types.")
+("add-classpath" . "(add-classpath url) DEPRECATED   Adds the url (String or URL object) to the classpath per URLClassLoader.addURL")
+("add-watch" . "(add-watch reference key fn) Alpha - subject to change. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any registered watches will have their functions called. The watch fn will be called synchronously, on the agent's thread if an agent, before any pending sends if agent or ref. Note that an atom's or ref's state may have changed again prior to the fn call, so use old/new-state rather than derefing the reference. Note also that watch fns may be called from multiple threads simultaneously. Var watchers are triggered only by root binding changes, not thread-local set!s. Keys must be unique per reference, and can be used to remove the watch with remove-watch, but are otherwise considered opaque by the watch mechanism.")
+("agent" . "(agent state & options) Creates and returns an agent with an initial value of state and zero or more options (in any order):  :meta metadata-map  :validator validate-fn  :error-handler handler-fn  :error-mode mode-keyword  If metadata-map is supplied, it will be come the metadata on the agent. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn should return false or throw an exception.  handler-fn is called if an action throws an exception or if validate-fn rejects a new state -- see set-error-handler! for details.  The mode-keyword may be either :continue (the default if an error-handler is given) or :fail (the default if no error-handler is given) -- see set-error-mode! for details.")
+("agent-error" . "(agent-error a) Returns the exception thrown during an asynchronous action of the agent if the agent is failed.  Returns nil if the agent is not failed.")
+("agent-errors" . "(agent-errors a) DEPRECATED: Use 'agent-error' instead. Returns a sequence of the exceptions thrown during asynchronous actions of the agent.")
+("aget" . "(aget array idx & idxs) Returns the value at the index/indices. Works on Java arrays of all types.")
+("alength" . "(alength array) Returns the length of the Java array. Works on arrays of all types.")
+("alias" . "(alias alias namespace-sym) Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly.")
+("all-ns)" . "(all-ns) Returns a sequence of all namespaces.")
+("alter" . "(alter ref fun & args) Must be called in a transaction. Sets the in-transaction-value of ref to:  (apply fun in-transaction-value-of-ref args)  and returns the in-transaction-value of ref.")
+("alter-meta!" . "(alter-meta! iref f & args) Atomically sets the metadata for a namespace/var/ref/agent/atom to be:  (apply f its-current-meta args)  f must be free of side-effects")
+("alter-var-root" . "(alter-var-root v f & args) Atomically alters the root binding of var v by applying f to its current value plus any args")
+("amap" . "(amap a idx ret expr) Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting  each element of ret to the evaluation of expr, returning the new  array ret.")
+("ancestors" . "(ancestors h tag) Returns the immediate and indirect parents of tag, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy")
+("and" . "(and x & next) Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true.")
+("apply" . "(apply f a b c d & args) Applies fn f to the argument list formed by prepending intervening arguments to args.")
+("areduce" . "(areduce a idx ret init expr) Reduces an expression across an array a, using an index named idx, and return value named ret, initialized to init, setting ret to the  evaluation of expr at each step, returning ret.")
+("array-map" . "(array-map & keyvals) Constructs an array-map.")
+("aset" . "(aset array idx idx2 & idxv) Sets the value at the index/indices. Works on Java arrays of reference types. Returns val.")
+("aset-boolean" . "(aset-boolean array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of boolean. Returns val.")
+("aset-byte" . "(aset-byte array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of byte. Returns val.")
+("aset-char" . "(aset-char array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of char. Returns val.")
+("aset-double" . "(aset-double array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of double. Returns val.")
+("aset-float" . "(aset-float array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of float. Returns val.")
+("aset-int" . "(aset-int array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of int. Returns val.")
+("aset-long" . "(aset-long array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of long. Returns val.")
+("aset-short" . "(aset-short array idx idx2 & idxv) Sets the value at the index/indices. Works on arrays of short. Returns val.")
+("assert" . "(assert x message) Evaluates expr and throws an exception if it does not evaluate to logical true.")
+("assoc" . "(assoc map key val & kvs) assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector).")
+("assoc!" . "(assoc! coll key val & kvs) Alpha - subject to change. When applied to a transient map, adds mapping of key(s) to val(s). When applied to a transient vector, sets the val at index. Note - index must be <= (count vector). Returns coll.")
+("assoc-in" . "(assoc-in m [k & ks] v) Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created.")
+("associative?" . "(associative? coll) Returns true if coll implements Associative")
+("atom" . "(atom x & options) Creates and returns an Atom with an initial value of x and zero or more options (in any order):  :meta metadata-map  :validator validate-fn  If metadata-map is supplied, it will be come the metadata on the atom. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn should return false or throw an exception.")
+("await" . "(await & agents) Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred.  Will block on failed agents.  Will never return if a failed agent is restarted with :clear-actions true.")
+("await-for" . "(await-for timeout-ms & agents) Blocks the current thread until all actions dispatched thus far (from this thread or agent) to the agents have occurred, or the timeout (in milliseconds) has elapsed. Returns nil if returning due to timeout, non-nil otherwise.")
+("bases" . "(bases c) Returns the immediate superclass and direct interfaces of c, if any")
+("bean" . "(bean x) Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties.")
+("bigdec" . "(bigdec x) Coerce to BigDecimal")
+("bigint" . "(bigint x) Coerce to BigInt")
+("biginteger" . "(biginteger x) Coerce to BigInteger")
+("binding" . "(binding bindings & body) binding => var-symbol init-expr  Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before.  The new bindings are made in parallel (unlike let); all init-exprs are evaluated before the vars are bound to their new values.")
+("bit-and" . "(bit-and x y & more) Bitwise and")
+("bit-and-not" . "(bit-and-not x y & more) Bitwise and with complement")
+("bit-clear" . "(bit-clear x n) Clear bit at index n")
+("bit-flip" . "(bit-flip x n) Flip bit at index n")
+("bit-not" . "(bit-not x) Bitwise complement")
+("bit-or" . "(bit-or x y & more) Bitwise or")
+("bit-set" . "(bit-set x n) Set bit at index n")
+("bit-shift-left" . "(bit-shift-left x n) Bitwise shift left")
+("bit-shift-right" . "(bit-shift-right x n) Bitwise shift right")
+("bit-test" . "(bit-test x n) Test bit at index n")
+("bit-xor" . "(bit-xor x y & more) Bitwise exclusive or")
+("boolean" . "(boolean x) Coerce to boolean")
+("boolean-array" . "(boolean-array size init-val-or-seq) Creates an array of booleans")
+("booleans" . "(booleans xs) Casts to boolean[]")
+("bound-fn" . "(bound-fn & fntail) Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place.")
+("bound-fn*" . "(bound-fn* f) Returns a function, which will install the same bindings in effect as in the thread at the time bound-fn* was called and then call f with any given arguments. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place.")
+("bound?" . "(bound? & vars) Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided.")
+("butlast" . "(butlast coll) Return a seq of all but the last item in coll, in linear time")
+("byte" . "(byte x) Coerce to byte")
+("byte-array" . "(byte-array size init-val-or-seq) Creates an array of bytes")
+("bytes" . "(bytes xs) Casts to bytes[]")
+("case" . "(case e & clauses) Takes an expression, and a set of clauses.  Each clause can take the form of either:  test-constant result-expr  (test-constant1 ... test-constantN)  result-expr  The test-constants are not evaluated. They must be compile-time literals, and need not be quoted.  If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can follow the clauses, and its value will be returned if no clause matches. If no default expression is provided and no clause matches, an IllegalArgumentException is thrown.  Unlike cond and condp, case does a constant-time dispatch, the clauses are not considered sequentially.  All manner of constant expressions are acceptable in case, including numbers, strings, symbols, keywords, and (Clojure) composites thereof. Note that since lists are used to group multiple constants that map to the same expression, a vector can be used to match a list if needed. The test-constants need not be all of the same type.")
+("cast" . "(cast c x) Throws a ClassCastException if x is not a c, else returns x.")
+("char" . "(char x) Coerce to char")
+("char-array" . "(char-array size init-val-or-seq) Creates an array of chars")
+("char?" . "(char? x) Return true if x is a Character")
+("chars" . "(chars xs) Casts to chars[]")
+("class" . "(class x) Returns the Class of x")
+("class?" . "(class? x) Returns true if x is an instance of Class")
+("clear-agent-errors" . "(clear-agent-errors a) DEPRECATED: Use 'restart-agent' instead. Clears any exceptions thrown during asynchronous actions of the agent, allowing subsequent actions to occur.")
+("clojure-version)" . "(clojure-version) Returns clojure version as a printable string.")
+("coll?" . "(coll? x) Returns true if x implements IPersistentCollection")
+("comment" . "(comment & body) Ignores body, yields nil")
+("commute" . "(commute ref fun & args) Must be called in a transaction. Sets the in-transaction-value of ref to:  (apply fun in-transaction-value-of-ref args)  and returns the in-transaction-value of ref.  At the commit point of the transaction, sets the value of ref to be:  (apply fun most-recently-committed-value-of-ref args)  Thus fun should be commutative, or, failing that, you must accept last-one-in-wins behavior.  commute allows for more concurrency than ref-set.")
+("comp" . "(comp f1 f2 f3 & fs) Takes a set of functions and returns a fn that is the composition of those fns.  The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc.")
+("comparator" . "(comparator pred) Returns an implementation of java.util.Comparator based upon pred.")
+("compare" . "(compare x y) Comparator. Returns a negative number, zero, or a positive number when x is logically 'less than', 'equal to', or 'greater than' y. Same as Java x.compareTo(y) except it also works for nil, and compares numbers and collections in a type-independent manner. x must implement Comparable")
+("compare-and-set!" . "(compare-and-set! atom oldval newval) Atomically sets the value of atom to newval if and only if the current value of the atom is identical to oldval. Returns true if set happened, else false")
+("compile" . "(compile lib) Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath.")
+("complement" . "(complement f) Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value.")
+("concat" . "(concat x y & zs) Returns a lazy seq representing the concatenation of the elements in the supplied colls.")
+("cond" . "(cond & clauses) Takes a set of test/expr pairs. It evaluates each test one at a time.  If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil.")
+("condp" . "(condp pred expr & clauses) Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either:  test-expr result-expr  test-expr :>> result-fn  Note :>> is an ordinary keyword.  For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must be a unary function, is called with the result of the predicate as its argument, the result of that call being the return value of condp. A single default expression can follow the clauses, and its value will be returned if no clause matches. If no default expression is provided and no clause matches, an IllegalArgumentException is thrown.")
+("conj" . "(conj coll x & xs) conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item).  The 'addition' may happen at different 'places' depending on the concrete type.")
+("conj!" . "(conj! coll x) Alpha - subject to change. Adds x to the transient collection, and return coll. The 'addition' may happen at different 'places' depending on the concrete type.")
+("cons" . "(cons x seq) Returns a new seq where x is the first element and seq is the rest.")
+("constantly" . "(constantly x) Returns a function that takes any number of arguments and returns x.")
+("construct-proxy" . "(construct-proxy c & ctor-args) Takes a proxy class and any arguments for its superclass ctor and creates and returns an instance of the proxy.")
+("contains?" . "(contains? coll key) Returns true if key is present in the given collection, otherwise returns false.  Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value.  See also 'some'.")
+("count" . "(count coll) Returns the number of items in the collection. (count nil) returns 0.  Also works on strings, arrays, and Java Collections and Maps")
+("counted?" . "(counted? coll) Returns true if coll implements count in constant time")
+("create-ns" . "(create-ns sym) Create a new namespace named by the symbol if one doesn't already exist, returns it or the already-existing namespace of the same name.")
+("create-struct" . "(create-struct & keys) Returns a structure basis object.")
+("cycle" . "(cycle coll) Returns a lazy (infinite!) sequence of repetitions of the items in coll.")
+("dec" . "(dec x) Returns a number one less than num. Does not auto-promote longs, will throw on overflow. See also: dec'")
+("dec'" . "(dec' x) Returns a number one less than num. Supports arbitrary precision. See also: dec")
+("decimal?" . "(decimal? n) Returns true if n is a BigDecimal")
+("declare" . "(declare & names) defs the supplied var names with no bindings, useful for making forward declarations.")
+("definline" . "(definline name & decl) Experimental - like defmacro, except defines a named function whose body is the expansion, calls to which may be expanded inline as if it were a macro. Cannot be used with variadic (&) args.")
+("defmacro" . "(defmacro name doc-string? attr-map? ([params*] body) + attr-map?) Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called.")
+("defmethod" . "(defmethod multifn dispatch-val & fn-tail) Creates and installs a new method of multimethod associated with dispatch-value. ")
+("defmulti" . "(defmulti name docstring? attr-map? dispatch-fn & options) Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional.  Options are key-value pairs and may be one of:   :default    the default dispatch value, defaults to :default   :hierarchy  the isa? hierarchy to use for dispatching               defaults to the global hierarchy")
+("defn" . "(defn name doc-string? attr-map? ([params*] body) + attr-map?) Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata")
+("defn-" . "(defn- name & decls) same as defn, yielding non-public def")
+("defonce" . "(defonce name expr) defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated")
+("defprotocol" . "(defprotocol name & opts+sigs) A protocol is a named set of named methods and their signatures: (defprotocol AProtocolName    ;optional doc string   \"A doc string for AProtocol abstraction\"  ;method signatures   (bar [this a b] \"bar docs\")   (baz [this a] [this a b] [this a b c] \"baz docs\"))  No implementations are provided. Docs can be specified for the protocol overall and for each method. The above yields a set of polymorphic functions and a protocol object. All are namespace-qualified by the ns enclosing the definition The resulting functions dispatch on the type of their first argument, which is required and corresponds to the implicit target object ('this' in  Java parlance). defprotocol is dynamic, has no special compile-time  effect, and defines no new types or classes. Implementations of  the protocol methods can be provided using extend.  defprotocol will automatically generate a corresponding interface, with the same name as the protocol, i.e. given a protocol: my.ns/Protocol, an interface: my.ns.Protocol. The interface will have methods corresponding to the protocol functions, and the protocol will automatically work with instances of the interface.  Note that you should not use this interface with deftype or reify, as they support the protocol directly:  (defprotocol P    (foo [this])    (bar-me [this] [this y]))  (deftype Foo [a b c]   P   (foo [this] a)   (bar-me [this] b)   (bar-me [this y] (+ c y)))  (bar-me (Foo. 1 2 3) 42) => 45  (foo    (let [x 42]     (reify P        (foo [this] 17)       (bar-me [this] x)       (bar-me [this y] x)))) => 17")
+("defrecord" . "(defrecord name [& fields] & opts+specs) Alpha - subject to change  (defrecord name [fields*]  options* specs*)  Currently there are no options.  Each spec consists of a protocol or interface name followed by zero or more method bodies:  protocol-or-interface-or-Object (methodName [args*] body)*  Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the current namespace, the given fields, and, optionally, methods for protocols and/or interfaces.  The class will have the (immutable) fields named by fields, which can have type hints. Protocols/interfaces and methods are optional. The only methods that can be supplied are those declared in the protocols/interfaces.  Note that method bodies are not closures, the local environment includes only the named fields, and those fields can be accessed directy.  Method definitions take the form:  (methodname [args*] body)  The argument and return types can be hinted on the arg and methodname symbols. If not supplied, they will be inferred, so type hints should be reserved for disambiguation.  Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for methods of Object. Note that a parameter must be supplied to correspond to the target object ('this' in Java parlance). Thus methods for interfaces will take one more argument than do the interface declarations. Note also that recur calls to the method head should *not* pass the target object, it will be supplied automatically and can not be substituted.  In the method bodies, the (unqualified) name can be used to name the class (for calls to new, instance? etc).  The class will have implementations of several (clojure.lang) interfaces generated automatically: IObj (metadata support) and IPersistentMap, and all of their superinterfaces.  In addition, defrecord will define type-and-value-based =, and will defined Java .hashCode and .equals consistent with the contract for java.util.Map.  When AOT compiling, generates compiled bytecode for a class with the given name (a symbol), prepends the current ns as the package, and writes the .class file to the *compile-path* directory.  Two constructors will be defined, one taking the designated fields followed by a metadata map (nil for none) and an extension field map (nil for none), and one taking only the fields (using nil for meta and extension fields).")
+("defstruct" . "(defstruct name & keys) Same as (def name (create-struct keys...))")
+("deftype" . "(deftype name [& fields] & opts+specs) Alpha - subject to change  (deftype name [fields*]  options* specs*)  Currently there are no options.  Each spec consists of a protocol or interface name followed by zero or more method bodies:  protocol-or-interface-or-Object (methodName [args*] body)*  Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the current namespace, the given fields, and, optionally, methods for protocols and/or interfaces.   The class will have the (by default, immutable) fields named by fields, which can have type hints. Protocols/interfaces and methods are optional. The only methods that can be supplied are those declared in the protocols/interfaces.  Note that method bodies are not closures, the local environment includes only the named fields, and those fields can be accessed directy. Fields can be qualified with the metadata :volatile-mutable true or :unsynchronized-mutable true, at which point (set! afield aval) will be supported in method bodies. Note well that mutable fields are extremely difficult to use correctly, and are present only to facilitate the building of higher level constructs, such as Clojure's reference types, in Clojure itself. They are for experts only - if the semantics and implications of :volatile-mutable or :unsynchronized-mutable are not immediately apparent to you, you should not be using them.  Method definitions take the form:  (methodname [args*] body)  The argument and return types can be hinted on the arg and methodname symbols. If not supplied, they will be inferred, so type hints should be reserved for disambiguation.  Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for methods of Object. Note that a parameter must be supplied to correspond to the target object ('this' in Java parlance). Thus methods for interfaces will take one more argument than do the interface declarations. Note also that recur calls to the method head should *not* pass the target object, it will be supplied automatically and can not be substituted.  In the method bodies, the (unqualified) name can be used to name the class (for calls to new, instance? etc).  When AOT compiling, generates compiled bytecode for a class with the given name (a symbol), prepends the current ns as the package, and writes the .class file to the *compile-path* directory.  One constructors will be defined, taking the designated fields.")
+("delay" . "(delay & body) Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?")
+("delay?" . "(delay? x) returns true if x is a Delay created with delay")
+("deliver" . "(deliver promise val) Alpha - subject to change. Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will throw an exception.")
+("denominator" . "(denominator r) Returns the denominator part of a Ratio.")
+("deref" . "(deref ref timeout-ms timeout-val) Also reader macro: @ref/@agent/@var/@atom/@delay/@future/@promise. Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation not complete. When applied to a promise, will block until a value is delivered.  The variant taking a timeout can be used for blocking references (futures and promises), and will return timeout-val if the timeout (in milliseconds) is reached before a value is available. See also - realized?.")
+("derive" . "(derive h tag parent) Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy.")
+("descendants" . "(descendants h tag) Returns the immediate and indirect children of tag, through a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy. Note: does not work on Java type inheritance relationships.")
+("disj" . "(disj set key & ks) disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s).")
+("disj!" . "(disj! set key & ks) Alpha - subject to change. disj[oin]. Returns a transient set of the same (hashed/sorted) type, that does not contain key(s).")
+("dissoc" . "(dissoc map key & ks) dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s).")
+("dissoc!" . "(dissoc! map key & ks) Alpha - subject to change. Returns a transient map that doesn't contain a mapping for key(s).")
+("distinct" . "(distinct coll) Returns a lazy sequence of the elements of coll with duplicates removed")
+("distinct?" . "(distinct? x y & more) Returns true if no two of the arguments are =")
+("doall" . "(doall n coll) When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time.")
+("dorun" . "(dorun n coll) When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil.")
+("doseq" . "(doseq seq-exprs & body) Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\".  Does not retain the head of the sequence. Returns nil.")
+("dosync" . "(dosync & exprs) Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls.  Starts a transaction if none is already running on this thread. Any uncaught exception will abort the transaction and flow out of dosync. The exprs may be run more than once, but any effects on Refs will be atomic.")
+("dotimes" . "(dotimes bindings & body) bindings => name n  Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1.")
+("doto" . "(doto x & forms) Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments.  The forms are evaluated in order.  Returns x.  (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))")
+("double" . "(double x) Coerce to double")
+("double-array" . "(double-array size init-val-or-seq) Creates an array of doubles")
+("doubles" . "(doubles xs) Casts to double[]")
+("drop" . "(drop n coll) Returns a lazy sequence of all but the first n items in coll.")
+("drop-last" . "(drop-last n s) Return a lazy sequence of all but the last n (default 1) items in coll")
+("drop-while" . "(drop-while pred coll) Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns nil.")
+("empty" . "(empty coll) Returns an empty collection of the same category as coll, or nil")
+("empty?" . "(empty? coll) Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))")
+("ensure" . "(ensure ref) Must be called in a transaction. Protects the ref from modification by other transactions.  Returns the in-transaction-value of ref. Allows for more concurrency than (ref-set ref @ref)")
+("enumeration-seq" . "(enumeration-seq e) Returns a seq on a java.util.Enumeration")
+("error-handler" . "(error-handler a) Returns the error-handler of agent a, or nil if there is none. See set-error-handler!")
+("error-mode" . "(error-mode a) Returns the error-mode of agent a.  See set-error-mode!")
+("eval" . "(eval form) Evaluates the form data structure (not text!) and returns the result.")
+("even?" . "(even? n) Returns true if n is even, throws an exception if n is not an integer")
+("every-pred" . "(every-pred p1 p2 p3 & ps) Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates.")
+("every?" . "(every? pred coll) Returns true if (pred x) is logical true for every x in coll, else false.")
+("extend" . "(extend atype & proto+mmaps) Implementations of protocol methods can be provided using the extend construct:   (extend AType    AProtocol     {:foo an-existing-fn      :bar (fn [a b] ...)      :baz (fn ([a]...) ([a b] ...)...)}    BProtocol       {...}     ...)   extend takes a type/class (or interface, see below), and one or more  protocol + method map pairs. It will extend the polymorphism of the  protocol's methods to call the supplied methods when an AType is  provided as the first argument.    Method maps are maps of the keyword-ized method names to ordinary  fns. This facilitates easy reuse of existing fns and fn maps, for  code reuse/mixins without derivation or composition. You can extend  an interface to a protocol. This is primarily to facilitate interop  with the host (e.g. Java) but opens the door to incidental multiple  inheritance of implementation since a class can inherit from more  than one interface, both of which extend the protocol. It is TBD how  to specify which impl to use. You can extend a protocol on nil.   If you are supplying the definitions explicitly (i.e. not reusing  exsting functions or mixin maps), you may find it more convenient to  use the extend-type or extend-protocol macros.   Note that multiple independent extend clauses can exist for the same  type, not all protocols need be defined in a single extend call.   See also:  extends?, satisfies?, extenders")
+("extend-protocol" . "(extend-protocol p & specs) Useful when you want to provide several implementations of the same protocol all at once. Takes a single protocol and the implementation of that protocol for one or more types. Expands into calls to extend-type:  (extend-protocol Protocol   AType     (foo [x] ...)     (bar [x y] ...)   BType     (foo [x] ...)     (bar [x y] ...)   AClass     (foo [x] ...)     (bar [x y] ...)   nil     (foo [x] ...)     (bar [x y] ...))  expands into:  (do  (clojure.core/extend-type AType Protocol     (foo [x] ...)     (bar [x y] ...))  (clojure.core/extend-type BType Protocol     (foo [x] ...)     (bar [x y] ...))  (clojure.core/extend-type AClass Protocol     (foo [x] ...)     (bar [x y] ...))  (clojure.core/extend-type nil Protocol     (foo [x] ...)     (bar [x y] ...)))")
+("extend-type" . "(extend-type t & specs) A macro that expands into an extend call. Useful when you are supplying the definitions explicitly inline, extend-type automatically creates the maps required by extend.  Propagates the class as a type hint on the first argument of all fns.  (extend-type MyType    Countable     (cnt [c] ...)   Foo     (bar [x y] ...)     (baz ([x] ...) ([x y & zs] ...)))  expands into:  (extend MyType  Countable    {:cnt (fn [c] ...)}  Foo    {:baz (fn ([x] ...) ([x y & zs] ...))     :bar (fn [x y] ...)})")
+("extenders" . "(extenders protocol) Returns a collection of the types explicitly extending protocol")
+("extends?" . "(extends? protocol atype) Returns true if atype extends protocol")
+("false?" . "(false? x) Returns true if x is the value false, false otherwise.")
+("ffirst" . "(ffirst x) Same as (first (first x))")
+("file-seq" . "(file-seq dir) A tree seq on java.io.Files")
+("filter" . "(filter pred coll) Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects.")
+("find" . "(find map key) Returns the map entry for key, or nil if key not present.")
+("find-keyword" . "(find-keyword ns name) Returns a Keyword with the given namespace and name if one already exists.  This function will not intern a new keyword. If the keyword has not already been interned, it will return nil.  Do not use : in the keyword strings, it will be added automatically.")
+("find-ns" . "(find-ns sym) Returns the namespace named by the symbol or nil if it doesn't exist.")
+("find-var" . "(find-var sym) Returns the global var named by the namespace-qualified symbol, or nil if no var with that name.")
+("first" . "(first coll) Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil.")
+("flatten" . "(flatten x) Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns nil.")
+("float" . "(float x) Coerce to float")
+("float-array" . "(float-array size init-val-or-seq) Creates an array of floats")
+("float?" . "(float? n) Returns true if n is a floating point number")
+("floats" . "(floats xs) Casts to float[]")
+("flush)" . "(flush) Flushes the output stream that is the current value of *out*")
+("fn" . "(fn & sigs) params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol  Defines a function")
+("fn?" . "(fn? x) Returns true if x implements Fn, i.e. is an object created via fn.")
+("fnext" . "(fnext x) Same as (first (next x))")
+("fnil" . "(fnil f x y z) Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched.")
+("for" . "(for seq-exprs body-expr) List comprehension. Takes a vector of one or more  binding-form/collection-expr pairs, each followed by zero or more  modifiers, and yields a lazy sequence of evaluations of expr.  Collections are iterated in a nested fashion, rightmost fastest,  and nested coll-exprs can refer to bindings created in prior  binding-forms.  Supported modifiers are: :let [binding-form expr ...],  :while test, :when test.  (take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))")
+("force" . "(force x) If x is a Delay, returns the (possibly cached) value of its expression, else returns x")
+("format" . "(format fmt & args) Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax")
+("frequencies" . "(frequencies coll) Returns a map from distinct items in coll to the number of times they appear.")
+("future" . "(future & body) Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block, unless the variant of deref with timeout is used. See also - realized?.")
+("future-call" . "(future-call f) Takes a function of no args and yields a future object that will invoke the function in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block, unless the variant of deref with timeout is used. See also - realized?.")
+("future-cancel" . "(future-cancel f) Cancels the future, if possible.")
+("future-cancelled?" . "(future-cancelled? f) Returns true if future f is cancelled")
+("future-done?" . "(future-done? f) Returns true if future f is done")
+("future?" . "(future? x) Returns true if x is a future")
+("gen-class" . "(gen-class & options) When compiling, generates compiled bytecode for a class with the given package-qualified :name (which, as all names in these parameters, can be a string or symbol), and writes the .class file to the *compile-path* directory.  When not compiling, does nothing. The gen-class construct contains no implementation, as the implementation will be dynamically sought by the generated class in functions in an implementing Clojure namespace. Given a generated class org.mydomain.MyClass with a method named mymethod, gen-class will generate an implementation that looks for a function named by  (str prefix mymethod) (default prefix: \"-\") in a Clojure namespace specified by :impl-ns (defaults to the current namespace). All inherited methods, generated methods, and init and main functions (see :methods, :init, and :main below) will be found similarly prefixed. By default, the static initializer for the generated class will attempt to load the Clojure support code for the class as a resource from the classpath, e.g. in the example case, ``org/mydomain/MyClass__init.class``. This behavior can be controlled by :load-impl-ns  Note that methods with a maximum of 18 parameters are supported.  In all subsequent sections taking types, the primitive types can be referred to by their Java names (int, float etc), and classes in the java.lang package can be used without a package qualifier. All other classes must be fully qualified.  Options should be a set of key/value pairs, all except for :name are optional:  :name aname  The package-qualified name of the class to be generated  :extends aclass  Specifies the superclass, the non-private methods of which will be overridden by the class. If not provided, defaults to Object.  :implements [interface ...]  One or more interfaces, the methods of which will be implemented by the class.  :init name  If supplied, names a function that will be called with the arguments to the constructor. Must return [ [superclass-constructor-args] state]  If not supplied, the constructor args are passed directly to the superclass constructor and the state will be nil  :constructors {[param-types] [super-param-types], ...}  By default, constructors are created for the generated class which match the signature(s) of the constructors for the superclass. This parameter may be used to explicitly specify constructors, each entry providing a mapping from a constructor signature to a superclass constructor signature. When you supply this, you must supply an :init specifier.   :post-init name  If supplied, names a function that will be called with the object as the first argument, followed by the arguments to the constructor. It will be called every time an object of this class is created, immediately after all the inherited constructors have completed. It's return value is ignored.  :methods [ [name [param-types] return-type], ...]  The generated class automatically defines all of the non-private methods of its superclasses/interfaces. This parameter can be used to specify the signatures of additional methods of the generated class. Static methods can be specified with ^{:static true} in the signature's metadata. Do not repeat superclass/interface signatures here.  :main boolean  If supplied and true, a static public main function will be generated. It will pass each string of the String[] argument as a separate argument to a function called (str prefix main).  :factory name  If supplied, a (set of) public static factory function(s) will be created with the given name, and the same signature(s) as the constructor(s).  :state name  If supplied, a public final instance field with the given name will be created. You must supply an :init function in order to provide a value for the state. Note that, though final, the state can be a ref or agent, supporting the creation of Java objects with transactional or asynchronous mutation semantics.  :exposes {protected-field-name {:get name :set name}, ...}  Since the implementations of the methods of the generated class occur in Clojure functions, they have no access to the inherited protected fields of the superclass. This parameter can be used to generate public getter/setter methods exposing the protected field(s) for use in the implementation.  :exposes-methods {super-method-name exposed-name, ...}  It is sometimes necessary to call the superclass' implementation of an overridden method.  Those methods may be exposed and referred in  the new method implementation by a local name.  :prefix string  Default: \"-\" Methods called e.g. Foo will be looked up in vars called prefixFoo in the implementing ns.  :impl-ns name  Default: the name of the current ns. Implementations of methods will be  looked up in this namespace.  :load-impl-ns boolean  Default: true. Causes the static initializer for the generated class to reference the load code for the implementing namespace. Should be true when implementing-ns is the default, false if you intend to load the code via some other method.")
+("gen-interface" . "(gen-interface & options) When compiling, generates compiled bytecode for an interface with  the given package-qualified :name (which, as all names in these  parameters, can be a string or symbol), and writes the .class file  to the *compile-path* directory.  When not compiling, does nothing.   In all subsequent sections taking types, the primitive types can be  referred to by their Java names (int, float etc), and classes in the  java.lang package can be used without a package qualifier. All other  classes must be fully qualified.   Options should be a set of key/value pairs, all except for :name are  optional:   :name aname   The package-qualified name of the class to be generated   :extends [interface ...]   One or more interfaces, which will be extended by this interface.   :methods [ [name [param-types] return-type], ...]   This parameter is used to specify the signatures of the methods of  the generated interface.  Do not repeat superinterface signatures  here.")
+("gensym" . "(gensym prefix-string) Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'.")
+("get" . "(get map key not-found) Returns the value mapped to key, not-found or nil if key not present.")
+("get-in" . "(get-in m ks not-found) Returns the value in a nested associative structure, where ks is a sequence of ke(ys. Returns nil if the key is not present, or the not-found value if supplied.")
+("get-method" . "(get-method multifn dispatch-val) Given a multimethod and a dispatch value, returns the dispatch fn that would apply to that value, or nil if none apply and no default")
+("get-proxy-class" . "(get-proxy-class & bases) Takes an optional single class followed by zero or more interfaces. If not supplied class defaults to Object.  Creates an returns an instance of a proxy class derived from the supplied classes. The resulting value is cached and used for any subsequent requests for the same class set. Returns a Class object.")
+("get-thread-bindings)" . "(get-thread-bindings) Get a map with the Var/value pairs which is currently in effect for the current thread.")
+("get-validator" . "(get-validator iref) Gets the validator-fn for a var/ref/agent/atom.")
+("group-by" . "(group-by f coll) Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll.")
+("hash" . "(hash x) Returns the hash code of its argument")
+("hash-map" . "(hash-map & keyvals) keyval => key val Returns a new hash map with supplied mappings.")
+("hash-set" . "(hash-set & keys) Returns a new hash set with supplied keys.")
+("identical?" . "(identical? x y) Tests if 2 arguments are the same object")
+("identity" . "(identity x) Returns its argument.")
+("if-let" . "(if-let bindings then else & oldform) bindings => binding-form test  If test is true, evaluates then with binding-form bound to the value of  test, if not, yields else")
+("if-not" . "(if-not test then else) Evaluates test. If logical false, evaluates and returns then expr,  otherwise else expr, if supplied, else nil.")
+("ifn?" . "(ifn? x) Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn")
+("import" . "(import & import-symbols-or-lists) import-list => (package-symbol class-name-symbols*)  For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly.")
+("in-ns" . "(in-ns name) Sets *ns* to the namespace named by the symbol, creating it if needed.")
+("inc" . "(inc x) Returns a number one greater than num. Does not auto-promote longs, will throw on overflow. See also: inc'")
+("inc'" . "(inc' x) Returns a number one greater than num. Supports arbitrary precision. See also: inc")
+("init-proxy" . "(init-proxy proxy mappings) Takes a proxy instance and a map of strings (which must correspond to methods of the proxy superclass/superinterfaces) to fns (which must take arguments matching the corresponding method, plus an additional (explicit) first arg corresponding to this, and sets the proxy's fn map.  Returns the proxy.")
+("instance?" . "(instance? c x) Evaluates x and tests if it is an instance of the class c. Returns true or false")
+("int" . "(int x) Coerce to int")
+("int-array" . "(int-array size init-val-or-seq) Creates an array of ints")
+("integer?" . "(integer? n) Returns true if n is an integer")
+("interleave" . "(interleave c1 c2 & colls) Returns a lazy seq of the first item in each coll, then the second etc.")
+("intern" . "(intern ns name val) Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol.  Returns the var.")
+("interpose" . "(interpose sep coll) Returns a lazy seq of the elements of coll separated by sep")
+("into" . "(into to from) Returns a new coll consisting of to-coll with all of the items of from-coll conjoined.")
+("into-array" . "(into-array type aseq) Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.")
+("ints" . "(ints xs) Casts to int[]")
+("io!" . "(io! & body) If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message.")
+("isa?" . "(isa? h child parent) Returns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy")
+("iterate" . "(iterate f x) Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects")
+("iterator-seq" . "(iterator-seq iter) Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly.")
+("juxt" . "(juxt f g h & fs) Takes a set of functions and returns a fn that is the juxtaposition of those fns.  The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]")
+("keep" . "(keep f coll) Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included.  f must be free of side-effects.")
+("keep-indexed" . "(keep-indexed f coll) Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included.  f must be free of side-effects.")
+("key" . "(key e) Returns the key of the map entry.")
+("keys" . "(keys map) Returns a sequence of the map's keys.")
+("keyword" . "(keyword ns name) Returns a Keyword with the given namespace and name.  Do not use : in the keyword strings, it will be added automatically.")
+("keyword?" . "(keyword? x) Return true if x is a Keyword")
+("last" . "(last coll) Return the last item in coll, in linear time")
+("lazy-cat" . "(lazy-cat & colls) Expands to code which yields a lazy sequence of the concatenation of the supplied colls.  Each coll expr is not evaluated until it is needed.   (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))")
+("lazy-seq" . "(lazy-seq & body) Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. See also - realized?")
+("let" . "(let bindings & body) binding => binding-form init-expr  Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein.")
+("letfn" . "(letfn fnspecs & body) fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)  Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body.")
+("line-seq" . "(line-seq rdr) Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.")
+("list" . "(list & items) Creates a new list containing the items.")
+("list*" . "(list* a b c d & more) Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence.")
+("list?" . "(list? x) Returns true if x implements IPersistentList")
+("load" . "(load & paths) Loads Clojure code from resources in classpath. A path is interpreted as classpath-relative if it begins with a slash or relative to the root directory for the current namespace otherwise.")
+("load-file" . "(load-file name) Sequentially read and evaluate the set of forms contained in the file.")
+("load-reader" . "(load-reader rdr) Sequentially read and evaluate the set of forms contained in the stream/file")
+("load-string" . "(load-string s) Sequentially read and evaluate the set of forms contained in the string")
+("loaded-libs)" . "(loaded-libs) Returns a sorted set of symbols naming the currently loaded libs")
+("locking" . "(locking x & body) Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances.")
+("long" . "(long x) Coerce to long")
+("long-array" . "(long-array size init-val-or-seq) Creates an array of longs")
+("longs" . "(longs xs) Casts to long[]")
+("loop" . "(loop bindings & body) Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein. Acts as a recur target.")
+("macroexpand" . "(macroexpand form) Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it.  Note neither macroexpand-1 nor macroexpand expand macros in subforms.")
+("macroexpand-1" . "(macroexpand-1 form) If form represents a macro form, returns its expansion, else returns form.")
+("make-array" . "(make-array type dim & more-dims) Creates and returns an array of instances of the specified class of the specified dimension(s).  Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name.  Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.")
+("make-hierarchy)" . "(make-hierarchy) Creates a hierarchy object for use with derive, isa? etc.")
+("map" . "(map f c1 c2 c3 & colls) Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted.  Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.")
+("map-indexed" . "(map-indexed f coll) Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item.")
+("map?" . "(map? x) Return true if x implements IPersistentMap")
+("mapcat" . "(mapcat f & colls) Returns the result of applying concat to the result of applying map to f and colls.  Thus function f should return a collection.")
+("max" . "(max x y & more) Returns the greatest of the nums.")
+("max-key" . "(max-key k x y & more) Returns the x for which (k x), a number, is greatest.")
+("memfn" . "(memfn name & args) Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn.")
+("memoize" . "(memoize f) Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use.")
+("merge" . "(merge & maps) Returns a map that consists of the rest of the maps conj-ed onto the first.  If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result.")
+("merge-with" . "(merge-with f & maps) Returns a map that consists of the rest of the maps conj-ed onto the first.  If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter).")
+("meta" . "(meta obj) Returns the metadata of obj, returns nil if there is no metadata.")
+("methods" . "(methods multifn) Given a multimethod, returns a map of dispatch values -> dispatch fns")
+("min" . "(min x y & more) Returns the least of the nums.")
+("min-key" . "(min-key k x y & more) Returns the x for which (k x), a number, is least.")
+("mod" . "(mod num div) Modulus of num and div. Truncates toward negative infinity.")
+("name" . "(name x) Returns the name String of a string, symbol or keyword.")
+("namespace" . "(namespace x) Returns the namespace String of a symbol or keyword, or nil if not present.")
+("namespace-munge" . "(namespace-munge ns) Convert a Clojure namespace name to a legal Java package name.")
+("neg?" . "(neg? x) Returns true if num is less than zero, else false")
+("newline)" . "(newline) Writes a platform-specific newline to *out*")
+("next" . "(next coll) Returns a seq of the items after the first. Calls seq on its argument.  If there are no more items, returns nil.")
+("nfirst" . "(nfirst x) Same as (next (first x))")
+("nil?" . "(nil? x) Returns true if x is nil, false otherwise.")
+("nnext" . "(nnext x) Same as (next (next x))")
+("not" . "(not x) Returns true if x is logical false, false otherwise.")
+("not-any?" . "(not-any? pred coll) Returns false if (pred x) is logical true for any x in coll, else true.")
+("not-empty" . "(not-empty coll) If coll is empty, returns nil, else coll")
+("not-every?" . "(not-every? pred coll) Returns false if (pred x) is logical true for every x in coll, else true.")
+("not=" . "(not= x y & more) Same as (not (= obj1 obj2))")
+("ns" . "(ns name docstring? attr-map? references*) Sets *ns* to the namespace named by name (unevaluated), creating it if needed.  references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syntax of refer-clojure/require/use/import/load/gen-class respectively, except the arguments are unevaluated and need not be quoted. (:gen-class ...), when supplied, defaults to :name corresponding to the ns name, :main true, :impl-ns same as ns, and :init-impl-ns true. All options of gen-class are supported. The :gen-class directive is ignored when not compiling. If :gen-class is not supplied, when compiled only an nsname__init.class will be generated. If :refer-clojure is not used, a default (refer 'clojure) is used.  Use of ns is preferred to individual calls to in-ns/require/use/import:  (ns foo.bar   (:refer-clojure :exclude [ancestors printf])   (:require (clojure.contrib sql sql.tests))   (:use (my.lib this that))   (:import (java.util Date Timer Random)            (java.sql Connection Statement)))")
+("ns-aliases" . "(ns-aliases ns) Returns a map of the aliases for the namespace.")
+("ns-imports" . "(ns-imports ns) Returns a map of the import mappings for the namespace.")
+("ns-interns" . "(ns-interns ns) Returns a map of the intern mappings for the namespace.")
+("ns-map" . "(ns-map ns) Returns a map of all the mappings for the namespace.")
+("ns-name" . "(ns-name ns) Returns the name of the namespace, a symbol.")
+("ns-publics" . "(ns-publics ns) Returns a map of the public intern mappings for the namespace.")
+("ns-refers" . "(ns-refers ns) Returns a map of the refer mappings for the namespace.")
+("ns-resolve" . "(ns-resolve ns env sym) Returns the var or Class to which a symbol will be resolved in the namespace (unless found in the environement), else nil.  Note that if the symbol is fully qualified, the var/Class to which it resolves need not be present in the namespace.")
+("ns-unalias" . "(ns-unalias ns sym) Removes the alias for the symbol from the namespace.")
+("ns-unmap" . "(ns-unmap ns sym) Removes the mappings for the symbol from the namespace.")
+("nth" . "(nth coll index not-found) Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied.  nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences.")
+("nthnext" . "(nthnext coll n) Returns the nth next of coll, (seq coll) when n is 0.")
+("nthrest" . "(nthrest coll n) Returns the nth rest of coll, coll when n is 0.")
+("num" . "(num x) Coerce to Number")
+("number?" . "(number? x) Returns true if x is a Number")
+("numerator" . "(numerator r) Returns the numerator part of a Ratio.")
+("object-array" . "(object-array size-or-seq) Creates an array of objects")
+("odd?" . "(odd? n) Returns true if n is odd, throws an exception if n is not an integer")
+("or" . "(or x & next) Evaluates exprs one at a time, from left to right. If a form returns a logical true value, or returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expression. (or) returns nil.")
+("parents" . "(parents h tag) Returns the immediate parents of tag, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy")
+("partial" . "(partial f arg1 arg2 arg3 & more) Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args.")
+("partition" . "(partition n step pad coll) Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items.")
+("partition-all" . "(partition-all n step coll) Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end.")
+("partition-by" . "(partition-by f coll) Applies f to each value in coll, splitting it each time f returns a new value.  Returns a lazy seq of partitions.")
+("pcalls" . "(pcalls & fns) Executes the no-arg fns in parallel, returning a lazy sequence of their values")
+("peek" . "(peek coll) For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil.")
+("persistent!" . "(persistent! coll) Alpha - subject to change. Returns a new, persistent version of the transient collection, in constant time. The transient collection cannot be used after this call, any such use will throw an exception.")
+("pmap" . "(pmap f coll & colls) Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless required. Only useful for computationally intensive functions where the time of f dominates the coordination overhead.")
+("pop" . "(pop coll) For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception.  Note - not the same as next/butlast.")
+("pop!" . "(pop! coll) Alpha - subject to change. Removes the last item from a transient vector. If the collection is empty, throws an exception. Returns coll")
+("pop-thread-bindings)" . "(pop-thread-bindings) Pop one set of bindings pushed with push-binding before. It is an error to pop bindings without pushing before.")
+("pos?" . "(pos? x) Returns true if num is greater than zero, else false")
+("pr" . "(pr x & more) Prints the object(s) to the output stream that is the current value of *out*.  Prints the object(s), separated by spaces if there is more than one.  By default, pr and prn print in a way that objects can be read by the reader")
+("pr-str" . "(pr-str & xs) pr to a string, returning it")
+("prefer-method" . "(prefer-method multifn dispatch-val-x dispatch-val-y) Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y  when there is a conflict")
+("prefers" . "(prefers multifn) Given a multimethod, returns a map of preferred value -> set of other values")
+("print" . "(print & more) Prints the object(s) to the output stream that is the current value of *out*.  print and println produce output for human consumption.")
+("print-str" . "(print-str & xs) print to a string, returning it")
+("printf" . "(printf fmt & args) Prints formatted output, as per format")
+("println" . "(println & more) Same as print followed by (newline)")
+("println-str" . "(println-str & xs) println to a string, returning it")
+("prn" . "(prn & more) Same as pr followed by (newline). Observes *flush-on-newline*")
+("prn-str" . "(prn-str & xs) prn to a string, returning it")
+("promise)" . "(promise) Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block, unless the variant of deref with timeout is used. All subsequent derefs will return the same delivered value without blocking. See also - realized?.")
+("proxy" . "(proxy class-and-interfaces args & fs) class-and-interfaces - a vector of class names  args - a (possibly empty) vector of arguments to the superclass constructor.  f => (name [params*] body) or (name ([params*] body) ([params+] body) ...)  Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, must be first. If not provided it defaults to Object.  The interfaces names must be valid interface types. If a method fn is not provided for a class method, the superclass methd will be called. If a method fn is not provided for an interface method, an UnsupportedOperationException will be thrown should it be called. Method fns are closures and can capture the environment in which proxy is called. Each method fn takes an additional implicit first arg, which is bound to 'this. Note that while method fns can be provided to override protected methods, they have no other access to protected members, nor to super, as these capabilities cannot be proxied.")
+("proxy-mappings" . "(proxy-mappings proxy) Takes a proxy instance and returns the proxy's fn map.")
+("proxy-super" . "(proxy-super meth & args) Use to call a superclass method in the body of a proxy method.  Note, expansion captures 'this")
+("push-thread-bindings" . "(push-thread-bindings bindings) WARNING: This is a low-level function. Prefer high-level macros like binding where ever possible.  Takes a map of Var/value pairs. Binds each Var to the associated value for the current thread. Each call *MUST* be accompanied by a matching call to pop-thread-bindings wrapped in a try-finally!      (push-thread-bindings bindings)     (try       ...       (finally         (pop-thread-bindings)))")
+("pvalues" . "(pvalues & exprs) Returns a lazy sequence of the values of the exprs, which are evaluated in parallel")
+("quot" . "(quot num div) quot[ient] of dividing numerator by denominator.")
+("rand" . "(rand n) Returns a random floating point number between 0 (inclusive) and n (default 1) (exclusive).")
+("rand-int" . "(rand-int n) Returns a random integer between 0 (inclusive) and n (exclusive).")
+("rand-nth" . "(rand-nth coll) Return a random element of the (sequential) collection. Will have the same performance characteristics as nth for the given collection.")
+("range" . "(range start end step) Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity.")
+("ratio?" . "(ratio? n) Returns true if n is a Ratio")
+("rational?" . "(rational? n) Returns true if n is a rational number")
+("rationalize" . "(rationalize num) returns the rational value of num")
+("re-find" . "(re-find re s) Returns the next regex match, if any, of string to pattern, using java.util.regex.Matcher.find().  Uses re-groups to return the groups.")
+("re-groups" . "(re-groups m) Returns the groups from the most recent match/find. If there are no nested groups, returns a string of the entire match. If there are nested groups, returns a vector of the groups, the first element being the entire match.")
+("re-matcher" . "(re-matcher re s) Returns an instance of java.util.regex.Matcher, for use, e.g. in re-find.")
+("re-matches" . "(re-matches re s) Returns the match, if any, of string to pattern, using java.util.regex.Matcher.matches().  Uses re-groups to return the groups.")
+("re-pattern" . "(re-pattern s) Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher.")
+("re-seq" . "(re-seq re s) Returns a lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), each such match processed with re-groups.")
+("read" . "(read stream eof-error? eof-value recursive?) Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee.  stream defaults to the current value of *in* .")
+("read-line)" . "(read-line) Reads the next line from stream that is the current value of *in* .")
+("read-string" . "(read-string s) Reads one object from the string s")
+("realized?" . "(realized? x) Returns true if a value has been produced for a promise, delay, future or lazy sequence.")
+("reduce" . "(reduce f val coll) f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments.  If coll has only 1 item, it is returned and f is not called.  If val is supplied, returns the result of applying f to val and the first item in coll, then applying f to that result and the 2nd item, etc. If coll contains no items, returns val and f is not called.")
+("reductions" . "(reductions f init coll) Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init.")
+("ref" . "(ref x & options) Creates and returns a Ref with an initial value of x and zero or more options (in any order):  :meta metadata-map  :validator validate-fn  :min-history (default 0) :max-history (default 10)  If metadata-map is supplied, it will be come the metadata on the ref. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn should return false or throw an exception. validate-fn will be called on transaction commit, when all refs have their final values.  Normally refs accumulate history dynamically as needed to deal with read demands. If you know in advance you will need history you can set :min-history to ensure it will be available when first needed (instead of after a read fault). History is limited, and the limit can be set with :max-history.")
+("ref-history-count" . "(ref-history-count ref) Returns the history count of a ref")
+("ref-max-history" . "(ref-max-history ref n) Gets the max-history of a ref, or sets it and returns the ref")
+("ref-min-history" . "(ref-min-history ref n) Gets the min-history of a ref, or sets it and returns the ref")
+("ref-set" . "(ref-set ref val) Must be called in a transaction. Sets the value of ref. Returns val.")
+("refer" . "(refer ns-sym & filters) refers to all public vars of ns, subject to filters. filters can include at most one each of:  :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol  For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace.  Throws an exception if name is already mapped to something else in the current namespace. Filters can be used to select a subset, via inclusion or exclusion, or to provide a mapping to a symbol different from the var's name, in order to prevent clashes. Use :use in the ns macro in preference to calling this directly.")
+("refer-clojure" . "(refer-clojure & filters) Same as (refer 'clojure.core <filters>)")
+("reify" . "(reify & opts+specs) reify is a macro with the following structure:  (reify options* specs*)    Currently there are no options.   Each spec consists of the protocol or interface name followed by zero  or more method bodies:   protocol-or-interface-or-Object  (methodName [args+] body)*   Methods should be supplied for all methods of the desired  protocol(s) and interface(s). You can also define overrides for  methods of Object. Note that the first parameter must be supplied to  correspond to the target object ('this' in Java parlance). Thus  methods for interfaces will take one more argument than do the  interface declarations.  Note also that recur calls to the method  head should *not* pass the target object, it will be supplied  automatically and can not be substituted.   The return type can be indicated by a type hint on the method name,  and arg types can be indicated by a type hint on arg names. If you  leave out all hints, reify will try to match on same name/arity  method in the protocol(s)/interface(s) - this is preferred. If you  supply any hints at all, no inference is done, so all hints (or  default of Object) must be correct, for both arguments and return  type. If a method is overloaded in a protocol/interface, multiple  independent method definitions must be supplied.  If overloaded with  same arity in an interface you must specify complete hints to  disambiguate - a missing hint implies Object.   recur works to method heads The method bodies of reify are lexical  closures, and can refer to the surrounding local scope:    (str (let [f \"foo\"]        (reify Object          (toString [this] f))))  == \"foo\"   (seq (let [f \"foo\"]        (reify clojure.lang.Seqable          (seq [this] (seq f)))))  == (\f \o \o))")
+("release-pending-sends)" . "(release-pending-sends) Normally, actions sent directly or indirectly during another action are held until the action completes (changes the agent's state). This function can be used to dispatch any pending sent actions immediately. This has no impact on actions sent during a transaction, which are still held until commit. If no action is occurring, does nothing. Returns the number of actions dispatched.")
+("rem" . "(rem num div) remainder of dividing numerator by denominator.")
+("remove" . "(remove pred coll) Returns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects.")
+("remove-all-methods" . "(remove-all-methods multifn) Removes all of the methods of multimethod.")
+("remove-method" . "(remove-method multifn dispatch-val) Removes the method of multimethod associated with dispatch-value.")
+("remove-ns" . "(remove-ns sym) Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace.")
+("remove-watch" . "(remove-watch reference key) Alpha - subject to change. Removes a watch (set by add-watch) from a reference")
+("repeat" . "(repeat n x) Returns a lazy (infinite!, or length n if supplied) sequence of xs.")
+("repeatedly" . "(repeatedly n f) Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it")
+("replace" . "(replace smap coll) Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap")
+("replicate" . "(replicate n x) DEPRECATED: Use 'repeat' instead. Returns a lazy seq of n xs.")
+("require" . "(require & args) Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly.  Libs  A 'lib' is a named set of resources in classpath whose contents define a library of Clojure code. Lib names are symbols and each lib is associated with a Clojure namespace and a Java package that share its name. A lib's name also locates its root directory within classpath using Java's package name to classpath-relative path mapping. All resources in a lib should be contained in the directory structure under its root directory. All definitions a lib makes should be in its associated namespace.  'require loads a lib by loading its root resource. The root resource path is derived from the lib name in the following manner: Consider a lib named by the symbol 'x.y.z; it has the root directory <classpath>/x/y/, and its root resource is <classpath>/x/y/z.clj. The root resource should contain code to create the lib's namespace (usually by using the ns macro) and load any additional lib resources.  Libspecs  A libspec is a lib name or a vector containing a lib name followed by options expressed as sequential keywords and arguments.  Recognized options: :as :as takes a symbol as its argument and makes that symbol an alias to the   lib's namespace in the current namespace.  Prefix Lists  It's common for Clojure code to depend on several libs whose names have the same prefix. When specifying libs, prefix lists can be used to reduce repetition. A prefix list contains the shared prefix followed by libspecs with the shared prefix removed from the lib names. After removing the prefix, the names that remain must not contain any periods.  Flags  A flag is a keyword. Recognized flags: :reload, :reload-all, :verbose :reload forces loading of all the identified libs even if they are   already loaded :reload-all implies :reload and also forces loading of all libs that the   identified libs directly or indirectly load via require or use :verbose triggers printing information about each load, alias, and refer  Example:  The following would load the libraries clojure.zip and clojure.set abbreviated as 's'.  (require '(clojure zip [set :as s]))")
+("reset!" . "(reset! atom newval) Sets the value of atom to newval without regard for the current value. Returns newval.")
+("reset-meta!" . "(reset-meta! iref metadata-map) Atomically resets the metadata for a namespace/var/ref/agent/atom")
+("resolve" . "(resolve env sym) same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)")
+("rest" . "(rest coll) Returns a possibly empty seq of the items after the first. Calls seq on its argument.")
+("restart-agent" . "(restart-agent a new-state & options) When an agent is failed, changes the agent state to new-state and then un-fails the agent so that sends are allowed again.  If a :clear-actions true option is given, any actions queued on the agent that were being held while it was failed will be discarded, otherwise those held actions will proceed.  The new-state must pass the validator if any, or restart will throw an exception and the agent will remain failed with its old state and error.  Watchers, if any, will NOT be notified of the new state.  Throws an exception if the agent is not failed.")
+("resultset-seq" . "(resultset-seq rs) Creates and returns a lazy sequence of structmaps corresponding to the rows in the java.sql.ResultSet rs")
+("reverse" . "(reverse coll) Returns a seq of the items in coll in reverse order. Not lazy.")
+("reversible?" . "(reversible? coll) Returns true if coll implements Reversible")
+("rseq" . "(rseq rev) Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil")
+("rsubseq" . "(rsubseq sc start-test start-key end-test end-key) sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a reverse seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true")
+("satisfies?" . "(satisfies? protocol x) Returns true if x satisfies the protocol")
+("second" . "(second x) Same as (first (next x))")
+("select-keys" . "(select-keys map keyseq) Returns a map containing only those entries in map whose key is in keys")
+("send" . "(send a f & args) Dispatch an action to an agent. Returns the agent immediately. Subsequently, in a thread from a thread pool, the state of the agent will be set to the value of:  (apply action-fn state-of-agent args)")
+("send-off" . "(send-off a f & args) Dispatch a potentially blocking action to an agent. Returns the agent immediately. Subsequently, in a separate thread, the state of the agent will be set to the value of:  (apply action-fn state-of-agent args)")
+("seq" . "(seq coll) Returns a seq on the collection. If the collection is empty, returns nil.  (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable.")
+("seq?" . "(seq? x) Return true if x implements ISeq")
+("seque" . "(seque n-or-q s) Creates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n buffer size, or an instance of java.util.concurrent BlockingQueue. Note that reading from a seque can block if the reader gets ahead of the producer.")
+("sequence" . "(sequence coll) Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields ()")
+("sequential?" . "(sequential? coll) Returns true if coll implements Sequential")
+("set" . "(set coll) Returns a set of the distinct elements of coll.")
+("set-error-handler!" . "(set-error-handler! a handler-fn) Sets the error-handler of agent a to handler-fn.  If an action being run by the agent throws an exception or doesn't pass the validator fn, handler-fn will be called with two arguments: the agent and the exception.")
+("set-error-mode!" . "(set-error-mode! a mode-keyword) Sets the error-mode of agent a to mode-keyword, which must be either :fail or :continue.  If an action being run by the agent throws an exception or doesn't pass the validator fn, an error-handler may be called (see set-error-handler!), after which, if the mode is :continue, the agent will continue as if neither the action that caused the error nor the error itself ever happened.  If the mode is :fail, the agent will become failed and will stop accepting new 'send' and 'send-off' actions, and any previously queued actions will be held until a 'restart-agent'.  Deref will still work, returning the state of the agent before the error.")
+("set-validator!" . "(set-validator! iref validator-fn) Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validator-fn should return false or throw an exception. If the current state (root value if var) is not acceptable to the new validator, an exception will be thrown and the validator will not be changed.")
+("set?" . "(set? x) Returns true if x implements IPersistentSet")
+("short" . "(short x) Coerce to short")
+("short-array" . "(short-array size init-val-or-seq) Creates an array of shorts")
+("shorts" . "(shorts xs) Casts to shorts[]")
+("shuffle" . "(shuffle coll) Return a random permutation of coll")
+("shutdown-agents)" . "(shutdown-agents) Initiates a shutdown of the thread pools that back the agent system. Running actions will complete, but no new actions will be accepted")
+("slurp" . "(slurp f & opts) Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments.")
+("some" . "(some pred coll) Returns the first logical true value of (pred x) for any x in coll, else nil.  One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)")
+("some-fn" . "(some-fn p1 p2 p3 & ps) Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical true result against the original predicates.")
+("sort" . "(sort comp coll) Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator.")
+("sort-by" . "(sort-by keyfn comp coll) Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item).  If no comparator is supplied, uses compare. comparator must implement java.util.Comparator.")
+("sorted-map" . "(sorted-map & keyvals) keyval => key val Returns a new sorted map with supplied mappings.")
+("sorted-map-by" . "(sorted-map-by comparator & keyvals) keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator.")
+("sorted-set" . "(sorted-set & keys) Returns a new sorted set with supplied keys.")
+("sorted-set-by" . "(sorted-set-by comparator & keys) Returns a new sorted set with supplied keys, using the supplied comparator.")
+("sorted?" . "(sorted? coll) Returns true if coll implements Sorted")
+("special-symbol?" . "(special-symbol? s) Returns true if s names a special form")
+("spit" . "(spit f content & options) Opposite of slurp.  Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer.")
+("split-at" . "(split-at n coll) Returns a vector of [(take n coll) (drop n coll)]")
+("split-with" . "(split-with pred coll) Returns a vector of [(take-while pred coll) (drop-while pred coll)]")
+("str" . "(str x & ys) With no args, returns the empty string. With one arg x, returns x.toString().  (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args.")
+("string?" . "(string? x) Return true if x is a String")
+("struct" . "(struct s & vals) Returns a new structmap instance with the keys of the structure-basis. vals must be supplied for basis keys in order - where values are not supplied they will default to nil.")
+("struct-map" . "(struct-map s & inits) Returns a new structmap instance with the keys of the structure-basis. keyvals may contain all, some or none of the basis keys - where values are not supplied they will default to nil. keyvals can also contain keys not in the basis.")
+("subs" . "(subs s start end) Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive.")
+("subseq" . "(subseq sc start-test start-key end-test end-key) sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true")
+("subvec" . "(subvec v start end) Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive).  If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done.")
+("supers" . "(supers class) Returns the immediate and indirect superclasses and interfaces of c, if any")
+("swap!" . "(swap! atom f x y & args) Atomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects.  Returns the value that was swapped in.")
+("symbol" . "(symbol ns name) Returns a Symbol with the given namespace and name.")
+("symbol?" . "(symbol? x) Return true if x is a Symbol")
+("sync" . "(sync flags-ignored-for-now & body) transaction-flags => TBD, pass nil for now  Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls.  Starts a transaction if none is already running on this thread. Any uncaught exception will abort the transaction and flow out of sync. The exprs may be run more than once, but any effects on Refs will be atomic.")
+("take" . "(take n coll) Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n.")
+("take-last" . "(take-last n coll) Returns a seq of the last n items in coll.  Depending on the type of coll may be no better than linear time.  For vectors, see also subvec.")
+("take-nth" . "(take-nth n coll) Returns a lazy seq of every nth item in coll.")
+("take-while" . "(take-while pred coll) Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects.")
+("test" . "(test v) test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception")
+("the-ns" . "(the-ns x) If passed a namespace, returns it. Else, when passed a symbol, returns the namespace named by it, throwing an exception if not found.")
+("thread-bound?" . "(thread-bound? & vars) Returns true if all of the vars provided as arguments have thread-local bindings. Implies that set!'ing the provided vars will succeed.  Returns true if no vars are provided.")
+("time" . "(time expr) Evaluates expr and prints the time it took.  Returns the value of expr.")
+("to-array" . "(to-array coll) Returns an array of Objects containing the contents of coll, which can be any Collection.  Maps to java.util.Collection.toArray().")
+("to-array-2d" . "(to-array-2d coll) Returns a (potentially-ragged) 2-dimensional array of Objects containing the contents of coll, which can be any Collection of any Collection.")
+("trampoline" . "(trampoline f & args) trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if any. If f returns a fn, calls that fn with no arguments, and continues to repeat, until the return value is not a fn, then returns that non-fn value. Note that if you want to return a fn as a final value, you must wrap it in some data structure and unpack it after trampoline returns.")
+("transient" . "(transient coll) Alpha - subject to change. Returns a new, transient version of the collection, in constant time.")
+("tree-seq" . "(tree-seq branch? children root) Returns a lazy sequence of the nodes in a tree, via a depth-first walk.  branch? must be a fn of one arg that returns true if passed a node  that can have children (but may not).  children must be a fn of one  arg that returns a sequence of the children. Will only be called on  nodes for which branch? returns true. Root is the root node of the tree.")
+("true?" . "(true? x) Returns true if x is the value true, false otherwise.")
+("type" . "(type x) Returns the :type metadata of x, or its Class if none")
+("unchecked-add" . "(unchecked-add x y) Returns the sum of x and y, both long. Note - uses a primitive operator subject to overflow.")
+("unchecked-add-int" . "(unchecked-add-int x y) Returns the sum of x and y, both int. Note - uses a primitive operator subject to overflow.")
+("unchecked-byte" . "(unchecked-byte x) Coerce to byte. Subject to rounding or truncation.")
+("unchecked-char" . "(unchecked-char x) Coerce to char. Subject to rounding or truncation.")
+("unchecked-dec" . "(unchecked-dec x) Returns a number one less than x, a long. Note - uses a primitive operator subject to overflow.")
+("unchecked-dec-int" . "(unchecked-dec-int x) Returns a number one less than x, an int. Note - uses a primitive operator subject to overflow.")
+("unchecked-divide-int" . "(unchecked-divide-int x y) Returns the division of x by y, both int. Note - uses a primitive operator subject to truncation.")
+("unchecked-double" . "(unchecked-double x) Coerce to double. Subject to rounding.")
+("unchecked-float" . "(unchecked-float x) Coerce to float. Subject to rounding.")
+("unchecked-inc" . "(unchecked-inc x) Returns a number one greater than x, a long. Note - uses a primitive operator subject to overflow.")
+("unchecked-inc-int" . "(unchecked-inc-int x) Returns a number one greater than x, an int. Note - uses a primitive operator subject to overflow.")
+("unchecked-int" . "(unchecked-int x) Coerce to int. Subject to rounding or truncation.")
+("unchecked-long" . "(unchecked-long x) Coerce to long. Subject to rounding or truncation.")
+("unchecked-multiply" . "(unchecked-multiply x y) Returns the product of x and y, both long. Note - uses a primitive operator subject to overflow.")
+("unchecked-multiply-int" . "(unchecked-multiply-int x y) Returns the product of x and y, both int. Note - uses a primitive operator subject to overflow.")
+("unchecked-negate" . "(unchecked-negate x) Returns the negation of x, a long. Note - uses a primitive operator subject to overflow.")
+("unchecked-negate-int" . "(unchecked-negate-int x) Returns the negation of x, an int. Note - uses a primitive operator subject to overflow.")
+("unchecked-remainder-int" . "(unchecked-remainder-int x y) Returns the remainder of division of x by y, both int. Note - uses a primitive operator subject to truncation.")
+("unchecked-short" . "(unchecked-short x) Coerce to short. Subject to rounding or truncation.")
+("unchecked-subtract" . "(unchecked-subtract x y) Returns the difference of x and y, both long. Note - uses a primitive operator subject to overflow.")
+("unchecked-subtract-int" . "(unchecked-subtract-int x y) Returns the difference of x and y, both int. Note - uses a primitive operator subject to overflow.")
+("underive" . "(underive h tag parent) Removes a parent/child relationship between parent and tag. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy.")
+("update-in" . "(update-in m [k & ks] f & args) 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure.  If any levels do not exist, hash-maps will be created.")
+("update-proxy" . "(update-proxy proxy mappings) Takes a proxy instance and a map of strings (which must correspond to methods of the proxy superclass/superinterfaces) to fns (which must take arguments matching the corresponding method, plus an additional (explicit) first arg corresponding to this, and updates (via assoc) the proxy's fn map. nil can be passed instead of a fn, in which case the corresponding method will revert to the default behavior. Note that this function can be used to update the behavior of an existing instance without changing its identity. Returns the proxy.")
+("use" . "(use & args) Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly.  'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer.")
+("val" . "(val e) Returns the value in the map entry.")
+("vals" . "(vals map) Returns a sequence of the map's values.")
+("var-get" . "(var-get x) Gets the value in the var object")
+("var-set" . "(var-set x val) Sets the value in the var object to val. The var must be thread-locally bound.")
+("var?" . "(var? v) Returns true if v is of type clojure.lang.Var")
+("vary-meta" . "(vary-meta obj f & args) Returns an object of the same type and value as obj, with (apply f (meta obj) args) as its metadata.")
+("vec" . "(vec coll) Creates a new vector containing the contents of coll.")
+("vector" . "(vector a b c d & args) Creates a new vector containing the args.")
+("vector-of" . "(vector-of t & elements) Creates a new vector of a single primitive type t, where t is one of :int :long :float :double :byte :short :char or :boolean. The resulting vector complies with the interface of vectors in general, but stores the values unboxed internally.  Optionally takes one or more elements to populate the vector.")
+("vector?" . "(vector? x) Return true if x implements IPersistentVector")
+("when" . "(when test & body) Evaluates test. If logical true, evaluates body in an implicit do.")
+("when-first" . "(when-first bindings & body) bindings => x xs  Same as (when (seq xs) (let [x (first xs)] body))")
+("when-let" . "(when-let bindings & body) bindings => binding-form test  When test is true, evaluates body with binding-form bound to the value of test")
+("when-not" . "(when-not test & body) Evaluates test. If logical false, evaluates body in an implicit do.")
+("while" . "(while test & body) Repeatedly executes body while test expression is true. Presumes some side-effect will cause test to become false/nil. Returns nil")
+("with-bindings" . "(with-bindings binding-map & body) Takes a map of Var/value pairs. Installs for the given Vars the associated values as thread-local bindings. The executes body. Pops the installed bindings after body was evaluated. Returns the value of body.")
+("with-bindings*" . "(with-bindings* binding-map f & args) Takes a map of Var/value pairs. Installs for the given Vars the associated values as thread-local bindings. Then calls f with the supplied arguments. Pops the installed bindings after f returned. Returns whatever f returns.")
+("with-in-str" . "(with-in-str s & body) Evaluates body in a context in which *in* is bound to a fresh StringReader initialized with the string s.")
+("with-local-vars" . "(with-local-vars name-vals-vec & body) varbinding=> symbol init-expr  Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs.  The symbols refer to the var objects themselves, and must be accessed with var-get and var-set")
+("with-meta" . "(with-meta obj m) Returns an object of the same type and value as obj, with map m as its metadata.")
+("with-open" . "(with-open bindings & body) bindings => [name init ...]  Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order.")
+("with-out-str" . "(with-out-str & body) Evaluates exprs in a context in which *out* is bound to a fresh StringWriter.  Returns the string created by any nested printing calls.")
+("with-precision" . "(with-precision precision & exprs) Sets the precision and rounding mode to be used for BigDecimal operations.  Usage: (with-precision 10 (/ 1M 3)) or:    (with-precision 10 :rounding HALF_DOWN (/ 1M 3))  The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP.")
+("with-redefs" . "(with-redefs bindings & body) binding => var-symbol temp-value-expr  Temporarily redefines Vars while executing the body.  The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var.  After the body is executed, the root values of all the Vars will be set back to their old values.  These temporary changes will be visible in all threads. Useful for mocking out functions during testing.")
+("with-redefs-fn" . "(with-redefs-fn binding-map func) Temporarily redefines Vars during a call to func.  Each val of binding-map will replace the root value of its key which must be a Var.  After func is called with no args, the root values of all the Vars will be set back to their old values.  These temporary changes will be visible in all threads.  Useful for mocking out functions during testing.")
+("xml-seq" . "(xml-seq root) A tree seq on the xml elements as per xml/parse")
+("zero?" . "(zero? x) Returns true if num is zero, else false")
+("zipmap" . "(zipmap keys vals) Returns a map with the keys mapped to the corresponding vals.")))
+
+(provide 'cljdoc)
+
+;;; cljdoc.el ends here

File vendor/clojure-refactoring-mode.el

+/home/tavis/src/clojure-refactoring/src/clojure_refactoring/payload/clojure-refactoring-mode.el

File vendor/slime-frame-colors.el

+(require 'ansi-color)
+
+(defadvice sldb-insert-frame (around colorize-clj-trace (frame &optional face))
+  (progn
+    (ad-set-arg 0 (list (sldb-frame.number frame)
+                        (ansi-color-apply (sldb-frame.string frame))
+                        (sldb-frame.plist frame)))
+    ad-do-it
+    (save-excursion
+      (forward-line -1)
+      (skip-chars-forward "0-9 :")
+      (let ((beg-line (point)))
+        (end-of-line)
+        (remove-text-properties beg-line (point) '(face nil))))))
+
+(ad-activate #'sldb-insert-frame)
+
+(provide 'slime-frame-colors)

File vendor/slime-repl.el

+;;; slime-repl.el --- Read-Eval-Print Loop written in Emacs Lisp
+;;
+;; Original Author: Helmut Eller
+;; Contributors: to many to mention
+;; License: GNU GPL (same license as Emacs)
+;; URL: http://common-lisp.net/project/slime/
+;; Version: 20091016
+;; Keywords: languages, lisp, slime
+;; Package-Requires: ((slime "20091016"))
+;; Adapted-by: Phil Hagelberg
+;;
+;;; Description:
+;;
+;; This file implements a Lisp Listener along with some niceties like
+;; a persistent history and various "shortcut" commands.  Nothing here
+;; depends on comint.el; I/O is multiplexed over SLIME's socket.
+;;
+;; This used to be the default REPL for SLIME, but it was hard to
+;; maintain.
+;;
+;;; Installation:
+;;
+;; Call slime-setup and include 'slime-repl as argument: 
+;;
+;;  (slime-setup '(slime-repl [others conribs ...]))
+;;
+
+;;;;; slime-repl
+
+(defgroup slime-repl nil
+  "The Read-Eval-Print Loop (*slime-repl* buffer)."
+  :prefix "slime-repl-"
+  :group 'slime)
+
+(defcustom slime-repl-shortcut-dispatch-char ?\,
+  "Character used to distinguish repl commands from lisp forms."
+  :type '(character)
+  :group 'slime-repl)
+
+(defcustom slime-repl-only-save-lisp-buffers t
+  "When T we only attempt to save lisp-mode file buffers. When
+  NIL slime will attempt to save all buffers (as per
+  save-some-buffers). This applies to all ASDF related repl
+  shortcuts."
+  :type '(boolean)
+  :group 'slime-repl)
+
+(defface slime-repl-prompt-face
+  (if (slime-face-inheritance-possible-p)
+      '((t (:inherit font-lock-keyword-face)))
+    '((((class color) (background light)) (:foreground "Purple"))
+      (((class color) (background dark)) (:foreground "Cyan"))
+      (t (:weight bold))))
+  "Face for the prompt in the SLIME REPL."
+  :group 'slime-repl)
+
+(defface slime-repl-output-face
+  (if (slime-face-inheritance-possible-p)
+      '((t (:inherit font-lock-string-face)))
+    '((((class color) (background light)) (:foreground "RosyBrown"))
+      (((class color) (background dark)) (:foreground "LightSalmon"))
+      (t (:slant italic))))
+  "Face for Lisp output in the SLIME REPL."
+  :group 'slime-repl)
+
+(defface slime-repl-input-face
+  '((t (:bold t)))
+  "Face for previous input in the SLIME REPL."
+  :group 'slime-repl)
+
+(defface slime-repl-result-face
+  '((t ()))
+  "Face for the result of an evaluation in the SLIME REPL."
+  :group 'slime-repl)
+
+(defcustom slime-repl-history-file "~/.slime-history.eld"
+  "File to save the persistent REPL history to."
+  :type 'string
+  :group 'slime-repl)
+
+(defcustom slime-repl-history-size 200
+  "*Maximum number of lines for persistent REPL history."
+  :type 'integer
+  :group 'slime-repl)
+
+(defcustom slime-repl-history-file-coding-system 
+  (cond ((slime-find-coding-system 'utf-8-unix) 'utf-8-unix)
+        (t slime-net-coding-system))
+  "*The coding system for the history file."
+  :type 'symbol
+  :group 'slime-repl)
+
+
+;; dummy defvar for compiler
+(defvar slime-repl-read-mode)
+
+(defun slime-reading-p ()
+  "True if Lisp is currently reading input from the REPL."
+  (with-current-buffer (slime-output-buffer)
+    slime-repl-read-mode))
+
+
+;;;; Stream output
+
+(slime-def-connection-var slime-connection-output-buffer nil
+  "The buffer for the REPL.  May be nil or a dead buffer.")
+
+(make-variable-buffer-local
+ (defvar slime-output-start nil
+   "Marker for the start of the output for the evaluation."))
+
+(make-variable-buffer-local
+ (defvar slime-output-end nil
+   "Marker for end of output. New output is inserted at this mark."))
+
+;; dummy definitions for the compiler
+(defvar slime-repl-package-stack)
+(defvar slime-repl-directory-stack)
+(defvar slime-repl-input-start-mark)
+(defvar slime-repl-prompt-start-mark)
+
+(defun slime-output-buffer (&optional noprompt)
+  "Return the output buffer, create it if necessary."
+  (let ((buffer (slime-connection-output-buffer)))
+    (or (if (buffer-live-p buffer) buffer)
+        (setf (slime-connection-output-buffer)
+              (let ((connection (slime-connection)))
+                (with-current-buffer (slime-repl-buffer t connection)
+                  (unless (eq major-mode 'slime-repl-mode) 
+                    (slime-repl-mode))
+                  (setq slime-buffer-connection connection)
+		  (setq slime-buffer-package (slime-lisp-package connection))
+                  (slime-reset-repl-markers)
+                  (unless noprompt 
+                    (slime-repl-insert-prompt))
+                  (current-buffer)))))))
+
+(defvar slime-repl-banner-function 'slime-repl-insert-banner)
+
+(defun slime-repl-update-banner ()
+  (funcall slime-repl-banner-function)
+  (goto-char (point-max))
+  (slime-mark-output-start)
+  (slime-mark-input-start)
+  (slime-repl-insert-prompt))
+
+(defun slime-repl-insert-banner ()
+  (when (zerop (buffer-size))
+    (let ((welcome (concat "; SLIME " (or (slime-changelog-date)
+                                          "- ChangeLog file not found"))))
+      (insert welcome))))
+
+(defun slime-init-output-buffer (connection)
+  (with-current-buffer (slime-output-buffer t)
+    (setq slime-buffer-connection connection
+          slime-repl-directory-stack '()
+          slime-repl-package-stack '())
+    (slime-repl-update-banner)))
+
+(defun slime-display-output-buffer ()
+  "Display the output buffer and scroll to bottom."
+  (with-current-buffer (slime-output-buffer)
+    (goto-char (point-max))
+    (unless (get-buffer-window (current-buffer) t)
+      (display-buffer (current-buffer) t))
+    (slime-repl-show-maximum-output)))
+
+(defmacro slime-with-output-end-mark (&rest body)
+  "Execute BODY at `slime-output-end'.  
+
+If point is initially at `slime-output-end' and the buffer is visible
+update window-point afterwards.  If point is initially not at
+`slime-output-end, execute body inside a `save-excursion' block."
+  `(let ((body.. (lambda () ,@body))
+         (updatep.. (and (eobp) (pos-visible-in-window-p))))
+     (cond ((= (point) slime-output-end)
+            (let ((start.. (point)))
+              (funcall body..)
+              (set-marker slime-output-end (point))
+              (when (= start.. slime-repl-input-start-mark) 
+                (set-marker slime-repl-input-start-mark (point)))))
+           (t 
+            (save-excursion 
+              (goto-char slime-output-end)
+              (funcall body..))))
+     (when updatep..
+       (slime-repl-show-maximum-output))))
+
+(defun slime-output-filter (process string)
+  (with-current-buffer (process-buffer process)
+    (when (and (plusp (length string))
+               (eq (process-status slime-buffer-connection) 'open))
+      (slime-write-string string))))
+
+(defvar slime-open-stream-hooks)
+
+(defun slime-open-stream-to-lisp (port)
+  (let ((stream (open-network-stream "*lisp-output-stream*" 
+                                     (slime-with-connection-buffer ()
+                                       (current-buffer))
+				     slime-lisp-host port)))
+    (slime-set-query-on-exit-flag stream)
+    (set-process-filter stream 'slime-output-filter)
+    (let ((pcs (process-coding-system (slime-current-connection))))
+      (set-process-coding-system stream (car pcs) (cdr pcs)))
+    (when-let (secret (slime-secret))
+      (slime-net-send secret stream))
+    (run-hook-with-args 'slime-open-stream-hooks stream)
+    stream))
+
+(defun slime-io-speed-test (&optional profile)
+  "A simple minded benchmark for stream performance.
+If a prefix argument is given, instrument the slime package for
+profiling before running the benchmark."
+  (interactive "P")
+  (eval-and-compile
+    (require 'elp))
+  (elp-reset-all)
+  (elp-restore-all)
+  (load "slime.el")
+  ;;(byte-compile-file "slime-net.el" t)
+  ;;(setq slime-log-events nil)
+  (setq slime-enable-evaluate-in-emacs t)
+  ;;(setq slime-repl-enable-presentations nil)
+  (when profile
+    (elp-instrument-package "slime-"))
+  (kill-buffer (slime-output-buffer))
+  (switch-to-buffer (slime-output-buffer))
+  (delete-other-windows)
+  (sit-for 0)
+  (slime-repl-send-string "(swank:io-speed-test 4000 1)")
+  (let ((proc (slime-inferior-process)))
+    (when proc
+      (display-buffer (process-buffer proc) t)
+      (goto-char (point-max)))))
+
+(defvar slime-write-string-function 'slime-repl-write-string)
+
+(defun slime-write-string (string &optional target)
+  "Insert STRING in the REPL buffer or some other TARGET.
+If TARGET is nil, insert STRING as regular process
+output.  If TARGET is :repl-result, insert STRING as the result of the
+evaluation.  Other values of TARGET map to an Emacs marker via the 
+hashtable `slime-output-target-to-marker'; output is inserted at this marker."
+  (funcall slime-write-string-function string target))
+
+(defun slime-repl-write-string (string &optional target)
+  (case target
+    ((nil) (slime-repl-emit string))
+    (:repl-result (slime-repl-emit-result string))
+    (t (slime-emit-string string target))))
+
+(defvar slime-repl-popup-on-output nil
+  "Display the output buffer when some output is written.
+This is set to nil after displaying the buffer.")
+
+(defmacro slime-save-marker (marker &rest body)
+  (let ((pos (gensym "pos")))
+  `(let ((,pos (marker-position ,marker)))
+     (prog1 (progn . ,body)
+       (set-marker ,marker ,pos)))))
+
+(put 'slime-save-marker 'lisp-indent-function 1)
+
+(defun slime-repl-emit (string)
+  ;; insert the string STRING in the output buffer
+  (with-current-buffer (slime-output-buffer)
+    (save-excursion
+      (goto-char slime-output-end)
+      (slime-save-marker slime-output-start
+        (slime-propertize-region '(face slime-repl-output-face 
+                                        rear-nonsticky (face))
+          (insert-before-markers string)
+          (when (and (= (point) slime-repl-prompt-start-mark)
+                     (not (bolp)))
+            (insert-before-markers "\n")
+            (set-marker slime-output-end (1- (point)))))))
+    (when slime-repl-popup-on-output
+      (setq slime-repl-popup-on-output nil)
+      (display-buffer (current-buffer)))
+    (slime-repl-show-maximum-output)))
+
+(defun slime-repl-emit-result (string &optional bol)
+  ;; insert STRING and mark it as evaluation result
+  (with-current-buffer (slime-output-buffer)
+    (save-excursion
+      (slime-save-marker slime-output-start
+        (slime-save-marker slime-output-end
+          (goto-char slime-repl-input-start-mark)
+          (when (and bol (not (bolp))) (insert-before-markers "\n"))
+          (slime-propertize-region `(face slime-repl-result-face
+                                          rear-nonsticky (face))
+            (insert-before-markers string)))))
+    (slime-repl-show-maximum-output)))
+
+(defvar slime-last-output-target-id 0
+  "The last integer we used as a TARGET id.")
+
+(defvar slime-output-target-to-marker
+  (make-hash-table)
+  "Map from TARGET ids to Emacs markers.
+The markers indicate where output should be inserted.")
+
+(defun slime-output-target-marker (target)
+  "Return the marker where output for TARGET should be inserted."
+  (case target
+    ((nil)
+     (with-current-buffer (slime-output-buffer)
+       slime-output-end))
+    (:repl-result
+     (with-current-buffer (slime-output-buffer)
+       slime-repl-input-start-mark))
+    (t
+     (gethash target slime-output-target-to-marker))))
+
+(defun slime-emit-string (string target)
+  "Insert STRING at target TARGET.
+See `slime-output-target-to-marker'."
+  (let* ((marker (slime-output-target-marker target))
+         (buffer (and marker (marker-buffer marker))))
+    (when buffer
+      (with-current-buffer buffer
+        (save-excursion 
+          ;; Insert STRING at MARKER, then move MARKER behind
+          ;; the insertion.
+          (goto-char marker)
+          (insert-before-markers string)
+          (set-marker marker (point)))))))
+
+(defun slime-switch-to-output-buffer ()
+  "Select the output buffer, when possible in an existing window.
+
+Hint: You can use `display-buffer-reuse-frames' and
+`special-display-buffer-names' to customize the frame in which
+the buffer should appear."
+  (interactive)
+  (slime-pop-to-buffer (slime-output-buffer))
+  (goto-char (point-max)))
+
+
+;;;; REPL
+;;
+;; The REPL uses some markers to separate input from output.  The
+;; usual configuration is as follows:
+;; 
+;;    ... output ...    ... result ...    prompt> ... input ...
+;;    ^            ^                      ^       ^           ^
+;;    output-start output-end  prompt-start       input-start point-max
+;;
+;; input-start is a right inserting marker, because
+;; we want it to stay behind when the user inserts text.
+;;
+;; We maintain the following invariant:
+;;
+;;  output-start <= output-end <= input-start.
+;;
+;; This invariant is important, because we must be prepared for
+;; asynchronous output and asynchronous reads.  ("Asynchronous" means,
+;; triggered by Lisp and not by Emacs.)
+;;
+;; All output is inserted at the output-end marker.  Some care must be
+;; taken when output-end and input-start are at the same position: if
+;; we insert at that point, we must move the right markers.  We should
+;; also not leave (window-)point in the middle of the new output.  The
+;; idiom we use is a combination to slime-save-marker,
+;; insert-before-markers, and manually updating window-point
+;; afterwards.
+;;
+;; A "synchronous" evaluation request proceeds as follows: the user
+;; inserts some text between input-start and point-max and then hits
+;; return.  We send that region to Lisp, move the output and input
+;; makers to the line after the input and wait.  When we receive the
+;; result, we insert it together with a prompt between the output-end
+;; and input-start mark.  See `slime-repl-insert-prompt'.
+;;
+;; It is possible that some output for such an evaluation request
+;; arrives after the result.  This output is inserted before the
+;; result (and before the prompt). 
+;;
+;; If we are in "reading" state, e.g., during a call to Y-OR-N-P,
+;; there is no prompt between output-end and input-start.
+;;
+
+;; FIXME: slime-lisp-package should be local in a REPL buffer
+(slime-def-connection-var slime-lisp-package
+    "COMMON-LISP-USER"
+  "The current package name of the Superior lisp.
+This is automatically synchronized from Lisp.")
+
+(slime-def-connection-var slime-lisp-package-prompt-string
+    "CL-USER"
+  "The current package name of the Superior lisp.
+This is automatically synchronized from Lisp.")
+
+(slime-make-variables-buffer-local
+ (defvar slime-repl-package-stack nil
+   "The stack of packages visited in this repl.")
+
+ (defvar slime-repl-directory-stack nil
+   "The stack of default directories associated with this repl.")
+
+ (defvar slime-repl-prompt-start-mark)
+ (defvar slime-repl-input-start-mark)
+ (defvar slime-repl-old-input-counter 0
+   "Counter used to generate unique `slime-repl-old-input' properties.
+This property value must be unique to avoid having adjacent inputs be
+joined together."))
+
+(defun slime-reset-repl-markers ()
+  (dolist (markname '(slime-output-start
+                      slime-output-end
+                      slime-repl-prompt-start-mark
+                      slime-repl-input-start-mark))
+    (set markname (make-marker))
+    (set-marker (symbol-value markname) (point))))
+
+;;;;; REPL mode setup
+
+(defvar slime-repl-mode-map)
+
+(let ((map (copy-keymap slime-parent-map)))
+  (set-keymap-parent map lisp-mode-map)
+  (setq slime-repl-mode-map (make-sparse-keymap))
+  (set-keymap-parent slime-repl-mode-map map)
+  (loop for (key command) in slime-editing-keys
+        do (define-key slime-repl-mode-map key command)))
+
+(slime-define-keys slime-prefix-map
+  ("\C-z" 'slime-switch-to-output-buffer)
+  ("\M-p" 'slime-repl-set-package))
+
+(slime-define-keys slime-mode-map 
+  ("\C-c~" 'slime-sync-package-and-default-directory)
+  ("\C-c\C-y" 'slime-call-defun))
+
+(slime-define-keys slime-connection-list-mode-map
+  ((kbd "RET") 'slime-goto-connection)
+  ([return] 'slime-goto-connection))
+
+(slime-define-keys slime-repl-mode-map
+  ("\C-m" 'slime-repl-return)
+  ([return] 'slime-repl-return)
+  ("\C-j" 'slime-repl-newline-and-indent)
+  ("\C-\M-m" 'slime-repl-closing-return)
+  ([(control return)] 'slime-repl-closing-return)
+  ("\C-a" 'slime-repl-bol)
+  ([home] 'slime-repl-bol)
+  ("\M-p" 'slime-repl-previous-input)
+  ((kbd "C-<up>") 'slime-repl-backward-input)
+  ("\M-n" 'slime-repl-next-input)
+  ((kbd "C-<down>") 'slime-repl-forward-input)
+  ("\M-r" 'slime-repl-previous-matching-input)
+  ("\M-s" 'slime-repl-next-matching-input)
+  ("\C-c\C-c" 'slime-interrupt)
+  ;("\t"   'slime-complete-symbol)
+  ("\t"   'slime-indent-and-complete-symbol)
+  ("\M-\t" 'slime-complete-symbol)
+  (" "    'slime-space)
+  ("\C-c\C-o" 'slime-repl-clear-output)
+  ("\C-c\M-o" 'slime-repl-clear-buffer)
+  ("\C-c\C-u" 'slime-repl-kill-input)
+  ("\C-c\C-n" 'slime-repl-next-prompt)
+  ("\C-c\C-p" 'slime-repl-previous-prompt)
+  ("\C-c\C-z" 'slime-nop))
+
+(slime-define-keys slime-inspector-mode-map
+  ((kbd "M-RET") 'slime-inspector-copy-down-to-repl))
+
+(def-slime-selector-method ?r
+  "SLIME Read-Eval-Print-Loop."
+  (slime-output-buffer))
+
+(defun slime-repl-mode () 
+  "Major mode for interacting with a superior Lisp.
+\\{slime-repl-mode-map}"
+  (interactive)
+  (kill-all-local-variables)
+  (setq major-mode 'slime-repl-mode)
+  (use-local-map slime-repl-mode-map)
+  (lisp-mode-variables t)
+  (set (make-local-variable 'lisp-indent-function)
+       'common-lisp-indent-function)
+  (setq font-lock-defaults nil)
+  (setq mode-name "REPL")
+  (setq slime-current-thread :repl-thread)
+  (set (make-local-variable 'scroll-conservatively) 20)
+  (set (make-local-variable 'scroll-margin) 0)
+  (when slime-repl-history-file
+    (slime-repl-safe-load-history)
+    (slime-add-local-hook 'kill-buffer-hook 
+                          'slime-repl-safe-save-merged-history))
+  (add-hook 'kill-emacs-hook 'slime-repl-save-all-histories)
+  (slime-setup-command-hooks)
+  ;; At the REPL, we define beginning-of-defun and end-of-defun to be
+  ;; the start of the previous prompt or next prompt respectively.
+  ;; Notice the interplay with SLIME-REPL-BEGINNING-OF-DEFUN.
+  (set (make-local-variable 'beginning-of-defun-function) 
+       'slime-repl-mode-beginning-of-defun)
+  (set (make-local-variable 'end-of-defun-function) 
+       'slime-repl-mode-end-of-defun)
+  (slime-run-mode-hooks 'slime-repl-mode-hook))
+
+(defun slime-repl-buffer (&optional create connection)
+  "Get the REPL buffer for the current connection; optionally create."
+  (funcall (if create #'get-buffer-create #'get-buffer)
+           (format "*slime-repl %s*" (slime-connection-name connection))))
+
+(defun slime-repl ()
+  (interactive)
+  (slime-switch-to-output-buffer))
+
+(defun slime-repl-mode-beginning-of-defun ()
+  (slime-repl-previous-prompt)
+  t)
+
+(defun slime-repl-mode-end-of-defun ()
+  (slime-repl-next-prompt)
+  t)
+
+(defun slime-repl-send-string (string &optional command-string)
+  (cond (slime-repl-read-mode
+         (slime-repl-return-string string))
+        (t (slime-repl-eval-string string))))
+
+(defun slime-repl-eval-string (string)
+  (slime-rex ()
+      ((list 'swank:listener-eval string) (slime-lisp-package))
+    ((:ok result)
+     (slime-repl-insert-result result))
+    ((:abort)
+     (slime-repl-show-abort))))
+
+(defun slime-repl-insert-result (result)
+  (with-current-buffer (slime-output-buffer)
+    (save-excursion
+      (when result
+        (destructure-case result
+          ((:values &rest strings)
+           (cond ((null strings)
+                  (slime-repl-emit-result "; No value\n" t))
+                 (t
+                  (dolist (s strings)
+                    (slime-repl-emit-result s t)))))))
+      (slime-repl-insert-prompt))
+    (slime-repl-show-maximum-output)))
+
+(defun slime-repl-show-abort ()
+  (with-current-buffer (slime-output-buffer)
+    (save-excursion
+      (slime-save-marker slime-output-start
+        (slime-save-marker slime-output-end
+          (goto-char slime-output-end)
+          (insert-before-markers "; Evaluation aborted.\n")
+          (slime-repl-insert-prompt))))
+    (slime-repl-show-maximum-output)))
+
+(defun slime-repl-insert-prompt ()
+  "Insert the prompt (before markers!).
+Set point after the prompt.  
+Return the position of the prompt beginning."
+  (goto-char slime-repl-input-start-mark)
+  (slime-save-marker slime-output-start
+    (slime-save-marker slime-output-end
+      (unless (bolp) (insert-before-markers "\n"))
+      (let ((prompt-start (point))
+            (prompt (format "%s> " (slime-lisp-package-prompt-string))))
+        (slime-propertize-region
+            '(face slime-repl-prompt-face read-only t intangible t
+                   slime-repl-prompt t
+                   ;; emacs stuff
+                   rear-nonsticky (slime-repl-prompt read-only face intangible)
+                   ;; xemacs stuff
+                   start-open t end-open t)
+          (insert-before-markers prompt))
+        (set-marker slime-repl-prompt-start-mark prompt-start)
+        prompt-start))))
+
+(defun slime-repl-show-maximum-output ()
+  "Put the end of the buffer at the bottom of the window."
+  (when (eobp)
+    (let ((win (get-buffer-window (current-buffer))))
+      (when win
+        (with-selected-window win
+          (set-window-point win (point-max)) 
+          (recenter -1))))))
+
+(defvar slime-repl-current-input-hooks)
+
+(defun slime-repl-current-input (&optional until-point-p)
+  "Return the current input as string.
+The input is the region from after the last prompt to the end of
+buffer."
+  (or (run-hook-with-args-until-success 'slime-repl-current-input-hooks 
+                                        until-point-p)
+      (buffer-substring-no-properties slime-repl-input-start-mark 
+                                      (if until-point-p 
+                                          (point) 
+                                        (point-max)))))
+
+(defun slime-property-position (text-property &optional object)
+  "Return the first position of TEXT-PROPERTY, or nil."
+  (if (get-text-property 0 text-property object)
+      0
+    (next-single-property-change 0 text-property object)))
+  
+(defun slime-mark-input-start ()
+  (set-marker slime-repl-input-start-mark (point) (current-buffer)))
+
+(defun slime-mark-output-start ()
+  (set-marker slime-output-start (point))
+  (set-marker slime-output-end (point)))
+
+(defun slime-mark-output-end ()
+  ;; Don't put slime-repl-output-face again; it would remove the
+  ;; special presentation face, for instance in the SBCL inspector.
+  (add-text-properties slime-output-start slime-output-end
+                       '(;;face slime-repl-output-face 
+                         rear-nonsticky (face))))
+
+(defun slime-repl-bol ()
+  "Go to the beginning of line or the prompt."
+  (interactive)
+  (cond ((and (>= (point) slime-repl-input-start-mark)
+              (slime-same-line-p (point) slime-repl-input-start-mark))
+         (goto-char slime-repl-input-start-mark))
+        (t (beginning-of-line 1)))
+  (slime-preserve-zmacs-region))
+
+(defun slime-preserve-zmacs-region ()
+  "In XEmacs, ensure that the zmacs-region stays active after this command."
+  (when (boundp 'zmacs-region-stays)
+    (set 'zmacs-region-stays t)))
+
+(defun slime-repl-in-input-area-p ()
+   (<= slime-repl-input-start-mark (point)))
+
+(defun slime-repl-at-prompt-start-p ()
+  ;; This will not work on non-current prompts.
+  (= (point) slime-repl-input-start-mark))
+
+(defun slime-repl-beginning-of-defun ()
+  "Move to beginning of defun."
+  (interactive)
+  ;; We call BEGINNING-OF-DEFUN if we're at the start of a prompt
+  ;; already, to trigger SLIME-REPL-MODE-BEGINNING-OF-DEFUN by means
+  ;; of the locally bound BEGINNING-OF-DEFUN-FUNCTION, in order to
+  ;; jump to the start of the previous prompt.
+  (if (and (not (slime-repl-at-prompt-start-p))
+           (slime-repl-in-input-area-p))
+      (goto-char slime-repl-input-start-mark)
+    (beginning-of-defun))
+  t)
+
+;; FIXME: this looks very strange
+(defun slime-repl-end-of-defun ()
+  "Move to next of defun."
+  (interactive)
+  ;; C.f. SLIME-REPL-BEGINNING-OF-DEFUN.
+  (if (and (not (= (point) (point-max))) 
+           (slime-repl-in-input-area-p))
+      (goto-char (point-max))
+    (end-of-defun))
+  t)
+
+(defun slime-repl-previous-prompt ()
+  "Move backward to the previous prompt."
+  (interactive)
+  (slime-repl-find-prompt t))
+
+(defun slime-repl-next-prompt ()
+  "Move forward to the next prompt."
+  (interactive)
+  (slime-repl-find-prompt))
+ 
+(defun slime-repl-find-prompt (&optional backward)
+  (let ((origin (point))
+        (prop 'slime-repl-prompt))
+    (while (progn 
+             (slime-search-property-change prop backward)
+             (not (or (slime-end-of-proprange-p prop) (bobp) (eobp)))))
+    (unless (slime-end-of-proprange-p prop)
+      (goto-char origin))))
+
+(defun slime-search-property-change (prop &optional backward)
+  (cond (backward 
+         (goto-char (previous-single-char-property-change (point) prop)))
+        (t 
+         (goto-char (next-single-char-property-change (point) prop)))))
+
+(defun slime-end-of-proprange-p (property)
+  (and (get-char-property (max 1 (1- (point))) property)
+       (not (get-char-property (point) property))))
+
+(defvar slime-repl-return-hooks)
+
+(defun slime-repl-return (&optional end-of-input)
+  "Evaluate the current input string, or insert a newline.  
+Send the current input ony if a whole expression has been entered,
+i.e. the parenthesis are matched. 
+
+With prefix argument send the input even if the parenthesis are not
+balanced."
+  (interactive "P")
+  (slime-check-connected)
+  (cond (end-of-input
+         (slime-repl-send-input))
+        (slime-repl-read-mode ; bad style?
+         (slime-repl-send-input t))
+        ((and (get-text-property (point) 'slime-repl-old-input)
+              (< (point) slime-repl-input-start-mark))
+         (slime-repl-grab-old-input end-of-input)
+         (slime-repl-recenter-if-needed))
+        ((run-hook-with-args-until-success 'slime-repl-return-hooks))
+        ((slime-input-complete-p slime-repl-input-start-mark (point-max))
+         (slime-repl-send-input t))
+        (t 
+         (slime-repl-newline-and-indent)
+         (message "[input not complete]"))))
+
+(defun slime-repl-recenter-if-needed ()
+  "Make sure that (point) is visible."
+  (unless (pos-visible-in-window-p (point-max))
+    (save-excursion
+      (goto-char (point-max))
+      (recenter -1))))
+
+(defun slime-repl-send-input (&optional newline)
+  "Goto to the end of the input and send the current input.
+If NEWLINE is true then add a newline at the end of the input."
+  (unless (slime-repl-in-input-area-p)
+    (error "No input at point."))
+  (goto-char (point-max))
+  (let ((end (point))) ; end of input, without the newline
+    (slime-repl-add-to-input-history 
+     (buffer-substring slime-repl-input-start-mark end))
+    (when newline 
+      (insert "\n")
+      (slime-repl-show-maximum-output))
+    (let ((inhibit-modification-hooks t))
+      (add-text-properties slime-repl-input-start-mark 
+                           (point)
+                           `(slime-repl-old-input
+                             ,(incf slime-repl-old-input-counter))))
+    (let ((overlay (make-overlay slime-repl-input-start-mark end)))
+      ;; These properties are on an overlay so that they won't be taken
+      ;; by kill/yank.
+      (overlay-put overlay 'read-only t)
+      (overlay-put overlay 'face 'slime-repl-input-face)))
+  (let ((input (slime-repl-current-input)))
+    (goto-char (point-max))
+    (slime-mark-input-start)
+    (slime-mark-output-start)
+    (slime-repl-send-string input)))
+
+(defun slime-repl-grab-old-input (replace)
+  "Resend the old REPL input at point.  
+If replace is non-nil the current input is replaced with the old
+input; otherwise the new input is appended.  The old input has the
+text property `slime-repl-old-input'."
+  (multiple-value-bind (beg end) (slime-property-bounds 'slime-repl-old-input)
+    (let ((old-input (buffer-substring beg end)) ;;preserve
+          ;;properties, they will be removed later
+          (offset (- (point) beg)))
+      ;; Append the old input or replace the current input
+      (cond (replace (goto-char slime-repl-input-start-mark))
+            (t (goto-char (point-max))
+               (unless (eq (char-before) ?\ )
+                 (insert " "))))
+      (delete-region (point) (point-max))
+      (save-excursion 
+        (insert old-input)
+        (when (equal (char-before) ?\n) 
+          (delete-char -1)))
+      (forward-char offset))))
+
+(defun slime-repl-closing-return ()
+  "Evaluate the current input string after closing all open lists."
+  (interactive)
+  (goto-char (point-max))
+  (save-restriction
+    (narrow-to-region slime-repl-input-start-mark (point))
+    (while (ignore-errors (save-excursion (backward-up-list 1)) t)
+      (insert ")")))
+  (slime-repl-return))
+
+(defun slime-repl-newline-and-indent ()
+  "Insert a newline, then indent the next line.
+Restrict the buffer from the prompt for indentation, to avoid being
+confused by strange characters (like unmatched quotes) appearing
+earlier in the buffer."
+  (interactive)
+  (save-restriction
+    (narrow-to-region slime-repl-prompt-start-mark (point-max))
+    (insert "\n")
+    (lisp-indent-line)))
+
+(defun slime-repl-delete-current-input ()
+  "Delete all text from the prompt."
+  (interactive)
+  (delete-region slime-repl-input-start-mark (point-max)))
+
+(defun slime-repl-kill-input ()
+  "Kill all text from the prompt to point."
+  (interactive)
+  (cond ((< (marker-position slime-repl-input-start-mark) (point))
+         (kill-region slime-repl-input-start-mark (point)))
+        ((= (point) (marker-position slime-repl-input-start-mark))
+         (slime-repl-delete-current-input))))
+
+(defun slime-repl-replace-input (string)
+  (slime-repl-delete-current-input)
+  (insert-and-inherit string))
+
+(defun slime-repl-input-line-beginning-position ()
+  (save-excursion
+    (goto-char slime-repl-input-start-mark)
+    (line-beginning-position)))
+
+(defvar slime-repl-clear-buffer-hook)
+
+(defun slime-repl-clear-buffer ()
+  "Delete the output generated by the Lisp process."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (delete-region (point-min) slime-repl-prompt-start-mark)
+    (delete-region slime-output-start slime-output-end)
+    (when (< (point) slime-repl-input-start-mark)
+      (goto-char slime-repl-input-start-mark))
+    (recenter t))
+  (run-hooks 'slime-repl-clear-buffer-hook))
+
+(defun slime-repl-clear-output ()
+  "Delete the output inserted since the last input."
+  (interactive)
+  (let ((start (save-excursion 
+                 (slime-repl-previous-prompt)
+                 (ignore-errors (forward-sexp))
+                 (forward-line)
+                 (point)))
+        (end (1- (slime-repl-input-line-beginning-position))))
+    (when (< start end)
+      (let ((inhibit-read-only t))
+        (delete-region start end)
+        (save-excursion
+          (goto-char start)
+          (insert ";;; output flushed"))))))
+
+(defun slime-repl-set-package (package)
+  "Set the package of the REPL buffer to PACKAGE."
+  (interactive (list (let* ((p (slime-current-package))
+                            (p (and p (slime-pretty-package-name p)))
+                            (p (and (not (equal p (slime-lisp-package))) p)))
+                       (slime-read-package-name "Package: " p))))
+  (with-current-buffer (slime-output-buffer)
+    (let ((previouse-point (- (point) slime-repl-input-start-mark)))
+      (destructuring-bind (name prompt-string)
+          (slime-repl-shortcut-eval `(swank:set-package ,package))
+        (setf (slime-lisp-package) name)
+        (setf (slime-lisp-package-prompt-string) prompt-string)
+        (setf slime-buffer-package name)
+        (slime-repl-insert-prompt)
+        (when (plusp previouse-point)
+          (goto-char (+ previouse-point slime-repl-input-start-mark)))))))
+
+
+;;;;; History
+
+(defcustom slime-repl-wrap-history nil
+  "*T to wrap history around when the end is reached."
+  :type 'boolean
+  :group 'slime-repl)
+
+(make-variable-buffer-local
+ (defvar slime-repl-input-history '()
+   "History list of strings read from the REPL buffer."))
+
+(defun slime-repl-add-to-input-history (string)
+  "Add STRING to the input history.
+Empty strings and duplicates are ignored."
+  (unless (or (equal string "")
+              (equal string (car slime-repl-input-history)))
+    (push string slime-repl-input-history)))
+
+;; These two vars contain the state of the last history search.  We
+;; only use them if `last-command' was 'slime-repl-history-replace,
+;; otherwise we reinitialize them.
+
+(defvar slime-repl-input-history-position -1
+  "Newer items have smaller indices.")
+
+(defvar slime-repl-history-pattern nil
+  "The regexp most recently used for finding input history.")
+
+(defun slime-repl-history-replace (direction &optional regexp)
+  "Replace the current input with the next line in DIRECTION.
+DIRECTION is 'forward' or 'backward' (in the history list).
+If REGEXP is non-nil, only lines matching REGEXP are considered."
+  (setq slime-repl-history-pattern regexp)
+  (let* ((min-pos -1)
+         (max-pos (length slime-repl-input-history))
+         (pos0 (cond ((slime-repl-history-search-in-progress-p)
+                      slime-repl-input-history-position)
+                     (t min-pos)))
+         (pos (slime-repl-position-in-history pos0 direction (or regexp "")))
+         (msg nil))
+    (cond ((and (< min-pos pos) (< pos max-pos))
+           (slime-repl-replace-input (nth pos slime-repl-input-history))
+           (setq msg (format "History item: %d" pos)))
+          ((not slime-repl-wrap-history)
+           (setq msg (cond ((= pos min-pos) "End of history")
+                           ((= pos max-pos) "Beginning of history"))))
+          (slime-repl-wrap-history
+           (setq pos (if (= pos min-pos) max-pos min-pos))
+           (setq msg "Wrapped history")))
+    (when (or (<= pos min-pos) (<= max-pos pos))
+      (when regexp
+        (setq msg (concat msg "; no matching item"))))
+    ;;(message "%s [%d %d %s]" msg start-pos pos regexp)
+    (message "%s%s" msg (cond ((not regexp) "")
+                              (t (format "; current regexp: %s" regexp))))
+    (setq slime-repl-input-history-position pos)
+    (setq this-command 'slime-repl-history-replace)))
+
+(defun slime-repl-history-search-in-progress-p ()
+  (eq last-command 'slime-repl-history-replace))
+
+(defun slime-repl-terminate-history-search ()
+  (setq last-command this-command))
+
+(defun slime-repl-position-in-history (start-pos direction regexp)
+  "Return the position of the history item matching regexp.
+Return -1 resp. the length of the history if no item matches"
+  ;; Loop through the history list looking for a matching line
+  (let* ((step (ecase direction
+                 (forward -1)
+                 (backward 1)))
+         (history slime-repl-input-history)
+         (len (length history)))
+    (loop for pos = (+ start-pos step) then (+ pos step)
+          if (< pos 0) return -1
+          if (<= len pos) return len
+          if (string-match regexp (nth pos history)) return pos)))
+
+(defun slime-repl-previous-input ()
+  "Cycle backwards through input history.
+If the `last-command' was a history navigation command use the
+same search pattern for this command.
+Otherwise use the current input as search pattern."
+  (interactive)
+  (slime-repl-history-replace 'backward (slime-repl-history-pattern t)))
+
+(defun slime-repl-next-input ()
+  "Cycle forwards through input history.
+See `slime-repl-previous-input'."
+  (interactive)
+  (slime-repl-history-replace 'forward (slime-repl-history-pattern t)))
+
+(defun slime-repl-forward-input ()
+  "Cycle forwards through input history."
+  (interactive)
+  (slime-repl-history-replace 'forward (slime-repl-history-pattern)))
+
+(defun slime-repl-backward-input ()
+  "Cycle backwards through input history."
+  (interactive)
+  (slime-repl-history-replace 'backward (slime-repl-history-pattern)))
+
+(defun slime-repl-previous-matching-input (regexp)
+  (interactive "sPrevious element matching (regexp): ")
+  (slime-repl-terminate-history-search)
+  (slime-repl-history-replace 'backward regexp))
+
+(defun slime-repl-next-matching-input (regexp)
+  (interactive "sNext element matching (regexp): ")
+  (slime-repl-terminate-history-search)
+  (slime-repl-history-replace 'forward regexp))
+
+(defun slime-repl-history-pattern (&optional use-current-input)
+  "Return the regexp for the navigation commands."
+  (cond ((slime-repl-history-search-in-progress-p)
+         slime-repl-history-pattern)
+        (use-current-input
+         (assert (<= slime-repl-input-start-mark (point)))
+         (let ((str (slime-repl-current-input t)))
+           (cond ((string-match "^[ \n]*$" str) nil)
+                 (t (concat "^" (regexp-quote str))))))
+        (t nil)))
+
+(defun slime-repl-delete-from-input-history (string)
+  "Delete STRING from the repl input history. 
+
+When string is not provided then clear the current repl input and
+use it as an input.  This is useful to get rid of unwanted repl
+history entries while navigating the repl history."
+  (interactive (list (slime-repl-current-input)))
+  (let ((merged-history 
+         (slime-repl-merge-histories slime-repl-input-history
+                                     (slime-repl-read-history nil t))))
+    (setq slime-repl-input-history
+          (delete* string merged-history :test #'string=))
+    (slime-repl-save-history))
+  (slime-repl-delete-current-input))
+
+;;;;; Persistent History 
+
+(defun slime-repl-merge-histories (old-hist new-hist)
+  "Merge entries from OLD-HIST and NEW-HIST."
+  ;; Newer items in each list are at the beginning.
+  (let* ((ht (make-hash-table :test #'equal))
+         (test (lambda (entry)
+                 (or (gethash entry ht)
+                     (progn (setf (gethash entry ht) t)
+                            nil)))))
+    (append (remove-if test new-hist)
+            (remove-if test old-hist))))
+
+(defun slime-repl-load-history (&optional filename)
+  "Set the current SLIME REPL history.
+It can be read either from FILENAME or `slime-repl-history-file' or
+from a user defined filename."
+  (interactive (list (slime-repl-read-history-filename)))
+  (let ((file (or filename slime-repl-history-file)))
+    (setq slime-repl-input-history (slime-repl-read-history file t))))
+
+(defun slime-repl-read-history (&optional filename noerrer)
+  "Read and return the history from FILENAME.  
+The default value for FILENAME is `slime-repl-history-file'.
+If NOERROR is true return and the file doesn't exits return nil."
+  (let ((file (or filename slime-repl-history-file)))
+    (cond ((not (file-readable-p file)) '())
+          (t (with-temp-buffer
+               (insert-file-contents file)
+               (read (current-buffer)))))))
+
+(defun slime-repl-read-history-filename ()
+  (read-file-name "Use SLIME REPL history from file: " 
+                  slime-repl-history-file))
+
+(defun slime-repl-save-merged-history (&optional filename)
+  "Read the history file, merge the current REPL history and save it.
+This tries to be smart in merging the history from the file and the
+current history in that it tries to detect the unique entries using
+`slime-repl-merge-histories'."
+  (interactive (list (slime-repl-read-history-filename)))
+  (let ((file (or filename slime-repl-history-file)))
+    (with-temp-message "saving history..."
+      (let ((hist (slime-repl-merge-histories (slime-repl-read-history file t)
+                                              slime-repl-input-history)))
+        (slime-repl-save-history file hist)))))
+
+(defun slime-repl-save-history (&optional filename history)
+  "Simply save the current SLIME REPL history to a file.
+When SLIME is setup to always load the old history and one uses only
+one instance of slime all the time, there is no need to merge the
+files and this function is sufficient.
+
+When the list is longer than `slime-repl-history-size' it will be
+truncated.  That part is untested, though!"
+  (interactive (list (slime-repl-read-history-filename)))
+  (let ((file (or filename slime-repl-history-file))
+        (hist (or history slime-repl-input-history)))
+    (unless (file-writable-p file)
+      (error (format "History file not writable: %s" file)))
+    (let ((hist (subseq hist 0 (min (length hist) slime-repl-history-size))))
+      ;;(message "saving %s to %s\n" hist file)
+      (with-temp-file file
+        (let ((cs slime-repl-history-file-coding-system)
+              (print-length nil) (print-level nil))
+          (setq buffer-file-coding-system cs)
+          (insert (format ";; -*- coding: %s -*-\n" cs))
+          (insert ";; History for SLIME REPL. Automatically written.\n"
+                  ";; Edit only if you know what you're doing\n")
+          (prin1 (mapcar #'substring-no-properties hist) (current-buffer)))))))
+
+(defun slime-repl-save-all-histories ()
+  "Save the history in each repl buffer."
+  (dolist (b (buffer-list))
+    (with-current-buffer b
+      (when (eq major-mode 'slime-repl-mode)
+        (slime-repl-safe-save-merged-history)))))
+
+(defun slime-repl-safe-save-merged-history ()
+  (slime-repl-call-with-handler 
+   #'slime-repl-save-merged-history
+   "%S while saving the history. Continue? "))
+
+(defun slime-repl-safe-load-history ()
+  (slime-repl-call-with-handler 
+   #'slime-repl-load-history
+   "%S while loading the history. Continue? "))
+
+(defun slime-repl-call-with-handler (fun query)
+  "Call FUN in the context of an error handler.
+The handler will use qeuery to ask the use if the error should be ingored."
+  (condition-case err
+      (funcall fun)
+    (error 
+     (if (y-or-n-p (format query (error-message-string err)))
+         nil
+       (signal (car err) (cdr err))))))
+
+
+;;;;; REPL Read Mode
+
+(define-key slime-repl-mode-map
+  (string slime-repl-shortcut-dispatch-char) 'slime-handle-repl-shortcut)
+
+(define-minor-mode slime-repl-read-mode 
+  "Mode the read input from Emacs
+\\{slime-repl-read-mode-map}"
+  nil
+  "[read]"
+  '(("\C-m" . slime-repl-return)
+    ([return] . slime-repl-return)
+    ("\C-c\C-b" . slime-repl-read-break)
+    ("\C-c\C-c" . slime-repl-read-break)))
+
+(make-variable-buffer-local
+ (defvar slime-read-string-threads nil))
+
+(make-variable-buffer-local
+ (defvar slime-read-string-tags nil))
+
+(defun slime-repl-read-string (thread tag)
+  (slime-switch-to-output-buffer)
+  (push thread slime-read-string-threads)
+  (push tag slime-read-string-tags)
+  (goto-char (point-max))
+  (slime-mark-output-end)
+  (slime-mark-input-start)
+  (slime-repl-read-mode 1))
+
+(defun slime-repl-return-string (string)
+  (slime-dispatch-event `(:emacs-return-string 
+                          ,(pop slime-read-string-threads)
+                          ,(pop slime-read-string-tags)
+                          ,string))
+  (slime-repl-read-mode -1))
+
+(defun slime-repl-read-break ()
+  (interactive)
+  (slime-dispatch-event `(:emacs-interrupt ,(car slime-read-string-threads))))
+
+(defun slime-repl-abort-read (thread tag)
+  (with-current-buffer (slime-output-buffer)
+    (pop slime-read-string-threads)
+    (pop slime-read-string-tags)
+    (slime-repl-read-mode -1)
+    (message "Read aborted")))
+
+
+;;;;; REPL handlers
+
+(defstruct (slime-repl-shortcut (:conc-name slime-repl-shortcut.))
+  symbol names handler one-liner)
+
+(defvar slime-repl-shortcut-table nil
+  "A list of slime-repl-shortcuts")
+
+(defvar slime-repl-shortcut-history '()
+  "History list of shortcut command names.")
+
+(defvar slime-within-repl-shortcut-handler-p nil
+  "Bound to T if we're in a REPL shortcut handler invoked from the REPL.")
+
+(defun slime-handle-repl-shortcut ()
+  (interactive)
+  (if (> (point) slime-repl-input-start-mark)
+      (insert (string slime-repl-shortcut-dispatch-char))
+      (let ((shortcut (slime-lookup-shortcut
+                       (completing-read "Command: " 
+                                        (slime-bogus-completion-alist
+                                         (slime-list-all-repl-shortcuts))
+                                        nil t nil
+                                        'slime-repl-shortcut-history))))
+        (with-struct (slime-repl-shortcut. handler) shortcut
+          (let ((slime-within-repl-shortcut-handler-p t))
+            (call-interactively handler))))))
+
+(defun slime-list-all-repl-shortcuts ()
+  (loop for shortcut in slime-repl-shortcut-table
+        append (slime-repl-shortcut.names shortcut)))
+
+(defun slime-lookup-shortcut (name)
+  (find-if (lambda (s) (member name (slime-repl-shortcut.names s)))
+           slime-repl-shortcut-table))
+
+(defmacro defslime-repl-shortcut (elisp-name names &rest options)
+  "Define a new repl shortcut. ELISP-NAME is a symbol specifying
+the name of the interactive function to create, or NIL if no
+function should be created. 
+
+NAMES is a list of \(full-name . aliases\). 
+
+OPTIONS is an plist specifying the handler doing the actual work
+of the shortcut \(`:handler'\), and a help text \(`:one-liner'\)."
+  `(progn
+     ,(when elisp-name
+        `(defun ,elisp-name ()
+           (interactive)
+           (call-interactively ,(second (assoc :handler options)))))
+     (let ((new-shortcut (make-slime-repl-shortcut
+                          :symbol ',elisp-name
+                          :names (list ,@names)
+                          ,@(apply #'append options))))
+       (setq slime-repl-shortcut-table
+             (remove-if (lambda (s)
+                          (member ',(car names) (slime-repl-shortcut.names s)))
+                        slime-repl-shortcut-table))
+       (push new-shortcut slime-repl-shortcut-table)
+       ',elisp-name)))
+
+(defun slime-repl-shortcut-eval (sexp &optional package)
+  "This function should be used by REPL shortcut handlers instead
+of `slime-eval' to evaluate their final expansion. (This
+expansion will be added to the REPL's history.)"
+  (when slime-within-repl-shortcut-handler-p ; were we invoked via ,foo?
+    (slime-repl-add-to-input-history (prin1-to-string sexp)))
+  (slime-eval sexp package))
+
+(defun slime-repl-shortcut-eval-async (sexp &optional cont package)
+  "This function should be used by REPL shortcut handlers instead
+of `slime-eval-async' to evaluate their final expansion. (This
+expansion will be added to the REPL's history.)"
+  (when slime-within-repl-shortcut-handler-p ; were we invoked via ,foo?
+    (slime-repl-add-to-input-history (prin1-to-string sexp)))
+  (slime-eval-async sexp cont package))
+
+
+(defun slime-list-repl-short-cuts ()
+  (interactive)
+  (slime-with-popup-buffer ("*slime-repl-help*")
+    (let ((table (sort* (copy-list slime-repl-shortcut-table) #'string<
+                        :key (lambda (x) 
+                               (car (slime-repl-shortcut.names x))))))
+      (dolist (shortcut table)
+        (let ((names (slime-repl-shortcut.names shortcut)))
+          (insert (pop names)) ;; first print the "full" name
+          (when names
+            ;; we also have aliases
+            (insert " (aka ")
+            (while (cdr names)
+              (insert (pop names) ", "))
+            (insert (car names) ")"))
+        (insert "\n     " (slime-repl-shortcut.one-liner shortcut)
+                "\n"))))))
+
+(defun slime-save-some-lisp-buffers ()
+  (if slime-repl-only-save-lisp-buffers
+      (save-some-buffers nil (lambda ()
+                               (and (memq major-mode slime-lisp-modes)
+                                    (not (null buffer-file-name)))))
+      (save-some-buffers)))
+  
+
+(defslime-repl-shortcut slime-repl-shortcut-help ("help" "?")
+  (:handler 'slime-list-repl-short-cuts)
+  (:one-liner "Display the help."))
+
+(defslime-repl-shortcut nil ("change-directory" "!d" "cd")
+  (:handler 'slime-set-default-directory)
+  (:one-liner "Change the current directory."))
+
+(defslime-repl-shortcut nil ("pwd")
+  (:handler (lambda () 
+              (interactive)
+              (let ((dir (slime-eval `(swank:default-directory))))
+                (message "Directory %s" dir))))
+  (:one-liner "Show the current directory."))
+
+(defslime-repl-shortcut slime-repl-push-directory
+    ("push-directory" "+d" "pushd")
+  (:handler (lambda (directory)
+              (interactive
+               (list (read-directory-name
+                      "Push directory: "
+                      (slime-eval '(swank:default-directory))
+                      nil nil "")))
+              (push (slime-eval '(swank:default-directory))
+                    slime-repl-directory-stack)
+              (slime-set-default-directory directory)))
+  (:one-liner "Save the current directory and set it to a new one."))
+
+(defslime-repl-shortcut slime-repl-pop-directory
+    ("pop-directory" "-d" "popd")
+  (:handler (lambda ()
+              (interactive)
+              (if (null slime-repl-directory-stack)
+                  (message "Directory stack is empty.")
+                  (slime-set-default-directory
+                   (pop slime-repl-directory-stack)))))
+  (:one-liner "Restore the last saved directory."))
+
+(defslime-repl-shortcut nil ("change-package" "!p" "in-package" "in")
+  (:handler 'slime-repl-set-package)
+  (:one-liner "Change the current package."))
+
+(defslime-repl-shortcut slime-repl-push-package ("push-package" "+p")
+  (:handler (lambda (package)
+              (interactive (list (slime-read-package-name "Package: ")))
+              (push (slime-lisp-package) slime-repl-package-stack)
+              (slime-repl-set-package package)))
+  (:one-liner "Save the current package and set it to a new one."))
+
+(defslime-repl-shortcut slime-repl-pop-package ("pop-package" "-p")
+  (:handler (lambda ()
+              (interactive)
+              (if (null slime-repl-package-stack)
+                  (message "Package stack is empty.")
+                  (slime-repl-set-package
+                   (pop slime-repl-package-stack)))))
+  (:one-liner "Restore the last saved package."))
+
+(defslime-repl-shortcut slime-repl-resend ("resend-form")
+  (:handler (lambda ()
+              (interactive)
+              (insert (car slime-repl-input-history))
+              (insert "\n")
+              (slime-repl-send-input)))
+  (:one-liner "Resend the last form."))
+
+(defslime-repl-shortcut slime-repl-disconnect ("disconnect")
+  (:handler 'slime-disconnect)
+  (:one-liner "Disconnect the current connection."))
+
+(defslime-repl-shortcut slime-repl-disconnect-all ("disconnect-all")
+  (:handler 'slime-disconnect-all)
+  (:one-liner "Disconnect all connections."))