-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathpen-core.el
33 lines (22 loc) · 921 Bytes
/
pen-core.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
;; These are helper functions
;; examplary.el uses them.
;; So might org-brain
(defun pen-preceding-text ()
(str (buffer-substring (point) (max 1 (- (point) 1000)))))
;; TODO Figure out how to get the previous line start of line points
;; (tv (save-excursion (ntimes 5 (call-interactively 'previous-line)) (message (str (point)))))
(defun get-point-start-of-nth-previous-line (n)
(save-excursion
(eval `(ntimes ,n (ignore-errors (previous-line))))
(beginning-of-line)
(point)))
(defun pen-surrounding-text (&optional window-line-size)
(if (not window-line-size)
(setq window-line-size 20))
(str (buffer-substring (- (point)
(save-excursion
(ntimes window-line-size (previous-line))
(point))
10) (max 1 (- (point) 1000)))))
(ntimes 5 (message "hi"))
(provide 'pen-core)