Created
September 5, 2012 08:53
-
-
Save haiyun-document/3633586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Lightweight clojure setup for Emacs | |
;; requires emacs24 and leiningen | |
;; Add Marmalade package archive for Emacs starter kit and other Emacs packages | |
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/") ) | |
(package-initialize) | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(package-initialize) | |
;; clojure-mode | |
(add-to-list 'load-path "~/.emacs.d/clojure-mode") | |
(require 'clojure-mode) | |
;; Add Clojure and other supporting packages to the Emacs environment | |
;; Packages are installed if they are not already present | |
;; The list includes packages for the starter kit, Clojure and markdown files (used by github) | |
(when (not package-archive-contents) | |
(package-refresh-contents)) | |
(defvar my-packages '(starter-kit starter-kit-lisp starter-kit-eshell starter-kit-bindings starter-kit-js starter-kit-perl | |
clojure-mode | |
clojure-test-mode | |
rainbow-delimiters | |
markdown-mode | |
ac-slime | |
popup | |
markdown-mode | |
undo-tree )) | |
;;; auto-complete only seems to work as a manual install, however that | |
;;; manual install relies on popup being available | |
(dolist (p my-packages) | |
(when (not (package-installed-p p)) | |
(package-install p))) | |
;; Useful global settings as Emacs is used predominantely for Clojure development | |
;; Launch the Clojure repl via Leiningen - M-x clojure-jack-in | |
;; Global shortcut definition to fire up clojure repl and connect to it | |
(global-set-key (kbd "C-c C-j") 'clojure-jack-in) | |
;; Colour match parens and other structure characters to make code easy to follow | |
(global-rainbow-delimiters-mode) | |
;;; Enable undo-tree for everything, so you can M - _ to redo | |
(global-undo-tree-mode) | |
;;; Add configuration for the auto-completion package | |
; not sure if this loadpath is required | |
;; (add-to-list 'load-path "~/.emacs.d") | |
; (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") | |
;;; not sure if require 'autocomplete is needed | |
;;; (require 'autocomplete) | |
;(require 'auto-complete-config) | |
;(ac-config-default) | |
(add-to-list 'load-path "~/.emacs.d/") | |
(add-to-list 'load-path "~/.emacs.d/") | |
(require 'auto-complete-config) | |
(ac-config-default) | |
;; ac-slime | |
(setq load-path (cons "~/.emacs.d/ac-slime" load-path)) | |
(require 'ac-slime) | |
(add-hook 'slime-mode-hook 'set-up-slime-ac) | |
;; slime | |
(eval-after-load "slime" | |
'(progn (slime-setup '(slime-repl)))) | |
(add-to-list 'load-path "~/opt/slime") | |
(require 'slime) | |
(slime-setup) | |
(add-hook 'slime-repl-mode-hook | |
(defun clojure-mode-slime-font-lock () | |
(require 'clojure-mode) | |
(let (font-lock-mode) | |
(clojure-mode-font-lock-setup)))) | |
(setq-default inhibit-startup-screen t) | |
;; Of course, don't uncomment the line below -- doing so would | |
;; stop Emacs from helpfully leaving "foo~" (backup) files all | |
;; over the place. | |
;(setq make-backup-files nil) | |
;; Use only spaces (no tabs at all). | |
(setq-default indent-tabs-mode nil) | |
;; Always show column numbers. | |
(setq-default column-number-mode t) | |
;; Display full pathname for files. | |
(add-hook 'find-file-hooks | |
'(lambda () | |
(setq mode-line-buffer-identification 'buffer-file-truename))) | |
;; For easy window scrolling up and down. | |
(global-set-key "\M-n" 'scroll-up-line) | |
(global-set-key "\M-p" 'scroll-down-line) | |
;; clojure-mode | |
(add-to-list 'load-path "~/.emacs.d/clojure-mode") | |
(require 'clojure-mode) | |
;; paredit | |
(add-to-list 'load-path "~/.emacs.d/paredit") | |
(require 'paredit) | |
(add-hook 'clojure-mode-hook | |
(lambda () | |
(setq safe-local-variable-values | |
'((inferior-lisp-program . "lein repl") | |
(inferior-lisp-program . "smvn clojure:repl"))))) | |
;;js2 | |
(autoload 'js2-mode "js2" nil t) | |
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) | |
;;Set window title to full file name | |
(setq frame-title-format '("Emacs @ " system-name ": %b %+%+ %f")) | |
;;yasnippet | |
(add-to-list 'load-path | |
"~/.emacs.d/plugins/yasnippet") | |
(require 'yasnippet) | |
(yas-global-mode 1) | |
;;Enable ido mode | |
(require 'ido) | |
(ido-mode t) | |
(setq ido-enable-flex-matching t) ;; enable fuzzy matching | |
(load "~/.emacs.d/plugins/nxhtml/autostart.el") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment