Author: agx
Date: 2015-11-05 18:49:44 +0000 (Thu, 05 Nov 2015)
New Revision: 37583

Modified:
   conf/cvelist.el
Log:
Add some basic indentation

CVE- aligned to column 0, all the rest to 8

Modified: conf/cvelist.el
===================================================================
--- conf/cvelist.el     2015-11-05 18:49:21 UTC (rev 37582)
+++ conf/cvelist.el     2015-11-05 18:49:44 UTC (rev 37583)
@@ -35,8 +35,21 @@
     ("\\<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)
+    (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)))
+
 (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-local font-lock-defaults '(debian-cvelist-font-lock-keywords nil))
+  (setq indent-line-function 'debian-cvelist-indent-line))
 
 (provide 'debian-cvelist)


_______________________________________________
Secure-testing-commits mailing list
Secure-testing-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/secure-testing-commits

Reply via email to