-
Notifications
You must be signed in to change notification settings - Fork 0
/
jboss-mode.el
58 lines (50 loc) · 1.9 KB
/
jboss-mode.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
;; jboss-mode.el - minor mode for reading jboss logfiles
;; Author: Matthias Pfeifer ([email protected])
;; -----------------------------------------------
;;
(defun mp::goto-next-DEBUG ()
"Go to next line with level of debug or lower."
(interactive)
(re-search-forward "^[0-9:,]+ \\(DEBUG\\)")
)
(defun mp::goto-next-TRACE ()
"Go to next line with level of debug or lower."
(interactive)
(re-search-forward "^[0-9:,]+ \\(TRACE""\\)")
)
(defun mp::goto-next-ERROR ()
"Go to next line with level of error or lower."
(interactive)
(re-search-forward "^[0-9:,]+ \\(FATAL\\|ERROR\\)")
)
(defun mp::goto-next-WARN ()
"Go to next line with level of warn or lower."
(interactive)
(re-search-forward "^[0-9:,]+ \\(WARN\\|ERROR\\|FATAL\\)")
)
(defun mp::goto-next-INFO ()
"Go to next line with level of warn or lower."
(interactive)
(re-search-forward "^[0-9:,]+ \\(INFO\\|WARN\\|ERROR\\|FATAL\\)")
)
(define-derived-mode jboss-mode read-only-mode "jboss"
"A major mode for viewing jboss logfiles."
:keymap jboss-mode-map
(local-set-key (kbd "C-w") 'mp::goto-next-WARN)
(local-set-key (kbd "C-e") 'mp::goto-next-ERROR)
(local-set-key (kbd "C-d") 'mp::goto-next-DEBUG)
(local-set-key (kbd "k") 'scroll-down-one-line)
(local-set-key (kbd "j") 'scroll-up-one-line)
(let ((jboss-font-lock-keywords
'(("^[0-9:,]+[[:space:]]" . font-lock-comment-face)
("INFO" . font-lock-constant-face)
("ERROR" . font-lock-preprocessor-face)
("DEBUG" . font-lock-keyword-face)
("WARN\\|WARNUNG" . font-lock-function-name-face)
("FATAL\\|SCHWERWIEGEND" . font-lock-function-name-face)
("\\[[a-zA-Z0-9.]+\\]" . font-lock-type-face)
("([[:space:]A-Za-z0-9-]+)" . font-lock-builtin-face)
)))
(setq font-lock-defaults '(jboss-font-lock-keywords)))
)
(provide 'jboss-mode)