diff options
author | John Turner <jturner.usa@gmail.com> | 2025-08-16 14:36:11 -0400 |
---|---|---|
committer | John Turner <jturner.usa@gmail.com> | 2025-08-16 14:36:11 -0400 |
commit | 882ddb175ab3df60f26c5ade57d462a76e9d346c (patch) | |
tree | edf7e8553eb81a9cb9c79e7ed9468135e3b8b4f9 /lisp/cil-mode/cil-mode.el | |
parent | ac196059a5be8ca827c9908485c902d7d00f08ac (diff) | |
parent | f24d553c1c07448fee69caf405f7aa155afa883d (diff) | |
download | emacs.d-882ddb175ab3df60f26c5ade57d462a76e9d346c.tar.gz |
Add 'lisp/cil-mode/' from commit 'f24d553c1c07448fee69caf405f7aa155afa883d'
git-subtree-dir: lisp/cil-mode
git-subtree-mainline: ac196059a5be8ca827c9908485c902d7d00f08ac
git-subtree-split: f24d553c1c07448fee69caf405f7aa155afa883d
Diffstat (limited to 'lisp/cil-mode/cil-mode.el')
-rw-r--r-- | lisp/cil-mode/cil-mode.el | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lisp/cil-mode/cil-mode.el b/lisp/cil-mode/cil-mode.el new file mode 100644 index 0000000..60c6b50 --- /dev/null +++ b/lisp/cil-mode/cil-mode.el @@ -0,0 +1,44 @@ +;;; cil-mode.el --- major mode for selinux cil -*- lexical-binding: t; -*- + +;; Copyright (C) 2025 John Turner + +;; Author: John Turner <jturner.usa@gmail.com> +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Code: + +(require 'rx) + +(put 'block 'lisp-indent-function 4) + +(defcustom cil-mode-indent-width 4 + "Amount of spaces to indent expressions with.") + +(defun cil-mode--indent-function (_ _) + (* cil-mode-indent-width (car (syntax-ppss)))) + +(defvar cil-mode--font-lock-defaults + `((,(rx (group (or "in" "block" "macro")) eow) + 0 font-lock-keyword-face))) + +(define-derived-mode cil-mode lisp-data-mode "cil" + (setq-local font-lock-defaults cil-mode--font-lock-defaults) + (setq-local lisp-indent-function 'cil-mode--indent-function)) + +(add-to-list 'auto-mode-alist '("\\.cil\\'" . cil-mode)) + +(provide 'cil-mode) +;;; cil-mode.el ends here |