aboutsummaryrefslogtreecommitdiff
path: root/Emacs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-02-15 22:07:18 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-02-15 22:07:18 +0000
commitc330ebc2d20e4766abf88737b2b9a80b752aebb0 (patch)
tree43537ee8b8622c7607c37e5cda0f62f00ef94977 /Emacs
parenta8c48d697a1a61cb491a6244ac7ecf647b542ff0 (diff)
downloaddotfiles-c330ebc2d20e4766abf88737b2b9a80b752aebb0.tar.gz
dotfiles-c330ebc2d20e4766abf88737b2b9a80b752aebb0.tar.bz2
dotfiles-c330ebc2d20e4766abf88737b2b9a80b752aebb0.zip
Rework lisp configuration
- Auto insert for Common Lisp files - Rename Emacs Lisp configuration to Common Lisp, and refactor it for cleanliness
Diffstat (limited to 'Emacs')
-rw-r--r--Emacs/.config/emacs/config.org111
1 files changed, 63 insertions, 48 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index a5a22df..1ada090 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -2680,11 +2680,67 @@ install~.
:init
(setq merlin-eldoc-occurrences nil))
#+end_src
-** Common Lisp
-Common Lisp is a dialect of Lisp, the most /common/ one around. Emacs
-comes with builtin Lisp support, of course, and it's really good in
-comparison to literally everything else. However, I wish it had a
-better REPL...
+** Lisp
+Emacs is the greatest Lisp editor around. There are no two ways about
+it. Here I setup the configuration for Emacs Lisp editing (the
+default experience OOTB) and Common Lisp
+*** 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
Enter /SLY/. Sly is a fork of /SLIME/ and is *mandatory* for lisp
development on Emacs.
@@ -2718,9 +2774,8 @@ Here I just setup Sly to use ~sbcl~.
:keymaps 'lisp-mode-map
"gr" #'sly-eval-buffer
"gd" #'sly-edit-definition
- "gR" #'sly-who-calls
- "C-j" #'sp-forward-slurp-sexp
- "C-k" #'sp-forward-barf-sexp)
+ "gR" #'sly-who-calls)
+
(local-leader
:keymaps 'lisp-mode-map
"a" #'sly-apropos
@@ -2794,46 +2849,6 @@ Here I just setup Sly to use ~sbcl~.
:keymaps 'sly-inspector-mode-map
"q" #'sly-inspector-quit))
#+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
Add a new lisp indent function which indents newline lists more
appropriately.