[Git][security-tracker-team/security-tracker][master] elisp: correctly disable font-locking for non-keyword through buffer-local font-lock-defaults

Sebastien Delafond seb at debian.org
Fri Mar 5 09:45:16 GMT 2021



Sebastien Delafond pushed to branch master at Debian Security Tracker / security-tracker


Commits:
3866ec71 by Sébastien Delafond at 2021-03-05T10:35:25+01:00
elisp: correctly disable font-locking for non-keyword through buffer-local font-lock-defaults

Reformat the entire file while at it, and make flycheck happy

- - - - -


1 changed file:

- conf/cvelist.el


Changes:

=====================================
conf/cvelist.el
=====================================
@@ -1,24 +1,32 @@
-;; Major mode for Debian's CVE list
-;;
-;; Can be enabled via
-;;
-;; (autoload 'debian-cvelist-mode "cvelist.el"
-;;     "Major mode for debian CVE lists" t)
-;; (setq auto-mode-alist
-;;     (cons '("list" . debian-cvelist-mode) auto-mode-alist))
+;;; cvelist --- Major mode for Debian's CVE list
+;;;
+;;; Commentary:
+;;;   only useful for security-tracker-team/security-tracker.git's data/CVE/list
+;;;
+;;; Code:
+;;;   Guido Günther
+;;;   Moritz Muehlenhoff
+;;;   Sébastien Delafond
+;;;
+;;; Can be enabled via:
+;;;
+;;; (autoload 'debian-cvelist-mode "cvelist.el"
+;;;     "Major mode for debian CVE lists" t)
+;;; (setq auto-mode-alist
+;;;     (cons '("list" . debian-cvelist-mode) auto-mode-alist))
 
 (defun debian-cvelist-insert-not-for-us ()
-  "Insert NOT-FOR-US keyword"
+  "Insert NOT-FOR-US keyword."
   (interactive)
   (insert "\tNOT-FOR-US: "))
 
 (defun debian-cvelist-insert-note ()
-  "Insert NOTE comment"
+  "Insert NOTE comment."
   (interactive)
   (insert "\tNOTE: "))
 
 (defun debian-cvelist-cvesearch ()
-  "Look up a CVE ID at the MITRE website"
+  "Look up a CVE ID at the MITRE website."
   (interactive)
   (browse-url (concat "https://cve.mitre.org/cgi-bin/cvename.cgi?name=" (thing-at-point 'symbol))))
 
@@ -31,7 +39,8 @@
    "Keymap for `debian-cvelist-mode'.")
 
 (defvar debian-cvelist-font-lock-keywords
-  '(("^CVE-[0-9]\\{4\\}-[0-9X]\\{4,7\\}" (0 font-lock-function-name-face) ;; face for CVE keyword
+  '(("^CVE-[0-9]\\{4\\}-[0-9X]\\{4,7\\}"
+     (0 font-lock-function-name-face) ;; face for CVE keyword
      ("(\\(.+\\))$" nil nil (1 font-lock-warning-face))) ;; face for the rest of the line
     ("D[LS]A-[0-9]\\{4,5\\}-[0-9]" . font-lock-function-name-face)
     ("#[0-9]\\{1,7\\}" . font-lock-type-face)
@@ -40,24 +49,26 @@
     ("^\t\\(RESERVED\\|NOT-FOR-US\\|REJECTED\\)" . font-lock-keyword-face)
     ("\\<unfixed\\|undetermined\\>" . font-lock-warning-face)
     ("\\<end-of-life\\|not-affected\\|no-dsa\\|ignored\\|postponed\\>" . font-lock-constant-face))
-  "Keyword highlighting for `debian-cvelist-mode'")
+  "Keyword highlighting for `debian-cvelist-mode'.")
 
 (defun debian-cvelist-is-cve ()
+  "Checks if a current line is a CVE description."
   (save-excursion
     (beginning-of-line)
     (looking-at "[[:space:]]*CVE-")))
 
 (defun debian-cvelist-indent-line ()
-  "Indent current line as debian CVE list"
+  "Indent current line as debian CVE list."
   (beginning-of-line)
   (if (debian-cvelist-is-cve)
       (indent-line-to 0)
     (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 font-lock-keywords-only t)
+  "A major mode for editing data/CVE/list in the Debian
+   secure-tracker repository."
+  (setq-local font-lock-defaults '(debian-cvelist-font-lock-keywords t))
   (setq indent-line-function 'debian-cvelist-indent-line))
 
 (provide 'debian-cvelist)
+;;; cvelist.el ends here



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/commit/3866ec71701037fb8f6be7d41d61289412251e72

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/commit/3866ec71701037fb8f6be7d41d61289412251e72
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20210305/49068c2d/attachment-0001.htm>


More information about the debian-security-tracker-commits mailing list