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

79 lines
2.5 KiB
EmacsLisp
Raw Normal View History

;;; oni-clojure.el --- Clojure configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2021.0727.210613
2020-01-29 04:02:19 +01:00
;; 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:
2019-02-28 08:43:16 +01:00
(require 'cider)
(require 'clojure-mode)
(require 'clojure-mode-extra-font-locking)
(require 'inf-lisp)
2019-02-28 08:43:16 +01:00
(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)
2019-02-28 08:43:16 +01:00
(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)
2020-01-29 04:02:19 +01:00
(add-hook 'clojure-mode-hook 'company-mode)
(add-hook 'cider-repl-mode-hook 'paredit-mode)
(provide 'oni-clojure)
;;; oni-clojure.el ends here