Rework lisp configuration
- Auto insert for Common Lisp files - Rename Emacs Lisp configuration to Common Lisp, and refactor it for cleanliness
This commit is contained in:
@@ -2680,11 +2680,67 @@ install~.
|
|||||||
:init
|
:init
|
||||||
(setq merlin-eldoc-occurrences nil))
|
(setq merlin-eldoc-occurrences nil))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Common Lisp
|
** Lisp
|
||||||
Common Lisp is a dialect of Lisp, the most /common/ one around. Emacs
|
Emacs is the greatest Lisp editor around. There are no two ways about
|
||||||
comes with builtin Lisp support, of course, and it's really good in
|
it. Here I setup the configuration for Emacs Lisp editing (the
|
||||||
comparison to literally everything else. However, I wish it had a
|
default experience OOTB) and Common Lisp
|
||||||
better REPL...
|
*** Lisp configuration
|
||||||
|
All the general stuff I do for any other language: pretty symbols and
|
||||||
|
key bindings.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package lisp-mode
|
||||||
|
:pretty
|
||||||
|
(lisp-mode-hook
|
||||||
|
("lambda" . "λ")
|
||||||
|
("nil" . "Ø")
|
||||||
|
("<=" . "≤")
|
||||||
|
(">=" . "≥")
|
||||||
|
("defun" . "ƒ")
|
||||||
|
("mapcar" . "→")
|
||||||
|
("reduce" . "↓")
|
||||||
|
("some" . "∃")
|
||||||
|
("every" . "∀"))
|
||||||
|
(emacs-lisp-mode-hook
|
||||||
|
("lambda" . "λ")
|
||||||
|
("nil" . "Ø")
|
||||||
|
("defun" . "ƒ")
|
||||||
|
("mapcar" . "→"))
|
||||||
|
:general
|
||||||
|
(:states '(normal motion insert visual)
|
||||||
|
:keymaps 'lisp-mode-shared-map
|
||||||
|
"C-j" #'sp-forward-slurp-sexp
|
||||||
|
"C-k" #'sp-forward-barf-sexp)
|
||||||
|
(:states '(normal motion visual)
|
||||||
|
:keymaps 'lisp-mode-shared-map
|
||||||
|
")" #'sp-next-sexp
|
||||||
|
"(" #'sp-previous-sexp))
|
||||||
|
#+end_src
|
||||||
|
*** Common Lisp auto insert
|
||||||
|
Like C/C++'s auto insert, but with Common Lisp comments.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package lisp-mode
|
||||||
|
:init
|
||||||
|
(defun +lisp/copyright-notice ()
|
||||||
|
(let* ((lines (split-string (+license/copyright-notice) "\n"))
|
||||||
|
(copyright-line (car lines))
|
||||||
|
(rest (cdr lines)))
|
||||||
|
(-->
|
||||||
|
(lambda (x)
|
||||||
|
(if (string= x "")
|
||||||
|
""
|
||||||
|
(concat ";; " x)))
|
||||||
|
(mapconcat it rest "\n")
|
||||||
|
(format ";; %s\n%s\n"
|
||||||
|
copyright-line
|
||||||
|
it))))
|
||||||
|
:auto-insert
|
||||||
|
(("\\.lisp\\'" . "Common Lisp Skeleton")
|
||||||
|
""
|
||||||
|
";;; " (file-name-nondirectory (buffer-file-name)) " - "
|
||||||
|
(format-time-string "%Y-%m-%d") "\n\n"
|
||||||
|
(+lisp/copyright-notice) "\n"
|
||||||
|
";;; Commentary:\n\n;;\n\n;;; Code:\n"))
|
||||||
|
#+end_src
|
||||||
*** Sly
|
*** Sly
|
||||||
Enter /SLY/. Sly is a fork of /SLIME/ and is *mandatory* for lisp
|
Enter /SLY/. Sly is a fork of /SLIME/ and is *mandatory* for lisp
|
||||||
development on Emacs.
|
development on Emacs.
|
||||||
@@ -2718,9 +2774,8 @@ Here I just setup Sly to use ~sbcl~.
|
|||||||
:keymaps 'lisp-mode-map
|
:keymaps 'lisp-mode-map
|
||||||
"gr" #'sly-eval-buffer
|
"gr" #'sly-eval-buffer
|
||||||
"gd" #'sly-edit-definition
|
"gd" #'sly-edit-definition
|
||||||
"gR" #'sly-who-calls
|
"gR" #'sly-who-calls)
|
||||||
"C-j" #'sp-forward-slurp-sexp
|
|
||||||
"C-k" #'sp-forward-barf-sexp)
|
|
||||||
(local-leader
|
(local-leader
|
||||||
:keymaps 'lisp-mode-map
|
:keymaps 'lisp-mode-map
|
||||||
"a" #'sly-apropos
|
"a" #'sly-apropos
|
||||||
@@ -2794,46 +2849,6 @@ Here I just setup Sly to use ~sbcl~.
|
|||||||
:keymaps 'sly-inspector-mode-map
|
:keymaps 'sly-inspector-mode-map
|
||||||
"q" #'sly-inspector-quit))
|
"q" #'sly-inspector-quit))
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Emacs lisp
|
|
||||||
Ligatures and bindings for (Emacs) Lisp. Pretty self declarative.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package elisp-mode
|
|
||||||
:defer t
|
|
||||||
:pretty
|
|
||||||
(lisp-mode-hook
|
|
||||||
("lambda" . "λ")
|
|
||||||
("nil" . "Ø")
|
|
||||||
("<=" . "≤")
|
|
||||||
(">=" . "≥")
|
|
||||||
("defun" . "ƒ")
|
|
||||||
("mapcar" . "→")
|
|
||||||
("reduce" . "↓")
|
|
||||||
("some" . "∃")
|
|
||||||
("every" . "∀"))
|
|
||||||
(emacs-lisp-mode-hook
|
|
||||||
("lambda" . "λ")
|
|
||||||
("nil" . "Ø")
|
|
||||||
("defun" . "ƒ")
|
|
||||||
("mapcar" . "→"))
|
|
||||||
:general
|
|
||||||
(:states '(normal motion visual)
|
|
||||||
:keymaps '(emacs-lisp-mode-map
|
|
||||||
lisp-mode-map
|
|
||||||
lisp-interaction-mode-map)
|
|
||||||
")" #'sp-next-sexp
|
|
||||||
"(" #'sp-previous-sexp)
|
|
||||||
(nmmap
|
|
||||||
:keymaps '(emacs-lisp-mode-map lisp-interaction-mode-map)
|
|
||||||
"gr" #'eval-buffer)
|
|
||||||
(vmap
|
|
||||||
:keymaps '(emacs-lisp-mode-map lisp-interaction-mode-map)
|
|
||||||
"gr" #'eval-region)
|
|
||||||
(local-leader
|
|
||||||
:keymaps '(emacs-lisp-mode-map lisp-interaction-mode-map)
|
|
||||||
"e" #'eval-last-sexp
|
|
||||||
"f" #'eval-defun))
|
|
||||||
#+end_src
|
|
||||||
*** Lisp indent function
|
*** Lisp indent function
|
||||||
Add a new lisp indent function which indents newline lists more
|
Add a new lisp indent function which indents newline lists more
|
||||||
appropriately.
|
appropriately.
|
||||||
|
|||||||
Reference in New Issue
Block a user