-
Notifications
You must be signed in to change notification settings - Fork 0
/
notespace.el
73 lines (63 loc) · 2.5 KB
/
notespace.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
;;; notespace.el -*- lexical-binding: t; -*-
(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 C-n e") 'notespace/eval-this-notespace)
(define-key clojure-mode-map (kbd "C-c C-n r") 'notespace/eval-and-realize-this-notespace)
(define-key clojure-mode-map (kbd "C-c C-n n") 'notespace/eval-and-realize-note-at-this-line)
(define-key clojure-mode-map (kbd "C-c C-n f") 'notespace/eval-and-realize-notes-from-this-line)
(define-key clojure-mode-map (kbd "C-c C-n i b") 'notespace/init-with-browser)
(define-key clojure-mode-map (kbd "C-c C-n i i") 'notespace/init)
(define-key clojure-mode-map (kbd "C-c C-n s") 'notespace/render-static-html)
(define-key clojure-mode-map (kbd "C-c C-n c") 'notespace/eval-and-realize-notes-from-change)))