V2 Emacs config now kept as it's own repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.1 KiB

2 years ago
;;; lisp-mode-settings.el --- Settings for lisp modes.
;; Slime - requires SBCL to be installed in /usr/local/bin/ (default for the install.sh
;; script)
(use-package paredit
:ensure t)
(use-package slime
:ensure t
:config
(global-unset-key (kbd "<f1>"))
(global-unset-key (kbd "<f2>"))
(define-key lisp-mode-map (kbd "<f1>") 'slime-eval-buffer)
(define-key lisp-mode-map (kbd "<f2>") 'slime-eval-defun))
(setq inferior-lisp-program "sbcl")
(setq slime-contribs '(slime-fancy))
;; Enable paredit for lisp
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'scheme-mode-hook 'rainbow-delimiters-mode)
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
;; Only enable aggressive indent on lisp-likes
(add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'scheme-mode-hook #'aggressive-indent-mode)
(add-hook 'clojure-mode-hook #'aggressive-indent-mode)
;; Autoload the indent function
(autoload 'common-lisp-indent-function "cl-indent" "Common Lisp indent.")
(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)
;;---------------------------------------------------------
;; SLIME Quicklisp Integration.
;;---------------------------------------------------------
(when (file-exists-p "~/quicklisp/slime-helper.el")
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl"))