blob: 906ac1f8c386b2efdb68eea4de62c1c3a72140ba (
plain)
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
|
;; simplify mail handling
(defun _xcpu-current-line-empty-p ()
(eq 0 (string-match-p "^$" (thing-at-point 'line))))
(defun _xcpu-current-line-banner-p ()
(eq 0 (string-match-p "^On" (thing-at-point 'line))))
(defun _xcpu-current-line-quoted-empty-p ()
(eq 0 (string-match-p "^\\(> *\\)$" (thing-at-point 'line))))
(defun _xcpu-current-line-quoted-p ()
(eq 0 (string-match-p "^\\(> *\\)" (thing-at-point 'line))))
(defun xcpu-reply-mail ()
"Skip over header and look for first paragraph to reply to when answering mail"
(interactive)
(goto-char 1)
;; Skip the email header
(while (not (_xcpu-current-line-empty-p))
(forward-line 1)
(beginning-of-line)
)
(forward-line 1)
;; Insert greeting if reply or new mail
(when (or
(_xcpu-current-line-banner-p)
(_xcpu-current-line-empty-p))
(forward-line -1)
(insert "\nHi,")
(forward-line 2)
;; search for first quoted line that is empty
(when (_xcpu-current-line-quoted-p)
(while (not (_xcpu-current-line-quoted-empty-p))
(forward-line 1)
(beginning-of-line)
))
)
)
|