summaryrefslogtreecommitdiff
path: root/cvelist.el
diff options
context:
space:
mode:
Diffstat (limited to 'cvelist.el')
-rw-r--r--cvelist.el55
1 files changed, 35 insertions, 20 deletions
diff --git a/cvelist.el b/cvelist.el
index dd48d2c..03b5f56 100644
--- a/cvelist.el
+++ b/cvelist.el
@@ -8,7 +8,33 @@
;; (setq auto-mode-alist
;; (cons '("list" . debian-cvelist-mode) auto-mode-alist))
-;; indentation
+(defun debian-cvelist-insert-not-for-us ()
+ "Insert NOT-FOR-US keyword"
+ (interactive)
+ (insert "\tNOT-FOR-US: "))
+
+(defun debian-cvelist-insert-note ()
+ "Insert NOTE comment"
+ (interactive)
+ (insert "\tNOTE: "))
+
+(defvar debian-cvelist-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-c C-f") 'debian-cvelist-insert-not-for-us)
+ (define-key map (kbd "C-c C-n") 'debian-cvelist-insert-note)
+ map)
+ "Keymap for `debian-cvelist-mode'.")
+
+(defvar debian-cvelist-font-lock-keywords
+ '(("^CVE-[0-9]\\{4\\}-[0-9X]\\{4\\}" . font-lock-function-name-face)
+ ("^\tNOTE:" . font-lock-comment-delimiter-face)
+ ("^\tTODO:" . font-lock-warning-face)
+ ("^\t\\(RESERVED\\|NOT-FOR-US\\|REJECTED\\)" . font-lock-keyword-face)
+ ("^CVE-[0-9]\\{4\\}-[0-9X]\\{4\\}" "\\[\\(.*\\)\\]$" nil nil (1 font-lock-variable-name-face))
+ ("\\<unfixed\\|undetermined\\>" . font-lock-warning-face)
+ ("\\<end-of-life\\|not-affected\\|no-dsa\\>" . font-lock-constant-face))
+ "Keyword highlighting for `debian-cvelist-mode'")
+
(defun debian-cvelist-is-cve ()
(save-excursion
(beginning-of-line)
@@ -19,22 +45,11 @@
(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)
- ("^\tTODO:" . font-lock-warning-face)
- ("^\t\\(RESERVED\\|NOT-FOR-US\\|REJECTED\\)" . font-lock-keyword-face)
- ("^CVE-[0-9]\\{4\\}-[0-9X]\\{4\\}" "\\[\\(.*\\)\\]$" nil nil (1 font-lock-variable-name-face))
- ("\\<unfixed\\|undetermined\\>" . font-lock-warning-face)
- ("\\<end-of-life\\|not-affected\\|no-dsa\\>" . font-lock-constant-face)
- ))
-
-(define-derived-mode debian-cvelist-mode fundamental-mode
- (setq font-lock-defaults '(debian-cvelist-highlights))
- (setq mode-name "debian cvelist")
- (setq indent-line-function 'debian-cvelist-indent-line)
- )
+ (indent-line-to 8)))
+
+(define-derived-mode debian-cvelist-mode fundamental-mode "debian-cvelist"
+ "A major mode for editing data/CVE/list in the Debian secure-testing repo."
+ (setq-local font-lock-defaults '(debian-cvelist-font-lock-keywords nil))
+ (setq indent-line-function 'debian-cvelist-indent-line))
+
+(provide 'debian-cvelist)