summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-10-31 15:18:05 +0100
committerGuido Günther <agx@sigxcpu.org>2015-10-31 15:18:05 +0100
commit4796b34454d6b3b29a479ef073328b70a0c0568b (patch)
tree745a1e76efbd1a9154fece725c3e89f0c53d56de
parent200d437c93536d911da85e080188fc68a5221122 (diff)
Add some basic indentation
Entries startint with CVE- will be indented to column 0 all others to column 8
-rw-r--r--cvelist.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/cvelist.el b/cvelist.el
index 3eb4bac..dd48d2c 100644
--- a/cvelist.el
+++ b/cvelist.el
@@ -8,7 +8,21 @@
;; (setq auto-mode-alist
;; (cons '("list" . debian-cvelist-mode) auto-mode-alist))
+;; indentation
+(defun debian-cvelist-is-cve ()
+ (save-excursion
+ (beginning-of-line)
+ (looking-at "[[:space:]]*CVE-")))
+(defun debian-cvelist-indent-line ()
+ "Indent current line as debian CVE list"
+ (beginning-of-line)
+ (if (debian-cvelist-is-cve)
+ (indent-line-to 0)
+ (indent-line-to 8))
+ )
+
+;; syntax highlighting
(setq debian-cvelist-highlights
'(("^CVE-[0-9]\\{4\\}-[0-9X]\\{4\\}" . font-lock-function-name-face)
("^\tNOTE:" . font-lock-comment-delimiter-face)
@@ -21,4 +35,6 @@
(define-derived-mode debian-cvelist-mode fundamental-mode
(setq font-lock-defaults '(debian-cvelist-highlights))
- (setq mode-name "debian cvelist"))
+ (setq mode-name "debian cvelist")
+ (setq indent-line-function 'debian-cvelist-indent-line)
+ )