-
Notifications
You must be signed in to change notification settings - Fork 10
/
emacs-config.el
85 lines (73 loc) · 2.92 KB
/
emacs-config.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
;; Emacs config for Notespace v3
(defun cider-interactive-notify-and-eval (code)
(interactive)
(message code)
(cider-interactive-eval
code
(cider-interactive-eval-handler nil (point))
nil
nil))
(defun notespace/eval-and-realize-note-at-this-line ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
(concat "(notespace.api/eval-and-realize-note-at-line "
(number-to-string (line-number-at-pos))
")")))
(defun notespace/eval-and-realize-notes-from-this-line ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
(concat "(notespace.api/eval-and-realize-notes-from-line "
(number-to-string (line-number-at-pos))
")")))
(defun notespace/eval-and-realize-notes-from-change ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
(concat "(notespace.api/eval-and-realize-notes-from-change)")))
(defun notespace/init-with-browser ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
(concat "(notespace.api/init-with-browser)")))
(defun notespace/init ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
(concat "(notespace.api/init)")))
(defun notespace/eval-this-notespace ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
"(notespace.api/eval-this-notespace)"))
(defun notespace/eval-and-realize-this-notespace ()
(interactive)
(save-buffer)
(cider-interactive-notify-and-eval
"(notespace.api/eval-and-realize-this-notespace)"))
(defun notespace/render-static-html ()
(interactive)
(cider-interactive-notify-and-eval
"(notespace.api/render-static-html)"))
;; suggested emacs key binding (thanks @mchampine)
(add-hook 'clojure-mode-hook
(lambda ()
(define-key clojure-mode-map (kbd "C-c n e") 'notespace/eval-this-notespace)
(define-key clojure-mode-map (kbd "C-c n r") 'notespace/eval-and-realize-this-notespace)
(define-key clojure-mode-map (kbd "C-c n n") 'notespace/eval-and-realize-note-at-this-line)
(define-key clojure-mode-map (kbd "C-c n f") 'notespace/eval-and-realize-notes-from-this-line)
(define-key clojure-mode-map (kbd "C-c n i b") 'notespace/init-with-browser)
(define-key clojure-mode-map (kbd "C-c n i i") 'notespace/init)
(define-key clojure-mode-map (kbd "C-c n s") 'notespace/render-static-html)
(define-key clojure-mode-map (kbd "C-c n c") 'notespace/eval-and-realize-notes-from-change)))
;; suggested spacemacs key bindings:
(spacemacs/set-leader-keys-for-major-mode 'clojure-mode
"n e" 'notespace/eval-this-notespace
"n r" 'notespace/eval-and-realize-this-notespace
"n n" 'notespace/eval-and-realize-note-at-this-line
"n f" 'notespace/eval-and-realize-notes-from-this-line
"n i b" 'notespace/init-with-browser
"n i i" 'notespace/init
"n s" 'notespace/render-static-html
"n c" 'notespace/eval-and-realize-notes-from-change)