-
Notifications
You must be signed in to change notification settings - Fork 0
/
ontop-commonlisp.el
150 lines (125 loc) · 4.62 KB
/
ontop-commonlisp.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
;;; ontop-commonlisp.el --- Common Lisp with Sly -*- lexical-binding: t; -*-
;; This file is part of Emacs ONTOP
;; https://github.com/monkeyjunglejuice/emacs.ontop
;;; Commentary:
;; You can also use this file/configuration independently from Emacs ONTOP
;; Load it from anywhere via `(load-file "/path/to/ontop-commonlisp.el")'.
;;; Code:
;; ____________________________________________________________________________
;;; USE-PACKAGE
;; <https://github.com/jwiegley/use-package>
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package nil))
(eval-when-compile
(require 'use-package))
;; ____________________________________________________________________________
;;; COMMON LISP
;; <https://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Executing-Lisp>
(use-package inf-lisp
:ensure nil
:custom
;; Set default Lisp implementation
(inferior-lisp-program "ros -Q run"))
;; ____________________________________________________________________________
;;; SLY
;; <http://joaotavora.github.io/sly/>
;; <https://github.com/joaotavora/sly>
(use-package sly
:ensure t
:init
;; Set Sly Lisp implementations
(setq sly-lisp-implementations
'((roswell ("ros" "-Q" "run"))
(sbcl ("sbcl" "--no-inform") :coding-system utf-8-unix)))
:custom
;; Select Sly default Lisp implementation
(sly-default-lisp 'roswell)
;; General configuration
(sly-net-coding-system 'utf-8-unix)
;; :hook
;; Automatically start a Lisp REPL when opening a Lisp buffer
;; (sly-mode . (lambda ()
;; (unless (sly-connected-p) (save-excursion (sly)))))
:config
;; Prevent these buffers from cluttering certain buffer lists:
(when (boundp 'eon-boring-buffers)
(add-to-list 'eon-boring-buffers "\\`\\*sly-inferior-lisp")
(add-to-list 'eon-boring-buffers "\\`\\*sly-events"))
:bind
(:map ctl-z-x-map
("l" . sly-mrepl))
(:map ctl-z-s-map
("l" . sly-scratch)))
;; Common Lisp documentation
;; The hyperspec must be installed on your computer. Adapt the path below:
(use-package hyperspec
:ensure nil
:after sly
:custom
(common-lisp-hyperspec-root
;; Location when installed on MacOS via Homebrew
"/usr/local/share/doc/hyperspec/HyperSpec/")
(common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root "Data/Map_Sym.txt"))
(common-lisp-hyperspec-issuex-table
(concat common-lisp-hyperspec-root "Data/Map_IssX.txt")))
;; <https://github.com/mmgeorge/sly-asdf>
(use-package sly-asdf
:ensure t)
;; <https://github.com/joaotavora/sly-macrostep>
(use-package sly-macrostep
:ensure t)
;; <https://github.com/joaotavora/sly-named-readtables>
(use-package sly-named-readtables
:ensure t)
;; <https://github.com/joaotavora/sly-quicklisp>
(use-package sly-quicklisp
:ensure t)
;; ____________________________________________________________________________
;;; STRUCTURAL EDITING
;; SMARTPARENS
;; <https://github.com/Fuco1/smartparens>
;; <https://smartparens.readthedocs.io/en/latest/>
;; Smartparens non-strict mode is already enabled globally
;; and configured in `ontop-core.el'
;; Enable strict mode in Lisp buffers
(use-package smartparens
:ensure t
:hook
(lisp-mode . smartparens-strict-mode))
;; ____________________________________________________________________________
;;; PARENTHESIS DISPLAY
;; Rainbow-delimiters color-coding of nested parens is already enabled
;; for all prog-modes in `ontop-core.el'
(use-package rainbow-delimiters
:ensure t
:hook
(sly-repl-mode . rainbow-delimiters-mode))
;; Make parens styleable, e.g. more or less prominent
;; <https://github.com/tarsius/paren-face>
;; (use-package paren-face
;; :ensure t
;; :hook
;; ((lisp-mode inferior-lisp-mode sly-mrepl-mode) . paren-face-mode))
;; ____________________________________________________________________________
;;; ORG-MODE BABEL
;; <https://orgmode.org/worg/org-contrib/babel/intro.html>
;; Support literate programming in Emacs with Common Lisp
;; Evaluate Common Lisp code in Org source code blocks via "C-c C-c"
;; Make the function aware of Sly (defaults to Slime)
;; <https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lisp.html>
(use-package ob-lisp
:ensure nil
:custom
(org-babel-lisp-eval-fn #'sly-eval))
(use-package org
:ensure nil
:hook
(org-mode . (lambda () (org-babel-do-load-languages
'org-babel-load-languages
(add-to-list 'org-babel-load-languages
'(lisp . t))))))
;; ____________________________________________________________________________
(provide 'ontop-commonlisp)
;;; ontop-commonlisp.el ends here