about summary refs log tree commit diff
path: root/users/wpcarro/emacs/.emacs.d/wpc/wpc-lisp.el
blob: f4f8c693158221b761c0ba7ed7b738716ab2c611 (plain) (blame)
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
;;; wpc-lisp.el --- Generic LISP preferences -*- lexical-binding: t -*-

;; Author: William Carroll <wpcarro@gmail.com>
;; Version: 0.0.1
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
;; Package-Requires: ((emacs "24"))

;;; Commentary:
;; parent (up)
;; child (down)
;; prev-sibling (left)
;; next-sibling (right)

;;; Code:

;; TODO: Consider having a separate module for each LISP dialect.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'general)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defconst wpc-lisp--hooks
  '(lisp-mode-hook
    emacs-lisp-mode-hook
    clojure-mode-hook
    clojurescript-mode-hook
    racket-mode-hook)
  "List of LISP modes.")

(use-package sly
  :config
  (setq inferior-lisp-program "sbcl")
  (general-define-key
   :keymaps 'sly-mode-map
   :states '(normal)
   :prefix "<SPC>"
   "x" #'sly-eval-defun
   "X" #'sly-eval-buffer
   "d" #'sly-describe-symbol))

(use-package rainbow-delimiters
  :config
  (general-add-hook wpc-lisp--hooks #'rainbow-delimiters-mode))

(use-package racket-mode
  :config
  (general-define-key
   :keymaps 'racket-mode-map
   :states 'normal
   :prefix "<SPC>"
   "x" #'racket-send-definition
   "X" #'racket-run
   "d" #'racket-describe)
  (setq racket-program "~/.nix-profile/bin/racket"))

(use-package lispyville
  :init
  (defconst wpc-lisp--lispyville-key-themes
    '(c-w
      operators
      text-objects
      prettify
      commentary
      slurp/barf-cp
      wrap
      additional
      additional-insert
      additional-wrap
      escape)
    "All available key-themes in Lispyville.")
  :config
  (general-add-hook wpc-lisp--hooks #'lispyville-mode)
  (lispyville-set-key-theme wpc-lisp--lispyville-key-themes)
  (progn
    (general-define-key
     :keymaps 'lispyville-mode-map
     :states 'motion
     ;; first unbind
     "M-h" nil
     "M-l" nil)
    (general-define-key
     :keymaps 'lispyville-mode-map
     :states 'normal
     ;; first unbind
     "M-j" nil
     "M-k" nil
     ;; second rebind
     "C-s-h" #'lispyville-drag-backward
     "C-s-l" #'lispyville-drag-forward
     "C-s-e" #'lispyville-end-of-defun
     "C-s-a" #'lispyville-beginning-of-defun)))

;; Elisp
(use-package elisp-slime-nav
  :config
  (general-add-hook 'emacs-lisp-mode #'ielm-mode))

(general-define-key
 :keymaps 'emacs-lisp-mode-map
 :prefix "<SPC>"
 :states 'normal
 "x" #'eval-defun
 "X" #'eval-buffer
 "d" (lambda ()
       (interactive)
       (with-current-buffer (current-buffer)
         (helpful-function (symbol-at-point)))))

(provide 'wpc-lisp)
;;; wpc-lisp.el ends here