Modified from Https://github.com/flyingmachine/emacs-for-clojure
;;;;;; Packages;;;;;; Define package repositories (require ' package) (Add-to-list ' package-archives ' ("Marmalade"). "http://marmalade-repo.org/packages/") t) (Add-to-list ' package-archives ' ("Tromey"). "http://tromey.com/elpa/") t) (Add-to-list ' package-archives ' ("Melpa"). "http://melpa.milkbox.net/packages/") t);; (Setq package-archives ' ("GNU". "http://elpa.gnu.org/packages/");; ("Marmalade". "http://marmalade-repo.org/packages/");; ("Melpa". "http://melpa-stable.milkbox.net/packages/")); Load and activate Emacs packages. Do this first so, the;; Packages is loaded before you start trying to modify them.; This also sets the load path. (package-initialize);; Download The Elpa archive description if needed.; This informs Emacs is about the latest versions of all packages, and; Makes them available for download. (When (not package-archive-contents) (package-refresh-contents));; The packages you wAnt installed. You can also install these;; manually with m-x Package-install;; Add in your own as wish: (DefVar my-packages ' (;; Makes handling Lisp expressions much, much easier;; Cheatsheet:http://www.emacswiki.org/emacs/pareditcheatsheet Paredit; Key bindings and code colorization for Clojure;; Https://github.com/clojure-emacs/clojure-mode Clojure-mode; Extra syntax highlighting for clojure clojure-mode-extra-font-locking;; Integration with a Clojure REPL;; Https://github.com/clojure-emacs/cider cider; Allow Ido usage in as many contexts as possible. See;; Customizations/navigation.el line to a description;; of Ido ido-ubiquitous;; Enhances m-x to allow easier execution of commands. provides;; A filterable list of possible commands in the Minibuffer; Http://www.emacswiki.org/emacs/Smex Smex; Project navigation projectile;; colorful parenthesis matching rainbow-delimiters; Edit HTML TAGS like Sexps;; Tagedit;; git integration;; Magit)) (Dolist (P my-packages) (When (not (Package-installed-p p)) (Package-install p)); Place downloaded elisp files in ~/.emacs.d/vendor. You'll then be able;; to load them.;;;; For example, if you download Yaml-mode.el to ~/.emacs.d/vendor,;; Then you can add the following code to this file:;;;; (Require ' yaml-mode);; (Add-to-list ' auto-mode-alist ' ("\\.yml$". Yaml-mode));; ;; Adding This code would make Emacs enter YAML mode whenever you open;; A. yml file (add-to-list ' Load-path "~/.emacs.d/vendor");; Change default start Up directory (setq default-directory "c:/users/hello/");; Go straight to scratch buffer on startup (setq inhibit-startup-message t);; "When several buffers visit identically-named files,;; Emacs must give the buffers distinct names. The usual method; For making buffer names unique adds ",", etc. to the end; of the buffer names (all but one of them).; The forward naming method includes part of the File ' s directory;; Name at the beginning of the buffer name;; Https://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html (Require ' uniquify) (setq Uniquify-buffer-name-style ' forward);; Turn on recent file mode so where can more easily switch to;; Recently edited files when you first start emacs (setq recentf-save-file (concat user-emacs-directory ". recentf")) (Require ' recentf ' (Recentf-mode 1) (setq recentf-max-menu-items 40);; Ido-mode allows easily navigate choices. for example,;; When you want to switch buffers, Ido presents your with a list;; of buffers in the the Mini-buffer. As you start to type a buffer ' s;; Name, Ido would narrow down the list of buffers to match the text;; You ' ve typed in;; Http://www.emacswiki.org/emacs/InteractivelyDoThings (Ido-mode t);; This allows partial matches, e.g. "TL" would match "Tyrion Lannister" (setq ido-enable-flex-matching t);; Turn This behavior off because it ' s annoying (setq ido-use-filename-at-point nil);; Don ' t try to match file across all "work" directories; only match files;; In the current directory displayed in the Minibuffer (setq ido-auto-merge-work-directories-length-1); Includes buffer names of recently open files, even if they ' re not;; Open now (setq ido-use-virtual-buffers t);; This enables Ido in all contexts where it could is useful, not just;; For selecting buffer and file names (Ido-ubiquitous-mode 1); Shows a list of buffers (Global-set-key (kbd "C-x c-b") ' Ibuffer '); Enhances m-x to allow easier execution of commands. provides;; A filterable list of possible commands in the Minibuffer; Http://www.emacswiki.org/emacs/Smex (setq smex-save-file (concat user-emacs-directory ". Smex-items")) ( Smex-initialize) (Global-set-key (kbd "m-x") ' Smex ');; Projectile everywhere! (Projectile-global-mode);; Turn on menu bar (Menu-bar-mode 1); Show line Numbers (global-linum-mode);; You can uncomment this to remove the graphical toolbar at the top. after;; Awhile, you won ' t need the toolbar.; (When (FBOUNDP 'Tool-bar-mode);; (tool-bar-mode-1));; Don ' t show native OS scroll bars for buffers because they ' re redundant (when (FBOUNDP ' Scroll-bar-mode) (Scroll-bar-mode- 1)); Color Themes;; Read http://batsov.com/articles/2012/02/19/color-theming-in-emacs-reloaded/;; For a great explanation of Emacs color themes.; https://www.gnu.org/software/emacs/manual/html_node/emacs/Custom-Themes.html;; For a more technical explanation. (Add-to-list ' Custom-theme-load-path "~/.emacs.d/themes") (Add-to-list ' Load-path "~/.emacs.d/themes") (Load-theme ' tomorrow-night-bright t);; Increase font size for better readability (set-face-attribute ' default nil:height 120);; These settings relate to what Emacs interacts with your operating system (SETQ;; makes killing/yanking interact with the CL Ipboard X-select-enable-clipboard T;; I ' m actually not sure what is this does but it's recommended? X-select-enable-primary T;; Save clipboard strings into kill ring before replacing them. ;; When oneSelects something in another-paste it into Emacs,;; But kills something in Emacs before actually pasting it,;; This selection are gone unless this variable is non-nil save-interprogram-paste-before-kill t;; Shows all options when running apropos. For more info,;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Apropos.html Apropos-do-all T;; Mouse Yank commands Yank at point instead in click. Mouse-yank-at-point t);; Enable cursor blinking (Blink-cursor-mode 1);; Full path in title bar (Setq-default Frame-title-format "%b (%f)"); Don ' t pop up font menu (Global-set-key (kbd "s-t") ' (Lambda () (interactive))); Uncomment to disable Bell; (setq ring-bell-function ' ignore);; Highlights matching parenthesis (Show-paren-mode 1); Highlight Current Line (Global-hl-line-mode 1);; When you visit a file, point goes to the last place where it;; Was while you previously visited the same file.; Http://www.emacswiki.org/emacs/SavePlace(Require ' saveplace) (Setq-default save-place t);; Keep track of Saved places in ~/.emacs.d/places (setq save-place-file (concat user-emacs-directory "Places")); Emacs can automatically create backup files. This tells Emacs to;; Put all backups in ~/.emacs.d/backups. More info:;; http://www.gnu.org/software/emacs/manual/html_node/elisp/Backup-Files.html (setq backup-directory-alist ' ("."., ( Concat user-emacs-directory "Backups")))) (setq auto-save-default nil);; Yay rainbows! (Global-rainbow-delimiters-mode t) (setq electric-indent-mode 1);; for editing Lisps;; Automatically load Paredit when editing a lisp file;; More at Http://www.emacswiki.org/emacs/ParEdit (AutoLoad ' Enable-paredit-mode "Paredit" "Turn on Pseudo-structural Editing of Lisp code. "T" (Add-hook ' Emacs-lisp-mode-hook # ' Enable-paredit-mode) (Add-hook ' Eval-expression-minibuffer -setup-hook # ' Enable-paredit-mode) (Add-hook ' Ielm-mode-hook # ' Enable-paredit-mode) (add-Hook ' Lisp-mode-hook # ' Enable-paredit-mode) (Add-hook ' Lisp-interaction-mode-hook # ' Enable-paredit-mode) (add-ho Ok ' Scheme-mode-hook # ' Enable-paredit-mode);; Eldoc-mode shows documentation in the Minibuffer when writing code; Http://www.emacswiki.org/emacs/ElDoc (Add-hook ' Emacs-lisp-mode-hook ' Turn-on-eldoc-mode) (Add-hook ' Lisp-interaction-mode-hook ' Turn-on-eldoc-mode) (Add-hook ' Ielm-mode-hook ' turn-on-eldoc-mode);;;;;; Clojure;;;;;; Enable Paredit for Clojure (Add-hook ' Clojure-mode-hook ' Enable-paredit-mode);; This is useful-working with camel-case tokens, like names of;; Java classes (e.g. javaclassname) (Add-hook ' Clojure-mode-hook ' Subword-mode);; A little more syntax highlighting (require ' clojure-mode-extra-font-locking);;;;;; cider;;;;;; Provides minibuffer documentation for the code i ' re typing into the REPL (Add-hook ' Cider-mode-hook ' cider-turn-on-eldoc- mode);; Go right to the REPL buffer when it ' s finished connecting (setq cider-repl-pop-to-buffer-on-Connect t);; When there ' s a cider error, show its buffer and switch to it (setq cider-show-error-buffer t) (setq cider-auto-select-error- Buffer t);; Where to store the cider. (setq cider-repl-history-file "~/.emacs.d/cider-history"); Wrap when navigating. (setq cider-repl-wrap-history t);; Enable Paredit in your REPL (Add-hook ' Cider-repl-mode-hook ' Paredit-mode)
My Emacs Configuration