-
Notifications
You must be signed in to change notification settings - Fork 15
/
utils.el
35 lines (31 loc) · 799 Bytes
/
utils.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
;;; Some utility function
(defun undos ()
"Remove the <CR> in DOS files"
(interactive)
(save-excursion
(goto-char (point-min))
(replace-string "
" "")
(goto-char (point-min))
(replace-string "" "") ))
(defun unansi ()
"Remove the ansi markup in files"
(interactive)
(save-excursion
(goto-char (point-min))
(replace-regexp "\\([\\[0-9;\\]*m\\|\r\\)" "")
))
(defun unhtml ()
"Remove the HTML tags in a file"
(interactive)
(save-excursion
(goto-char (point-min))
(replace-regexp "<[^>]*>" "")
(goto-char (point-min))
(replace-string " " " ")
(goto-char (point-min))
(replace-string "<" "<")
(goto-char (point-min))
(replace-string ">" ">")
(goto-char (point-min))
(replace-string "&" "&") ))