diff --git a/oni-clojure.el b/oni-clojure.el new file mode 100644 index 0000000..2b00b8c --- /dev/null +++ b/oni-clojure.el @@ -0,0 +1,74 @@ +;;; oni-clojure.el --- Clojure configuration -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: local +;; Version: 20190218165405 +;; Package-Requires: (clojure-mode cider clojure-mode-extra-font-locking paredit rainbow-delimiters) + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; My configuration for Clojure and Cider. + +;;; Code: + +(require 'clojure-mode) +(require 'clojure-mode-extra-font-locking) +(require 'inf-lisp) +(require 'cider) + +(defun oni-clojure-set-inferior-lisp () + "Set `inferior-lisp-program' to use Lein." + (setq-local inferior-lisp-program "lein repl")) + +(defun oni-clojure-add-font-lock () + "Add extra keywords for Clojure." + (font-lock-add-keywords + nil + '(("(\\(facts?\\)" + (1 font-lock-keyword-face)) + ("(\\(background?\\)" + (1 font-lock-keyword-face))))) + +(defun oni-clojure-add-indent () + "Customize indentation for Clojure." + (define-clojure-indent (fact 1)) + (define-clojure-indent (facts 1))) + +(setq cider-repl-pop-to-buffer-on-connect t) + +(setq cider-show-error-buffer t + cider-auto-select-error-buffer t) + +(setq cider-repl-history-file + (concat user-emacs-directory "data/cider-history")) + +(setq cider-repl-wrap-history t) + +(add-hook 'clojure-mode-hook 'paredit-mode) +(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) +(add-hook 'clojure-mode-hook 'oni-clojure-set-inferior-lisp) +(add-hook 'clojure-mode-hook 'oni-clojure-add-font-lock) +(add-hook 'clojure-mode-hook 'oni-clojure-add-indent) + +(add-hook 'cider-repl-mode-hook 'paredit-mode) + +;;;###autoload(with-eval-after-load 'clojure-mode (require 'oni-clojure)) +;;;###autoload(with-eval-after-load 'cider (require 'oni-clojure)) + +(provide 'oni-clojure) +;;; oni-clojure.el ends here