Skip to content

Commit

Permalink
Included the "installer" branch of clojure-mode.
Browse files Browse the repository at this point in the history
Stupid half-merge...
  • Loading branch information
technomancy committed Jan 24, 2009
1 parent 2ca1577 commit 24e7d08
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 20 deletions.
84 changes: 66 additions & 18 deletions elpa-to-submit/clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,6 @@ elements of a def* forms."
(,(concat
"(\\(?:clojure/\\)?"
(regexp-opt
<<<<<<< HEAD:clojure-mode.el
'("cond" "condp" "for" "loop" "let" "recur" "do" "binding" "with-meta"
"when" "when-not" "when-let" "when-first" "if" "if-let" "if-not"
"delay" "lazy-cons" "." ".." "->" "and" "or" "locking" "list*"
"dosync" "load" "symbol" "keyword?" "number?" "instance?"
"sync" "doseq" "dotimes" "import" "unimport" "ns" "in-ns" "refer"
"implement" "proxy" "time" "try" "catch" "finally" "throw"
"doto" "with-open" "with-local-vars" "struct-map"
"gen-class" "gen-and-load-class" "gen-and-save-class" "apply"
"map" "mapcat" "vector?" "list?" "hash-map" "reduce" "filter"
=======
'("let" "do"
"cond" "condp"
"for" "loop" "recur"
Expand All @@ -322,21 +311,14 @@ elements of a def* forms."
'(
"implement" "proxy" "lazy-cons" "with-meta"
"struct" "struct-map" "delay" "locking" "sync" "time" "apply"
>>>>>>> 0a90e587ed853c53c13c42a8eedd03240746fc9a:clojure-mode.el
"remove" "merge" "interleave" "interpose" "distinct" "for"
"cons" "concat" "lazy-cat" "cycle" "rest" "frest" "drop" "drop-while"
"nthrest" "take" "take-while" "take-nth" "butlast" "drop-last"
"reverse" "sort" "sort-by" "split-at" "partition" "split-with"
"first" "ffirst" "rfirst" "when-first" "zipmap" "into" "set" "vec" "into-array"
"to-array-2d" "not-empty" "seq?" "not-every?" "every?" "not-any?" "empty?"
<<<<<<< HEAD:clojure-mode.el
"map?" "set?" "list?" "seq?" "unquote?" "self-eval?" "str" "int" "println"
"doseq" "dorun" "doall" "even?" "first" "second" "last" "list"
"vals" "keys" "keyword" "rseq" "subseq" "rsubseq"
=======
"map" "mapcat" "vector?" "list?" "hash-map" "reduce" "filter"
"vals" "keys" "rseq" "subseq" "rsubseq" "count"
>>>>>>> 0a90e587ed853c53c13c42a8eedd03240746fc9a:clojure-mode.el
"fnseq" "lazy-cons" "repeatedly" "iterate"
"repeat" "replicate" "range"
"line-seq" "resultset-seq" "re-seq" "re-find" "tree-seq" "file-seq" "xml-seq"
Expand Down Expand Up @@ -552,6 +534,72 @@ check for contextual indenting."
(with-open 1)
(with-precision 1))

(defvar clojure-src-root "~/src"
"Directory that contains checkouts for Clojure and other libs.
clojure-contrib, slime, and swank-clojure should be here too. Use
the `clojure-install' command to check these out and configure
them for you.")

(defun clojure-slime-config ()
"Load Clojure SLIME support out of the `clojure-src-root' directory.
Since there's no single conventional place to keep Clojure, this
is bundled up as a function so that you can call it after you've set
`clojure-src-root' in your personal config."

(add-to-list 'load-path (concat clojure-src-root "/slime"))
(add-to-list 'load-path (concat clojure-src-root "/slime/contrib"))
(add-to-list 'load-path (concat clojure-src-root "/swank-clojure"))

(require 'slime-autoloads)
(require 'swank-clojure-autoload)

(eval-after-load 'slime '(slime-setup '(slime-fancy)))

(setq swank-clojure-jar-path (concat clojure-src-root "/clojure/clojure.jar")
swank-clojure-extra-classpaths
(list (concat clojure-src-root "/clojure-contrib/clojure-contrib.jar"))))

(defun clojure-install (src-root)
"Perform the initial Clojure install along with Emacs support libs.
This requires git, a JVM, ant, and an active Internet connection."
(interactive (list
(read-from-minibuffer (concat "Install Clojure in (default: "
clojure-src-root "): ")
nil nil nil nil clojure-src-root)))
(mkdir src-root t)

(if (file-exists-p (concat src-root "/clojure"))
(error "Clojure is already installed at %s/clojure" src-root))

(cd src-root)
(message "Checking out source... this will take a while...")
(dolist (cmd '("git clone git://github.com/kevinoneill/clojure.git"
"git clone git://github.com/kevinoneill/clojure-contrib.git"
"git clone git://github.com/jochu/swank-clojure.git"
"git clone git://git.boinkor.net/slime.git"))
(unless (= 0 (shell-command cmd))
(error "Clojure installation step failed: %s" cmd)))

(message "Compiling...")
(cd (concat clojure-src-root "/clojure"))
(unless (= 0 (shell-command "ant")) (error "Couldn't compile Clojure."))
(cd (concat clojure-src-root "/clojure-contrib"))
(unless (= 0 (shell-command "ant")) (error "Couldn't compile Clojure contrib."))

(unless (equal src-root clojure-src-root)
(with-output-to-temp-buffer "clojure-install-note"
(princ (format "You've installed clojure in a non-default location. If you want to use this installation in the future, you will need to add the following line to your personal Emacs config somewhere:
\(setq clojure-src-root \"%s\"\)" src-root)))
(setq clojure-src-root src-root))

(clojure-slime-config)

(message "Installed Clojure successfully. Press M-x slime to continue."))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))

Expand Down
4 changes: 2 additions & 2 deletions starter-kit-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
(add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode +1)))
(add-hook 'lisp-mode-hook (lambda () (paredit-mode +1)))))

(defface esk-paren-face
(defface esk-paren-face3
'((((class color) (background dark))
(:foreground "grey20"))
(:foreground "grey50"))
(((class color) (background light))
(:foreground "grey55")))
"Face used to dim parentheses."
Expand Down

0 comments on commit 24e7d08

Please sign in to comment.