Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 13 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Example Config

Example Emacs configuration for clojure development with cider and clj-refactor.
An example Emacs configuration for Clojure development with CIDER and clj-refactor.

## Usage

1. Clone this repository as your `~/.emacs.d/` directory (or alternatively copy the contents into your `.emacs.d`)
2. copy the provided `profiles_sample.clj` to your `~/.lein/` directory and rename it to `profiles.clj` (again alternatively just merge the contents of the sample profiles.clj with your existing profiles.clj if you already have one)
You can use this configuration as your base Emacs configuration, or adapt it to your own configuration.

Alternatively you can cherry pick packages and/or config from here for clojure development with cider and clj-refactor and add it to your already existing `~/.emacs.d` directory.
1. Clone, copy, or merge this repository as your `~/.emacs.d/` directory
2. Copy or merge the provided `profiles_sample.clj` to your `~/.lein/` directory as `profiles.clj`

Either way you should be able to `cider-jack-in` on any clojure file of your favourite clojure project with `C-c M-j`. Prefix for clj-refactor is set to `C-c RET` so for example introduce let would be `C-c RET i l`.
Load a Clojure file, and execute `cider-jack-in` (`C-c M-j`).

Happy clojure hacking!
clj-refactor's prefix is `C-c RET`. It uses mnemonic keywords to provide shortcuts for common tasks. One example of its functionality is introduce let, which would be `C-c RET i l`. To view a complete list of its functionality, hit `C-c RET C-h`.

Happy Clojure hacking!

## Featured packages

Expand All @@ -22,33 +24,20 @@ Happy clojure hacking!

## Package versions

All package versions come from melpa stable apart from `clj-refactor`: this might change in the near future and `clj-refactor` will come from stable too. If you are not sure what melpa stable means check out next section about Emacs package management.
Our dependencies largely come from MELPA Stable, which aims to hold only stable versions of packages. The main exception is `clj-refactor` and its dependencies. clj-refactor is available on MELPA Stable, but it has a very out-dated version.

### Using Emacs package management

if you look at this code snippet

```elisp
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(setq package-user-dir (concat user-emacs-directory "packages"))
(package-initialize)
```

this basically says that
- we want to use the emacs package management system
- we want to use the melpa-stable repo for packages (no snapshot versions from head of master branch of projects only released versions)
- we want the use the directory named `packages` under user-emacs-directory (resolves to `~/.emacs.d` here) to store the packages.
Where possible, we make use of a helper function, require-package, that checks if a package is installed locally. If it is not installed locally, it will attempt to download and install that package from the package repositories. When you first use this config, Emacs will download all of the requirements that are not included with this configuration (i.e., the ones that we do not get from MELPA stable).

the above code snippet actually helps the maintainer when the time comes to upgrade packages (there are new releases) with a simple `M-x install package RET cider` for example. More detailed info about emacs [package management](http://ergoemacs.org/emacs/emacs_package_system.html).
[Here is a link](http://ergoemacs.org/emacs/emacs_package_system.html) to more detailed information about package management in Emacs.

## Rationale

See [this issue](https://github.com/clojure-emacs/clj-refactor.el/issues/110) for the discussion which resulted in creating this sample configuration. The goal of this to provide a reference emacs config which is specially focused on clojure development with all the bells and whistles but does not have much else in it.
See [this issue](https://github.com/clojure-emacs/clj-refactor.el/issues/110) for the discussion which resulted in creating this sample configuration. The goal of this to provide a reference Emacs config which is specially focused on Clojure development with all the bells and whistles but does not have much else in it.

## License

Copyright © 2015 [contributors](https://github.com/clojure-emacs/example-config/graphs/contributors)

Distributed under the GNU General Public License, version 3
Distributed under the GNU General Public License, version 3
6 changes: 6 additions & 0 deletions cfg-cider.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
;; Clojure IDE and REPL for Emacs
(require-package 'cider)

;; autocompletion
(require-package 'company)

;; REPL related stuff

;; REPL history file
Expand Down
11 changes: 11 additions & 0 deletions cfg-cljrefactor.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
;; clj-refactor and dependencies

;; available on MELPA stable
(require-package 'multiple-cursors)
(require-package 'dash)

;; manual dependencies
(add-to-list 'load-path (concat user-emacs-directory "site-lisp/" "s-20140910.334"))
(add-to-list 'load-path (concat user-emacs-directory "site-lisp/" "yasnippet-20141223.303"))
(add-to-list 'load-path (concat user-emacs-directory "site-lisp/" "clj-refactor-20150104.1358"))

(require 'clj-refactor)
(add-hook 'clojure-mode-hook
(lambda ()
Expand Down
2 changes: 2 additions & 0 deletions cfg-hlsexp.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(require-package 'hl-sexp)

;; hl-sexp: minor mode to highlight s-expression
(require 'hl-sexp)

Expand Down
2 changes: 2 additions & 0 deletions cfg-paredit.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(require-package 'paredit)

;; Paredit
(require 'paredit)
(add-hook 'lisp-mode-hook #'paredit-mode)
Expand Down
23 changes: 22 additions & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,35 @@
;; emacs package management
;; use MELPA stable
(require 'package)

(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(setq package-user-dir (concat user-emacs-directory "packages"))

(setq package-user-dir (concat user-emacs-directory "elpa"))
(add-to-list 'load-path (concat user-emacs-directory "site-lisp"))

(defun require-package (package &optional min-version no-refresh)
"Install given PACKAGE, optionally requiring MIN-VERSION.
If NO-REFRESH is non-nil, the available package lists will not be
re-downloaded in order to locate PACKAGE."
(if (package-installed-p package min-version)
t
(if (or (assoc package package-archive-contents) no-refresh)
(package-install package)
(progn
(package-refresh-contents)
(require-package package min-version t)))))

(setq package-enable-at-startup nil) ; Don't initialize later as well

(package-initialize)

;; show opening, closing parens
(show-paren-mode)

(require-package 'epl)

(require-package 'exec-path-from-shell)
;; Sort out the $PATH for OSX
(require 'exec-path-from-shell)
(when (memq window-system '(mac ns))
Expand Down
119 changes: 0 additions & 119 deletions packages/cider-0.8.2/cider-apropos.el

This file was deleted.

Loading