Skip to content

Instantly share code, notes, and snippets.

@zilti
Created Jul 25, 2013
Embed
What would you like to do?
Configuration for Emacs with Clojure; See [the full article](https://coderwall.com/p/53bfpg) on coderwall.
;; Highlights line you're currently on
(global-hl-line-mode t)
;; Shows in modeline where in the file you are
(sml-modeline-mode)
;; Pretty symbols
(require 'pretty-mode-plus)
(global-pretty-mode 1)
;; Autocomplete
(require 'auto-complete)
;; Disable annoying bell sound
(setq visible-bell t)
;; Disables scrollbar
(setq scroll-bar-mode nil)
;; Disables toolbar
(setq tool-bar-mode nil)
;; Optional: If you've installed solarized-theme
(require 'solarized-dark-theme) ;; Also as solarized-light-theme
;; ido completion
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(setq ido-mode (quote both) nil (ido))
(setq ido-ubiquitous-mode t)
;; Enable SMEX, an enhancement for M-x completion
(global-set-key [(meta x)] (lambda ()
(interactive)
(or (boundp 'smex-cache)
(smex-initialize))
(global-set-key [(meta x)] 'smex)
(smex)))
(global-set-key [(shift meta x)] (lambda ()
(interactive)
(or (boundp 'smex-cache)
(smex-initialize))
(global-set-key [(shift meta x)] 'smex-major-mode-commands)
(smex-major-mode-commands)))
;; Unicode as default
;; set up unicode
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; This from a japanese individual. I hope it works.
(setq default-buffer-file-coding-system 'utf-8)
;; From Emacs wiki
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
;; clj-refactor: Use C-c C-m. See https://github.com/magnars/clj-refactor.el
(defun clj-refactor-hooks ()
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-m"))
;; nREPL: The new Clojure network REPL. See https://github.com/kingtim/nrepl.el
(require 'nrepl)
(add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode)
;; Autocompletion for nREPL; From https://github.com/purcell/ac-nrepl
(require 'ac-nrepl)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes'nrepl-mode))
;; Probably gets in the way of yasnippet?
(defun set-auto-complete-as-completion-at-point-function ()
(setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function)
;; Popup documentation change
(define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc)
;; Glue code: Bring it all together...
(add-hook 'clojure-mode-hook 'paredit-mode)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(add-hook 'clojure-mode-hook 'auto-indent-mode)
(add-hook 'clojure-mode-hook 'clj-refactor-hooks)
(add-hook 'clojure-mode-hook 'auto-complete-mode)
(add-to-list 'auto-mode-alist '("\\.cljs\\'" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.cljx\\'" . clojure-mode))
@LispyAriaro
Copy link

LispyAriaro commented Feb 21, 2014

Hi. I ran into a little problem. Emacs ran into a problem in loading the base-stuff.el. Emacs printed out "Symbol's function definition is void: ido"
I think the problem is from line 22: (setq ido-mode (quote both) nil (ido))
ido wasn't defined prior to being called.

What can I do to fix this? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment