[Secure-testing-commits] r37565 - conf
Sebastien Delafond
seb at moszumanska.debian.org
Wed Nov 4 17:32:13 UTC 2015
Author: seb
Date: 2015-11-04 17:32:13 +0000 (Wed, 04 Nov 2015)
New Revision: 37565
Modified:
conf/cvelist.el
Log:
[conf/cvelist.el] Tidying up a bit
* use defvars for font-lock patterns
* use our mode's own keymap instead of global-set-key
* add documentation strings
Modified: conf/cvelist.el
===================================================================
--- conf/cvelist.el 2015-11-04 16:22:29 UTC (rev 37564)
+++ conf/cvelist.el 2015-11-04 17:32:13 UTC (rev 37565)
@@ -8,29 +8,35 @@
;; (setq auto-mode-alist
;; (cons '("list" . debian-cvelist-mode) auto-mode-alist))
+(defun debian-cvelist-insert-not-for-us ()
+ "Insert NOT-FOR-US keyword"
+ (interactive)
+ (insert "\tNOT-FOR-US: "))
-(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)
- ))
+(defun debian-cvelist-insert-note ()
+ "Insert NOTE comment"
+ (interactive)
+ (insert "\tNOTE: "))
-(global-set-key
- (kbd "C-c C-f")
- (lambda ()
- (interactive)
- (insert "\tNOT-FOR-US: ")))
+(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'.")
-(global-set-key
- (kbd "C-c C-n")
- (lambda ()
- (interactive)
- (insert "\tNOTE: ")))
+(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'")
-(define-derived-mode debian-cvelist-mode fundamental-mode
- (setq font-lock-defaults '(debian-cvelist-highlights))
- (setq mode-name "debian cvelist"))
+(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)))
+
+(provide 'debian-cvelist)
More information about the Secure-testing-commits
mailing list