1
0
Fork 0
emacs-config/oni-clojure.el

81 lines
2.6 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; oni-clojure.el --- Clojure configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.0128.190042
;; Package-Requires: (clojure-mode oni-company 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 'clojure-mode-hook 'company-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