2019-02-19 01:55:24 +01:00
|
|
|
|
;;; oni-clojure.el --- Clojure configuration -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
;; Copyright (C) 2019 Tom Willemse
|
|
|
|
|
|
|
|
|
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
|
|
|
|
;; Keywords: local
|
2020-01-29 04:02:19 +01:00
|
|
|
|
;; Version: 2020.0128.190042
|
|
|
|
|
;; Package-Requires: (clojure-mode oni-company cider clojure-mode-extra-font-locking oni-paredit rainbow-delimiters oni-data-dir)
|
2019-02-19 01:55:24 +01:00
|
|
|
|
|
|
|
|
|
;; 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:
|
|
|
|
|
|
2019-02-28 08:43:16 +01:00
|
|
|
|
(require 'cider)
|
2019-02-19 01:55:24 +01:00
|
|
|
|
(require 'clojure-mode)
|
|
|
|
|
(require 'clojure-mode-extra-font-locking)
|
|
|
|
|
(require 'inf-lisp)
|
2019-02-28 08:43:16 +01:00
|
|
|
|
(require 'oni-data-dir)
|
2019-02-19 01:55:24 +01:00
|
|
|
|
|
|
|
|
|
(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)))
|
|
|
|
|
|
2019-12-11 08:16:15 +01:00
|
|
|
|
(defun oni-clojure--auto-fill-mode ()
|
|
|
|
|
"Enable ‘auto-fill-mode’ only for comments."
|
|
|
|
|
(setq-local comment-auto-fill-only-comments t)
|
|
|
|
|
(auto-fill-mode))
|
|
|
|
|
|
2019-02-19 01:55:24 +01:00
|
|
|
|
(setq cider-repl-pop-to-buffer-on-connect t)
|
|
|
|
|
|
|
|
|
|
(setq cider-show-error-buffer t
|
|
|
|
|
cider-auto-select-error-buffer t)
|
|
|
|
|
|
2019-02-28 08:43:16 +01:00
|
|
|
|
(setq cider-repl-history-file (oni-data-dir-locate "cider-history"))
|
2019-02-19 01:55:24 +01:00
|
|
|
|
|
|
|
|
|
(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)
|
2019-12-11 08:16:15 +01:00
|
|
|
|
(add-hook 'clojure-mode-hook 'oni-clojure--auto-fill-mode)
|
2020-01-29 04:02:19 +01:00
|
|
|
|
(add-hook 'clojure-mode-hook 'company-mode)
|
2019-02-19 01:55:24 +01:00
|
|
|
|
|
|
|
|
|
(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
|