[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/systemd 2e6309d 002/131: add systemd-mode.el
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/systemd 2e6309d 002/131: add systemd-mode.el |
Date: |
Sun, 29 Aug 2021 11:35:04 -0400 (EDT) |
branch: elpa/systemd
commit 2e6309d2e2cb02852bec640ceac1610e4d054b7a
Author: Mark Oteiza <mvoteiza@udel.edu>
Commit: Mark Oteiza <mvoteiza@udel.edu>
add systemd-mode.el
---
systemd-mode.el | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/systemd-mode.el b/systemd-mode.el
new file mode 100644
index 0000000..38a82ca
--- /dev/null
+++ b/systemd-mode.el
@@ -0,0 +1,88 @@
+;;; systemd-mode.el --- Major mode for editing systemd units
+
+;; Copyright (C) 2014 Mark Oteiza <mvoteiza@udel.edu>
+
+;; Author: Mark Oteiza <mvoteiza@udel.edu>
+;; Keywords: tools, unix
+
+;; This file 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 file 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 file. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(defgroup systemd ()
+ "Major mode for editing systemd units."
+ :group 'tools)
+
+(defcustom systemd-comment-start "#"
+ "String to insert to start a new comment."
+ :group 'systemd
+ :type '(choice (string :tag "Comment sign" "#")
+ (string :tag "Semicolon" ";")))
+
+(defvar systemd-font-lock-keywords
+ `(
+ ("^\\([#;]\\(.*\\)\\)$"
+ (1 'font-lock-comment-delimiter-face)
+ (2 'font-lock-comment-face))
+ ("\\\\$" 0 'font-lock-warning-face) ; line break
+ ;; sections
+ ("^\\(\\[[[:upper:]][[:alnum:]]+\\]\\)"
+ 1 'font-lock-type-face)
+ ;; keys
+ ("^\\([[:upper:]][[:alnum:]]+\\)="
+ 1 'font-lock-keyword-face)
+ ;; boolean arguments
+ ("=\\(1\\|yes\\|true\\|on\\|0\\|no\\|false\\|off\\)$"
+ 1 'font-lock-constant-face)
+ ;; specifiers
+ ("%[nNpPiIfcrRtuUhsmbHv%]" 0 'font-lock-constant-face)
+ )
+ "Default expressions to highlight in `systemd-mode'. See systemd.unit(5)
+for details on unit file syntax.")
+
+(defvar systemd-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\" ". " table)
+ (modify-syntax-entry ?\n "> " table)
+ (modify-syntax-entry ?\% "\\ " table)
+ table)
+ "Syntax table used in `systemd-mode' buffers.")
+
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.automount\\'" .
systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.busname\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.mount\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.service\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.socket\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.target\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.timer\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.link\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.netdev\\'" . systemd-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.network\\'" . systemd-mode))
+
+;;;###autoload
+(define-derived-mode systemd-mode fundamental-mode "Systemd"
+ "Major mode for editing systemd unit files. See
+http://www.freedesktop.org/wiki/Software/systemd/ for more
+information about systemd. The hook `systemd-mode-hook' is run
+at mode initialization."
+ (set-syntax-table systemd-mode-syntax-table)
+ (setq-local comment-start systemd-comment-start)
+ (setq-local font-lock-defaults '(systemd-font-lock-keywords))
+ (run-mode-hooks 'systemd-mode-hook))
+
+(provide 'systemd-mode)
+
+;;; systemd-mode.el ends here
- [nongnu] elpa/systemd 50c63c2 026/131: allow cycling completions in `systemd-doc-open`, (continued)
- [nongnu] elpa/systemd 50c63c2 026/131: allow cycling completions in `systemd-doc-open`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 612c3de 027/131: double bump, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 347c157 031/131: lexical binding, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd e7a2efb 021/131: mention `package-install-file` in README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd ed00e3f 029/131: require 24.4 (with-eval-after-load), ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd ef24360 037/131: spaces unneeded in syntax table modifications, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 0c871fc 042/131: Use four different candidate lists:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 602d9d3 050/131: reword some commentary, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 6fd29c5 070/131: font lock keywords: comments and sections, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd ff523bc 071/131: woops, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 2e6309d 002/131: add systemd-mode.el,
ELPA Syncer <=
- [nongnu] elpa/systemd 37541b2 003/131: add facility for browsing documentation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 930e82e 100/131: font lock additional exec prefix, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 9cfd315 102/131: simplify, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 1e7567a 117/131: prepare v1.6, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 077aedd 125/131: systemd 244 directives, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 53b44ad 001/131: initial commit, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 7bdb35a 032/131: mention package archive in README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 3cb77a5 013/131: add a link, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd a46e81b 017/131: autoload for slice units, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd b03e616 079/131: bump, ELPA Syncer, 2021/08/29