Tom Willemse
977f795e03
The ones that are already backed by a formatter, such as Java, Python and sh don’t need it.
80 lines
2.6 KiB
EmacsLisp
80 lines
2.6 KiB
EmacsLisp
;;; oni-clojure.el --- Clojure configuration -*- lexical-binding: t; -*-
|
||
|
||
;; Copyright (C) 2019 Tom Willemse
|
||
|
||
;; Author: Tom Willemse <tom@ryuslash.org>
|
||
;; Keywords: local
|
||
;; Version: 2019.1210.230345
|
||
;; Package-Requires: (clojure-mode cider clojure-mode-extra-font-locking oni-paredit rainbow-delimiters oni-data-dir)
|
||
|
||
;; 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 <https://www.gnu.org/licenses/>.
|
||
|
||
;;; Commentary:
|
||
|
||
;; My configuration for Clojure and Cider.
|
||
|
||
;;; Code:
|
||
|
||
(require 'cider)
|
||
(require 'clojure-mode)
|
||
(require 'clojure-mode-extra-font-locking)
|
||
(require 'inf-lisp)
|
||
(require 'oni-data-dir)
|
||
|
||
(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)))
|
||
|
||
(defun oni-clojure--auto-fill-mode ()
|
||
"Enable ‘auto-fill-mode’ only for comments."
|
||
(setq-local comment-auto-fill-only-comments t)
|
||
(auto-fill-mode))
|
||
|
||
(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 (oni-data-dir-locate "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 'clojure-mode-hook 'oni-clojure--auto-fill-mode)
|
||
|
||
(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
|