From 6bb587d877268210ae0bfec79e32996292ac5b4f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 14 Sep 2022 00:29:03 +0100 Subject: (Emacs)+common lisp configuration Using sly, make a LISP IDE in Emacs. REPL with high level integration, first class syntax highlighting and error reporting and an environment literally built out of it. --- Emacs/.config/emacs/config.org | 59 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 23dd428..c1ed907 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -2801,14 +2801,67 @@ Kinda expressive, interesting. :init (setq typescript-indent-level 2)) #+end_src -** Emacs lisp +** Common Lisp +Common Lisp is a dialect of Lisp, the most /common/ one around. Emacs +comes with builtin Lisp support of course, but a REPL would be nice. + +Enter /SLY/. Sly is a fork of /SLIME/ and is *mandatory* for lisp +development on Emacs. + +#+begin_src emacs-lisp +(use-package sly + :straight t + :init + (setq inferior-lisp-program "sbcl") + :display + ("\\*sly-db" + (display-buffer-at-bottom) + (window-height . 0.5)) + ("\\*sly-" + (display-buffer-at-bottom) + (window-height . 0.25)) + :config + (evil-set-initial-state 'sly-db-mode 'emacs) + (+dx/create-toggle-function + +shell/toggle-sly + "*sly-mrepl for sbcl*" + sly-mrepl) + :general + ; general binds + (nmap + :keymaps '(lisp-mode-map sly-mrepl-mode-map) + "gr" #'sly-eval-buffer + "gd" #'sly-edit-definition + "gR" #'sly-who-calls) + + (leader + "tS" #'+shell/toggle-sly) + (local-leader + :keymaps '(lisp-mode-map sly-mrepl-mode-map) + "s" #'+shell/toggle-sly + "c" #'sly-compile-file + "a" #'sly-apropos + "d" #'sly-describe-symbol) + (local-leader + :keymaps 'lisp-mode-map + :infix "e" + "b" #'sly-eval-buffer + "e" #'sly-eval-last-expression + "f" #'sly-eval-defun + "r" #'sly-eval-region) + ; sly binds + (nmap + :keymaps 'sly-inspector-mode-map + "q" #'sly-inspector-quit)) +#+end_src +*** Lisp indent function Add a new lisp indent function which indents newline lists more appropriately. #+begin_src emacs-lisp (use-package lisp-mode :straight nil :pretty - (emacs-lisp-mode-hook + (lisp-mode-hook ("lambda" . "λ") ("t" . "⊨") ("nil" . "Ø") @@ -2873,5 +2926,5 @@ appropriately. indent-point normal-indent)) (method (funcall method indent-point state)))))))) - (add-hook 'emacs-lisp-mode-hook (proc (interactive) (setq-local lisp-indent-function #'+dx/lisp-indent-function)))) + (setq-default lisp-indent-function #'+dx/lisp-indent-function)) #+end_src -- cgit v1.2.3-13-gbd6f