Compare commits
No commits in common. "master" and "v1.5" have entirely different histories.
8
Makefile
8
Makefile
@ -1,6 +1,6 @@
|
||||
SRC = systemd.el
|
||||
DATA = unit-directives.txt network-directives.txt nspawn-directives.txt
|
||||
DISTFILES := Makefile $(SRC) $(DATA) LICENSE README systemd-pkg.el test
|
||||
DISTFILES := Makefile $(SRC) $(DATA) LICENSE README systemd-pkg.el tests
|
||||
|
||||
VERSION := $(shell awk '/^;; Version:/ {print $$3}' $(SRC))
|
||||
|
||||
@ -18,13 +18,13 @@ systemd-pkg.el: $(SRC)
|
||||
|
||||
systemd.elc: $(DATA)
|
||||
|
||||
check: test/systemd-tests.el systemd.elc
|
||||
check: tests/systemd-tests.el systemd.elc
|
||||
@$(EMACS) -Q --batch -L . --eval "(progn \
|
||||
(load-file \"test/systemd-tests.el\") \
|
||||
(load-file \"tests/systemd-tests.el\") \
|
||||
(ert-run-tests-batch-and-exit))"
|
||||
|
||||
clean:
|
||||
$(RM) $(SRC:.el=.elc) systemd-pkg.el
|
||||
$(RM) $(SRC:.el=.elc)
|
||||
|
||||
dist: clean systemd-pkg.el
|
||||
mkdir systemd-$(VERSION)
|
||||
|
||||
3
README
3
README
@ -7,7 +7,8 @@ in `systemd.el`.
|
||||
Installation
|
||||
------------
|
||||
|
||||
Available as the `systemd` package on MELPA <https://melpa.org/>.
|
||||
Available as the `systemd` package on MELPA <http://melpa.org/> and
|
||||
marmalade <https://marmalade-repo.org/>.
|
||||
|
||||
In Emacs, one can locally install as a package with `make dist` and
|
||||
|
||||
|
||||
@ -2,56 +2,35 @@ ARP
|
||||
ARPAllTargets
|
||||
ARPIPTargets
|
||||
ARPIntervalSec
|
||||
ARPProxy
|
||||
ARPValidate
|
||||
Activate
|
||||
ActiveSlave
|
||||
AdActorSystem
|
||||
AdActorSystemPriority
|
||||
AdSelect
|
||||
AdUserPortKey
|
||||
Address
|
||||
AddressAutoconfiguration
|
||||
Advertise
|
||||
AgeingTimeSec
|
||||
Alias
|
||||
AllMulticast
|
||||
AllSlavesActive
|
||||
AllowLocalRemote
|
||||
AllowPortToBeRoot
|
||||
AllowedIPs
|
||||
Anonymize
|
||||
Architecture
|
||||
AssignToLoopback
|
||||
AssociatedWith
|
||||
AutoJoin
|
||||
AutoNegotiation
|
||||
BSSID
|
||||
BindCarrier
|
||||
BitRate
|
||||
BitsPerSecond
|
||||
BlackList
|
||||
Bond
|
||||
Bridge
|
||||
Broadcast
|
||||
Cache
|
||||
ClientIdentifier
|
||||
CombinedChannels
|
||||
ConfigureWithoutCarrier
|
||||
CopyDSCP
|
||||
Cost
|
||||
CriticalConnection
|
||||
DHCP
|
||||
DHCPServer
|
||||
DNS
|
||||
DNSDefaultRoute
|
||||
DNSLifetimeSec
|
||||
DNSOverTLS
|
||||
DNSSEC
|
||||
DNSSECNegativeTrustAnchors
|
||||
DNSStubListener
|
||||
DUIDRawData
|
||||
DUIDType
|
||||
DefaultLeaseTimeSec
|
||||
DefaultPVID
|
||||
DefaultRouteOnDevice
|
||||
Description
|
||||
DefaultPVID
|
||||
Destination
|
||||
DestinationPort
|
||||
DiscoverPathMTU
|
||||
@ -60,44 +39,23 @@ DownDelaySec
|
||||
Driver
|
||||
Duplex
|
||||
DuplicateAddressDetection
|
||||
DynamicTransmitLoadBalancing
|
||||
ERSPANIndex
|
||||
EgressUntagged
|
||||
EmitDNS
|
||||
EmitDomains
|
||||
EmitLLDP
|
||||
EmitNTP
|
||||
EmitRouter
|
||||
EmitSIP
|
||||
EmitTimezone
|
||||
Encapsulation
|
||||
EncapsulationLimit
|
||||
EncapsulationType
|
||||
Encrypt
|
||||
Endpoint
|
||||
FDBAgeingSec
|
||||
FOUDestinationPort
|
||||
FOUSourcePort
|
||||
FailOverMACPolicy
|
||||
Family
|
||||
FallbackDNS
|
||||
FallbackNTP
|
||||
FastLeave
|
||||
FastOpenNoCookie
|
||||
FirewallMark
|
||||
Flags
|
||||
FlowLabel
|
||||
FooOverUDP
|
||||
ForceDHCPv6PDOtherInformation
|
||||
ForwardDelaySec
|
||||
From
|
||||
GVRP
|
||||
Gateway
|
||||
GatewayOnLink
|
||||
GenericProtocolExtension
|
||||
GenericReceiveOffload
|
||||
GenericSegmentationOffload
|
||||
GratuitousARP
|
||||
Group
|
||||
GroupForwardMask
|
||||
GroupPolicyExtension
|
||||
HairPin
|
||||
HelloTimeSec
|
||||
@ -105,42 +63,19 @@ HomeAddress
|
||||
Host
|
||||
Hostname
|
||||
IAID
|
||||
IPDoNotFragment
|
||||
IPForward
|
||||
IPMasquerade
|
||||
IPProtocol
|
||||
IPServiceType
|
||||
IPVLAN
|
||||
IPv4LLRoute
|
||||
IPv4ProxyARP
|
||||
IPv6AcceptRA
|
||||
IPv6DuplicateAddressDetection
|
||||
IPv6FlowLabel
|
||||
IPv6HopLimit
|
||||
IPv6MTUBytes
|
||||
IPv6Preference
|
||||
IPv6PrefixDelegation
|
||||
IPv6PrivacyExtensions
|
||||
IPv6ProxyNDP
|
||||
IPv6ProxyNDPAddress
|
||||
IPv6RapidDeploymentPrefix
|
||||
IPv6Token
|
||||
ISATAP
|
||||
Id
|
||||
IgnoreCarrierLoss
|
||||
IncomingInterface
|
||||
Independent
|
||||
InitialAdvertisedReceiveWindow
|
||||
InitialCongestionWindow
|
||||
InputKey
|
||||
InterfaceId
|
||||
InvertRule
|
||||
KeepConfiguration
|
||||
KernelCommandLine
|
||||
KernelVersion
|
||||
Key
|
||||
KeyFile
|
||||
KeyId
|
||||
Kind
|
||||
L2MissNotification
|
||||
L3MissNotification
|
||||
@ -149,168 +84,84 @@ LLDP
|
||||
LLMNR
|
||||
Label
|
||||
LargeReceiveOffload
|
||||
Layer2SpecificHeader
|
||||
LearnPacketIntervalSec
|
||||
Learning
|
||||
LifetimeSec
|
||||
LinkLayerAddress
|
||||
LinkLocalAddressing
|
||||
ListenPort
|
||||
Local
|
||||
LooseBinding
|
||||
MACAddress
|
||||
MACAddressPolicy
|
||||
MACVLAN
|
||||
MACsec
|
||||
MIIMonitorSec
|
||||
MTUBytes
|
||||
MVRP
|
||||
MacLearning
|
||||
ManageTemporaryAddress
|
||||
Managed
|
||||
MaxAgeSec
|
||||
MaxAttempts
|
||||
MaxLeaseTimeSec
|
||||
MaximumFDBEntries
|
||||
Metric
|
||||
MinLinks
|
||||
Mode
|
||||
MultiQueue
|
||||
Multicast
|
||||
MulticastDNS
|
||||
MulticastFlood
|
||||
MulticastIGMPVersion
|
||||
MulticastQuerier
|
||||
MulticastRouter
|
||||
MulticastSnooping
|
||||
MulticastToUnicast
|
||||
NTP
|
||||
Name
|
||||
NamePolicy
|
||||
NeighborSuppression
|
||||
NetworkEmulatorDelayJitterSec
|
||||
NetworkEmulatorDelaySec
|
||||
NetworkEmulatorDuplicateRate
|
||||
NetworkEmulatorLossRate
|
||||
NetworkEmulatorPacketLimit
|
||||
OnLink
|
||||
OneQueue
|
||||
OriginalName
|
||||
OtherChannels
|
||||
OtherInformation
|
||||
OutgoingInterface
|
||||
OutputKey
|
||||
PVID
|
||||
PacketInfo
|
||||
PacketNumber
|
||||
PacketsPerSlave
|
||||
Parent
|
||||
Path
|
||||
Peer
|
||||
PeerPort
|
||||
PeerSessionId
|
||||
PeerTunnelId
|
||||
PersistentKeepalive
|
||||
PoolOffset
|
||||
PoolSize
|
||||
Port
|
||||
PortRange
|
||||
PreferredLifetime
|
||||
PreferredLifetimeSec
|
||||
PreferredSource
|
||||
Prefix
|
||||
PrefixDelegationHint
|
||||
PrefixRoute
|
||||
PresharedKey
|
||||
PresharedKeyFile
|
||||
PrimaryReselectPolicy
|
||||
PrimarySlave
|
||||
Priority
|
||||
PrivateKey
|
||||
PrivateKeyFile
|
||||
Property
|
||||
Protocol
|
||||
ProxyARP
|
||||
ProxyARPWiFi
|
||||
PublicKey
|
||||
QuickAck
|
||||
RapidCommit
|
||||
ReduceARPProxy
|
||||
Remote
|
||||
RemoteChecksumRx
|
||||
RemoteChecksumTx
|
||||
ReorderHeader
|
||||
RequestBroadcast
|
||||
RequestOptions
|
||||
RequiredForOnline
|
||||
ResendIGMP
|
||||
RestartSec
|
||||
Route
|
||||
RouteMetric
|
||||
RouteShortCircuit
|
||||
RouteTable
|
||||
RouterLifetimeSec
|
||||
RouterPreference
|
||||
RoutesToDNS
|
||||
RxBufferSize
|
||||
RxChannels
|
||||
SSID
|
||||
STP
|
||||
SamplePoint
|
||||
Scope
|
||||
SendHostname
|
||||
SendOption
|
||||
SendRelease
|
||||
SerializeTunneledPackets
|
||||
SessionId
|
||||
Source
|
||||
SourcePort
|
||||
TCP6SegmentationOffload
|
||||
TCPSegmentationOffload
|
||||
TOS
|
||||
TTL
|
||||
TTLPropagate
|
||||
Table
|
||||
Timezone
|
||||
To
|
||||
TransmitHashPolicy
|
||||
TripleSampling
|
||||
Tunnel
|
||||
TunnelId
|
||||
TxBufferSize
|
||||
TxChannels
|
||||
Type
|
||||
TypeOfService
|
||||
UDP6ZeroChecksumRx
|
||||
UDP6ZeroChecksumTx
|
||||
UDPChecksum
|
||||
UDPSourcePort
|
||||
UDPSegmentationOffload
|
||||
UnicastFlood
|
||||
Unmanaged
|
||||
UpDelaySec
|
||||
UseAutonomousPrefix
|
||||
UseBPDU
|
||||
UseDNS
|
||||
UseDomains
|
||||
UseForEncoding
|
||||
UseHostname
|
||||
UseMTU
|
||||
UseNTP
|
||||
UseOnLinkPrefix
|
||||
UseRoutes
|
||||
UseSIP
|
||||
UseTimezone
|
||||
User
|
||||
UserClass
|
||||
VLAN
|
||||
VLANFiltering
|
||||
VLANId
|
||||
VNI
|
||||
VNetHeader
|
||||
VRF
|
||||
VXLAN
|
||||
ValidLifetimeSec
|
||||
VendorClassIdentifier
|
||||
Virtualization
|
||||
WLANInterfaceType
|
||||
WakeOnLan
|
||||
Xfrm
|
||||
|
||||
@ -1,38 +1,28 @@
|
||||
Boot
|
||||
Ephemeral
|
||||
ProcessTwo
|
||||
Parameters
|
||||
Environment
|
||||
User
|
||||
WorkingDirectory
|
||||
PivotRoot
|
||||
Capability
|
||||
NoNewPrivileges
|
||||
DropCapability
|
||||
KillSignal
|
||||
Personality
|
||||
MachineID
|
||||
PrivateUsers
|
||||
NotifyReady
|
||||
SystemCallFilter
|
||||
LimitCPU
|
||||
OOMScoreAdjust
|
||||
CPUAffinity
|
||||
Hostname
|
||||
ResolvConf
|
||||
Timezone
|
||||
LinkJournal
|
||||
ReadOnly
|
||||
Volatile
|
||||
Bind
|
||||
BindReadOnly
|
||||
TemporaryFileSystem
|
||||
Inaccessible
|
||||
Overlay
|
||||
PrivateUsersChown
|
||||
Private
|
||||
VirtualEthernet
|
||||
VirtualEthernetExtra
|
||||
Interface
|
||||
MACVLAN
|
||||
IPVLAN
|
||||
Bridge
|
||||
Zone
|
||||
Port
|
||||
|
||||
216
systemd.el
216
systemd.el
@ -1,9 +1,9 @@
|
||||
;;; systemd.el --- Major mode for editing systemd units -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2014-2023 Mark Oteiza <mvoteiza@udel.edu>
|
||||
;; Copyright (C) 2014-2017 Mark Oteiza <mvoteiza@udel.edu>
|
||||
|
||||
;; Author: Mark Oteiza <mvoteiza@udel.edu>
|
||||
;; Version: 1.6.1
|
||||
;; Version: 1.5
|
||||
;; Package-Requires: ((emacs "24.4"))
|
||||
;; Keywords: tools, unix
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
;; Major mode for editing systemd units.
|
||||
|
||||
;; Similar to `conf-mode' but with enhanced highlighting; e.g. for
|
||||
;; Similar to `conf-mode' but with added highlighting; e.g. for
|
||||
;; specifiers and booleans. Employs strict regex for whitespace.
|
||||
;; Features a facility for browsing documentation: use C-c C-o to open
|
||||
;; links to documentation in a unit (cf. systemctl help).
|
||||
@ -33,8 +33,7 @@
|
||||
;; network configuration. Both a completer for
|
||||
;; `completion-at-point-functions' and a company backend are provided.
|
||||
;; The latter can be enabled by adding `company-mode' to
|
||||
;; `systemd-mode-hook' and adding `systemd-company-backend' to
|
||||
;; `company-backends'.
|
||||
;; `systemd-mode-hook'.
|
||||
|
||||
;;; Code:
|
||||
|
||||
@ -45,12 +44,9 @@
|
||||
(declare-function company-begin-backend "company")
|
||||
(declare-function company-grab-symbol "company")
|
||||
|
||||
(defvar font-lock-beg)
|
||||
(defvar font-lock-end)
|
||||
|
||||
(defgroup systemd ()
|
||||
"Major mode for editing systemd units."
|
||||
:link '(url-link "https://www.freedesktop.org/wiki/Software/systemd/")
|
||||
:link '(url-link "http://www.freedesktop.org/wiki/Software/systemd/")
|
||||
:group 'tools)
|
||||
|
||||
(defcustom systemd-browse-url-function 'browse-url
|
||||
@ -82,7 +78,7 @@
|
||||
|
||||
(defconst systemd-unit-sections
|
||||
'("Unit" "Install" "Service")
|
||||
"Configuration sections for systemd 244.")
|
||||
"Configuration sections for systemd 225.")
|
||||
|
||||
(defconst systemd-unit-directives
|
||||
(eval-when-compile
|
||||
@ -95,13 +91,10 @@
|
||||
"Configuration directives for systemd.")
|
||||
|
||||
(defconst systemd-network-sections
|
||||
'("Match" "Link" "NetDev" "VLAN" "MACVLAN" "MACVTAP" "IPVLAN" "IPVTAP" "VXLAN"
|
||||
"GENEVE" "L2TP" "L2TPsession" "MACsec" "FooOverUDP"
|
||||
'("Match" "Link" "NetDev" "VLAN" "MACVLAN" "MACVTAP" "IPVLAN" "VXLAN"
|
||||
"Tunnel" "Peer" "Tun" "Tap" "Bond" "Network" "Address" "Route" "DHCP"
|
||||
"Neighbor" "IPv6AddressLabel" "RoutingPolicyRule" "NextHop" "DHCPv4"
|
||||
"DHCPv6" "IPv6AcceptRA" "DHCPServer" "IPv6Prefix" "CAN"
|
||||
"Bridge" "BridgeFDB" "BridgeVLAN" "VXCAN" "WireGuard" "WireGuardPeer")
|
||||
"Network configuration sections for systemd 244 (not exhaustive).")
|
||||
"Bridge" "BridgeFDB")
|
||||
"Network configuration sections for systemd 225.")
|
||||
|
||||
(defconst systemd-network-directives
|
||||
(eval-when-compile
|
||||
@ -115,7 +108,7 @@
|
||||
|
||||
(defconst systemd-nspawn-sections
|
||||
'("Exec" "Files" "Network")
|
||||
"Namespace container configuration sections for systemd 244.")
|
||||
"Namespace container configuration sections for systemd 232.")
|
||||
|
||||
(defconst systemd-nspawn-directives
|
||||
(eval-when-compile
|
||||
@ -129,25 +122,28 @@
|
||||
|
||||
;;;###autoload
|
||||
(defconst systemd-autoload-regexp
|
||||
(rx (+? (any "a-zA-Z0-9-_.@\\")) "."
|
||||
(or "automount" "busname" "mount" "service" "slice"
|
||||
"socket" "swap" "target" "timer" "link" "netdev" "network")
|
||||
string-end)
|
||||
(eval-when-compile
|
||||
(rx (+? (any "a-zA-Z0-9-_.@\\")) "."
|
||||
(or "automount" "busname" "mount" "service" "slice"
|
||||
"socket" "swap" "target" "timer" "link" "netdev" "network")
|
||||
string-end))
|
||||
"Regexp for file buffers in which to autoload `systemd-mode'.")
|
||||
|
||||
;;;###autoload
|
||||
(defconst systemd-tempfn-autoload-regexp
|
||||
(rx ".#"
|
||||
(or (and (+? (any "a-zA-Z0-9-_.@\\")) "."
|
||||
(or "automount" "busname" "mount" "service" "slice"
|
||||
"socket" "swap" "target" "timer" "link" "netdev" "network"))
|
||||
"override.conf")
|
||||
(= 16 (char hex-digit)) string-end)
|
||||
(eval-when-compile
|
||||
(rx ".#"
|
||||
(or (and (+? (any "a-zA-Z0-9-_.@\\")) "."
|
||||
(or "automount" "busname" "mount" "service" "slice"
|
||||
"socket" "swap" "target" "timer" "link" "netdev" "network"))
|
||||
"override.conf")
|
||||
(= 16 (char hex-digit)) string-end))
|
||||
"Regexp for temp file buffers in which to autoload `systemd-mode'.")
|
||||
|
||||
;;;###autoload
|
||||
(defconst systemd-dropin-autoload-regexp
|
||||
(rx "/systemd/" (+? anything) ".d/" (+? (not (any ?/))) ".conf" string-end)
|
||||
(eval-when-compile
|
||||
(rx "/systemd/" (+? anything) ".d/" (+? (not (any ?/))) ".conf" string-end))
|
||||
"Regexp for dropin config file buffers in which to autoload `systemd-mode'.")
|
||||
|
||||
(defun systemd-get-value (start)
|
||||
@ -208,16 +204,19 @@ file, defaulting to the link under point, if any."
|
||||
|
||||
(defun systemd-buffer-section-p ()
|
||||
"Return t if current line begins with \"[\", otherwise nil."
|
||||
(= (char-after (line-beginning-position)) ?\[))
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(= (following-char) ?\[)))
|
||||
|
||||
(defun systemd-file-network-p (filename)
|
||||
"Return non-nil if FILENAME has a network-type extension, otherwise nil."
|
||||
(string-match-p (rx "." (or "link" "netdev" "network") string-end)
|
||||
(string-match-p (eval-when-compile
|
||||
(rx "." (or "link" "netdev" "network") string-end))
|
||||
filename))
|
||||
|
||||
(defun systemd-file-nspawn-p (filename)
|
||||
"Return non-nil if FILENAME has an nspawn extension, otherwise nil."
|
||||
(string-match-p (rx ".nspawn" string-end) filename))
|
||||
(string-match-p (eval-when-compile (rx ".nspawn" string-end)) filename))
|
||||
|
||||
(defun systemd-completion-table (&rest _ignore)
|
||||
"Return a list of completion candidates."
|
||||
@ -237,7 +236,7 @@ file, defaulting to the link under point, if any."
|
||||
(or (cdr bounds) (point))
|
||||
(completion-table-dynamic #'systemd-completion-table))))
|
||||
|
||||
(defun systemd-company-backend (command &optional arg &rest _ignored)
|
||||
(defun systemd-company-backend (command &optional arg &rest ignored)
|
||||
"Backend for `company-mode' in `systemd-mode' buffers."
|
||||
(interactive (list 'interactive))
|
||||
(pcase command
|
||||
@ -246,130 +245,32 @@ file, defaulting to the link under point, if any."
|
||||
(`candidates (all-completions arg (systemd-completion-table nil)))
|
||||
(`post-completion (if (not (systemd-buffer-section-p)) (insert "=")))))
|
||||
|
||||
(defun systemd-construct-start-p ()
|
||||
"Return non-nil if the current line is the first in a multi-line construct."
|
||||
(let ((flag t))
|
||||
(save-excursion
|
||||
(while (and (zerop (forward-line -1))
|
||||
(eq ?\\ (char-before (line-end-position)))
|
||||
(skip-chars-forward " \t")
|
||||
(setq flag (memq (following-char) '(?# ?\;))))))
|
||||
flag))
|
||||
|
||||
(defun systemd-syntax-propertize (start end)
|
||||
"`systemd-propertize-function' for `systemd-mode' buffers."
|
||||
(let ((case-fold-search nil))
|
||||
(goto-char start)
|
||||
(funcall
|
||||
(syntax-propertize-rules
|
||||
("^[ \t]*\\([;#]\\)$?"
|
||||
(1 (when (systemd-construct-start-p) (string-to-syntax "<")))))
|
||||
start end)))
|
||||
|
||||
(defun systemd-value-extend-region ()
|
||||
"Return the EOL position of the last line of the construct at point."
|
||||
(while (and (= (char-before (line-end-position)) ?\\)
|
||||
(skip-chars-forward " \t")
|
||||
(not (memq (following-char) '(?# ?\;)))
|
||||
(zerop (forward-line))))
|
||||
(line-end-position))
|
||||
|
||||
(defun systemd-font-lock-extend-region ()
|
||||
(goto-char font-lock-beg)
|
||||
(while (and (zerop (forward-line -1))
|
||||
(= (char-before (line-end-position)) ?\\)
|
||||
(skip-chars-forward " \t")
|
||||
(not (memq (following-char) '(?# ?\;)))))
|
||||
(setq font-lock-beg (point-marker))
|
||||
(goto-char font-lock-end)
|
||||
(setq font-lock-end (systemd-value-extend-region)))
|
||||
|
||||
(defmacro define-systemd-matcher (name regexp &optional docstring)
|
||||
"Define a new function NAME that matches REGEXP in a multi-line construct.
|
||||
Only returns matches of REGEXP on lines passing `systemd-construct-start-p'."
|
||||
(declare (debug (symbolp stringp &optional stringp))
|
||||
(indent 2) (doc-string 3))
|
||||
`(defun ,name (limit)
|
||||
,docstring
|
||||
(let (match)
|
||||
(while (and (setq match (re-search-forward ,regexp limit t))
|
||||
(not (systemd-construct-start-p))))
|
||||
match)))
|
||||
|
||||
(define-systemd-matcher systemd-section-matcher
|
||||
"^\\(\\[\\([[:upper:]][[:alnum:]]+\\|X-.*?\\)\\]\\)"
|
||||
"Matcher for section titles.")
|
||||
|
||||
(define-systemd-matcher systemd-key-matcher "^\\([[:upper:]][[:alnum:]]+\\)="
|
||||
"Matcher for keys (unit directives).")
|
||||
|
||||
(defun systemd-exec-prefix-anchored-matcher (limit)
|
||||
"Matcher for the exec prefix in anchored font-lock rule.
|
||||
See `font-lock-keywords' and (info \"(elisp) Search-based Fontification\")."
|
||||
(let ((pos (car (match-data)))
|
||||
(prefixes '(?- ?@ ?+))
|
||||
char end res)
|
||||
(while (and (memq (setq char (following-char)) prefixes)
|
||||
(< (point) limit))
|
||||
(forward-char)
|
||||
(setq prefixes (remq char prefixes))
|
||||
(setq end (point-marker)))
|
||||
(when end
|
||||
(prog1 (setq res (list (1+ pos) end))
|
||||
(set-match-data res)))))
|
||||
|
||||
(defconst systemd-font-lock-keywords-1
|
||||
'((systemd-section-matcher 1 'font-lock-type-face)
|
||||
(systemd-key-matcher 1 'font-lock-keyword-face))
|
||||
"Minimal expressions to highlight in `systemd-mode'.")
|
||||
|
||||
(defconst systemd-font-lock-keywords-2
|
||||
`(,@systemd-font-lock-keywords-1
|
||||
("\\\\$" 0 'font-lock-warning-face) ; line break
|
||||
;; boolean arguments
|
||||
(,(rx "=" (group (or "yes" "true" "on" "0" "no" "false" "off")) eol)
|
||||
1 'font-lock-constant-face)
|
||||
("="
|
||||
;; exec prefixes
|
||||
(systemd-exec-prefix-anchored-matcher
|
||||
nil nil (0 'font-lock-negation-char-face))
|
||||
;; environment variables
|
||||
("\\$[A-Z_]+\\>"
|
||||
(systemd-value-extend-region) nil (0 'font-lock-variable-name-face))
|
||||
;; specifiers
|
||||
("%[abBCEfgGhHiIjJlLmnNopPrRsStTuUvVw%]"
|
||||
(systemd-value-extend-region) nil (0 'font-lock-constant-face))))
|
||||
"Extended expressions to highlight in `systemd-mode'.")
|
||||
|
||||
(defconst systemd-font-lock-keywords-3
|
||||
`(,@systemd-font-lock-keywords-2
|
||||
("^Type=\\(simple\\|forking\\|oneshot\\|dbus\\|notify\\|idle\\)$"
|
||||
1 'font-lock-builtin-face)
|
||||
(,(rx bol "Restart="
|
||||
(group (or "no" "on-success" "on-failure"
|
||||
"on-abnormal" "on-watchdog" "on-abort" "always"))
|
||||
eol)
|
||||
1 'font-lock-builtin-face)
|
||||
("^KillMode=\\(control-group\\|process\\|mixed\\|none\\)$"
|
||||
1 'font-lock-builtin-face)
|
||||
(,(rx bol "KillSignal="
|
||||
(group
|
||||
(or "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGABRT" "SIGFPE" "SIGKILL"
|
||||
"SIGSEGV" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGUSR1" "SIGUSR2"
|
||||
"SIGCHLD" "SIGCONT" "SIGSTOP" "SIGTSTP" "SIGTTIN" "SIGTTOU"))
|
||||
eol)
|
||||
1 'font-lock-constant-face))
|
||||
"Flamboyant expressions to highlight in `systemd-mode'.")
|
||||
|
||||
(defvar systemd-font-lock-keywords 'systemd-font-lock-keywords-2
|
||||
(defvar systemd-font-lock-keywords
|
||||
(eval-when-compile
|
||||
`(("^[[:space:]]*?\\([#;]\\)\\(.*\\)$"
|
||||
(1 'font-lock-comment-delimiter-face)
|
||||
(2 'font-lock-comment-face))
|
||||
("\\\\$" 0 'font-lock-warning-face) ; line break
|
||||
;; sections
|
||||
("^\\(\\[\\([[:upper:]][[:alnum:]]+\\|X-.*?\\)\\]\\)"
|
||||
1 'font-lock-type-face)
|
||||
;; keys
|
||||
("^\\([[:upper:]][[:alnum:]]+\\)="
|
||||
1 'font-lock-keyword-face)
|
||||
;; boolean arguments
|
||||
(,(rx "=" (group (or "yes" "true" "on" "0" "no" "false" "off")) eol)
|
||||
1 'font-lock-constant-face)
|
||||
;; specifiers
|
||||
("%[nNpPiIfcrRtuUhsmbHv%]" 0 'font-lock-constant-face)
|
||||
;; exec prefixes
|
||||
;; TODO account for @ being a prefix now
|
||||
("=\\(-@\\|@-\\|[@-]\\)" 1 'font-lock-negation-char-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 ?$ "'" table)
|
||||
(modify-syntax-entry ?\; "." table)
|
||||
(modify-syntax-entry ?\% "\\" table)
|
||||
table)
|
||||
"Syntax table used in `systemd-mode' buffers.")
|
||||
|
||||
@ -396,7 +297,7 @@ See systemd.unit(5) for details on unit file syntax.")
|
||||
;;;###autoload
|
||||
(define-derived-mode systemd-mode conf-mode "Systemd"
|
||||
"Major mode for editing systemd unit files.
|
||||
See https://www.freedesktop.org/wiki/Software/systemd/ for more
|
||||
See http://www.freedesktop.org/wiki/Software/systemd/ for more
|
||||
information about systemd.
|
||||
|
||||
In addition to any hooks its parent mode might have run, this
|
||||
@ -406,16 +307,9 @@ Key bindings:
|
||||
\\{systemd-mode-map}"
|
||||
(set-keymap-parent systemd-mode-map nil)
|
||||
(conf-mode-initialize systemd-comment-start)
|
||||
(setq-local auto-fill-inhibit-regexp "^[ \t]*?[^;#]")
|
||||
(add-hook 'company-backends #'systemd-company-backend)
|
||||
(add-hook 'completion-at-point-functions #'systemd-complete-at-point nil t)
|
||||
(add-hook 'font-lock-extend-region-functions
|
||||
'systemd-font-lock-extend-region nil t)
|
||||
(setq-local syntax-propertize-function #'systemd-syntax-propertize)
|
||||
(setq font-lock-defaults
|
||||
'((systemd-font-lock-keywords
|
||||
systemd-font-lock-keywords-1
|
||||
systemd-font-lock-keywords-2
|
||||
systemd-font-lock-keywords-3))))
|
||||
(setq font-lock-defaults '(systemd-font-lock-keywords t)))
|
||||
|
||||
(provide 'systemd)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
;;; systemd-tests.el --- Tests for systemd.el -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2016-2020 Mark Oteiza <mvoteiza@udel.edu>
|
||||
;; Copyright (C) 2016-2017 Mark Oteiza <mvoteiza@udel.edu>
|
||||
|
||||
;; Author: Mark Oteiza <mvoteiza@udel.edu>
|
||||
|
||||
@ -83,3 +83,4 @@ only if in an appropriately named parent directory."
|
||||
(provide 'systemd-tests)
|
||||
|
||||
;;; systemd-tests.el ends here
|
||||
|
||||
@ -3,23 +3,18 @@ AccuracySec
|
||||
After
|
||||
Alias
|
||||
AllowIsolate
|
||||
AllowedCPUs
|
||||
AllowedMemoryNodes
|
||||
Also
|
||||
AmbientCapabilities
|
||||
AppArmorProfile
|
||||
AssertACPower
|
||||
AssertArchitecture
|
||||
AssertCapability
|
||||
AssertControlGroupController
|
||||
AssertDirectoryNotEmpty
|
||||
AssertFileIsExecutable
|
||||
AssertFileNotEmpty
|
||||
AssertFirstBoot
|
||||
AssertGroup
|
||||
AssertHost
|
||||
AssertKernelCommandLine
|
||||
AssertKernelVersion
|
||||
AssertNeedsUpdate
|
||||
AssertPathExists
|
||||
AssertPathExistsGlob
|
||||
@ -28,13 +23,10 @@ AssertPathIsMountPoint
|
||||
AssertPathIsReadWrite
|
||||
AssertPathIsSymbolicLink
|
||||
AssertSecurity
|
||||
AssertUser
|
||||
AssertVirtualization
|
||||
Backlog
|
||||
Before
|
||||
BindIPv6Only
|
||||
BindPaths
|
||||
BindReadOnlyPaths
|
||||
BindToDevice
|
||||
BindsTo
|
||||
BlockIOAccounting
|
||||
@ -47,30 +39,21 @@ BusName
|
||||
CPUAccounting
|
||||
CPUAffinity
|
||||
CPUQuota
|
||||
CPUQuotaPeriodSec
|
||||
CPUSchedulingPolicy
|
||||
CPUSchedulingPriority
|
||||
CPUSchedulingResetOnFork
|
||||
CPUShares
|
||||
CPUWeight
|
||||
CacheDirectory
|
||||
CacheDirectoryMode
|
||||
CapabilityBoundingSet
|
||||
CollectMode
|
||||
ConditionACPower
|
||||
ConditionArchitecture
|
||||
ConditionCPUs
|
||||
ConditionCapability
|
||||
ConditionControlGroupController
|
||||
ConditionDirectoryNotEmpty
|
||||
ConditionFileIsExecutable
|
||||
ConditionFileNotEmpty
|
||||
ConditionFirstBoot
|
||||
ConditionGroup
|
||||
ConditionHost
|
||||
ConditionKernelCommandLine
|
||||
ConditionKernelVersion
|
||||
ConditionMemory
|
||||
ConditionNeedsUpdate
|
||||
ConditionPathExists
|
||||
ConditionPathExistsGlob
|
||||
@ -79,10 +62,7 @@ ConditionPathIsMountPoint
|
||||
ConditionPathIsReadWrite
|
||||
ConditionPathIsSymbolicLink
|
||||
ConditionSecurity
|
||||
ConditionUser
|
||||
ConditionVirtualization
|
||||
ConfigurationDirectory
|
||||
ConfigurationDirectoryMode
|
||||
Conflicts
|
||||
DefaultDependencies
|
||||
DefaultInstance
|
||||
@ -93,12 +73,10 @@ DeviceAllow
|
||||
DevicePolicy
|
||||
DirectoryMode
|
||||
DirectoryNotEmpty
|
||||
DisableControllers
|
||||
Documentation
|
||||
DynamicUser
|
||||
Environment
|
||||
EnvironmentFile
|
||||
ExecCondition
|
||||
ExecReload
|
||||
ExecStart
|
||||
ExecStartPost
|
||||
@ -107,16 +85,13 @@ ExecStop
|
||||
ExecStopPost
|
||||
ExecStopPre
|
||||
FailureAction
|
||||
FailureActionExitStatus
|
||||
FileDescriptorName
|
||||
FileDescriptorStoreMax
|
||||
FinalKillSignal
|
||||
ForceUnmount
|
||||
FreeBind
|
||||
Group
|
||||
GuessMainPID
|
||||
IOAccounting
|
||||
IODeviceLatencyTargetSec
|
||||
IODeviceWeight
|
||||
IOReadBandwidthMax
|
||||
IOReadIOPSMax
|
||||
@ -125,17 +100,11 @@ IOSchedulingPriority
|
||||
IOWeight
|
||||
IOWriteBandwidthMax
|
||||
IOWriteIOPSMax
|
||||
IPAccounting
|
||||
IPAddressAllow
|
||||
IPAddressDeny
|
||||
IPEgressFilterPath
|
||||
IPIngressFilterPath
|
||||
IPTOS
|
||||
IPTTL
|
||||
IgnoreOnIsolate
|
||||
IgnoreSIGPIPE
|
||||
InaccessiblePaths
|
||||
JobRunningTimeoutSec
|
||||
JobTimeoutAction
|
||||
JobTimeoutRebootArgument
|
||||
JobTimeoutSec
|
||||
@ -144,7 +113,6 @@ KeepAlive
|
||||
KeepAliveIntervalSec
|
||||
KeepAliveProbes
|
||||
KeepAliveTimeSec
|
||||
KeyringMode
|
||||
KillMode
|
||||
KillSignal
|
||||
LazyUnmount
|
||||
@ -172,13 +140,6 @@ ListenSequentialPacket
|
||||
ListenSpecial
|
||||
ListenStream
|
||||
ListenUSBFunction
|
||||
LockPersonality
|
||||
LogExtraFields
|
||||
LogLevelMax
|
||||
LogRateLimitBurst
|
||||
LogRateLimitIntervalSec
|
||||
LogsDirectory
|
||||
LogsDirectoryMode
|
||||
MakeDirectory
|
||||
Mark
|
||||
MaxConnections
|
||||
@ -189,30 +150,22 @@ MemoryHigh
|
||||
MemoryLimit
|
||||
MemoryLow
|
||||
MemoryMax
|
||||
MemoryMin
|
||||
MemorySwapMax
|
||||
MessageQueueMaxMessages
|
||||
MessageQueueMessageSize
|
||||
MountAPIVFS
|
||||
MountFlags
|
||||
NUMAMask
|
||||
NUMAPolicy
|
||||
NetworkNamespacePath
|
||||
Nice
|
||||
NoDelay
|
||||
NoNewPrivileges
|
||||
NonBlocking
|
||||
NotifyAccess
|
||||
OOMPolicy
|
||||
OOMScoreAdjust
|
||||
OnActiveSec
|
||||
OnBootSec
|
||||
OnCalendar
|
||||
OnClockChange
|
||||
OnFailure
|
||||
OnFailureJobMode
|
||||
OnStartupSec
|
||||
OnTimezoneChange
|
||||
OnUnitActiveSec
|
||||
OnUnitInactiveSec
|
||||
Options
|
||||
@ -226,20 +179,18 @@ PathChanged
|
||||
PathExists
|
||||
PathExistsGlob
|
||||
PathModified
|
||||
PermissionsStartOnly
|
||||
Persistent
|
||||
Personality
|
||||
PipeSize
|
||||
Priority
|
||||
PrivateDevices
|
||||
PrivateMounts
|
||||
PrivateNetwork
|
||||
PrivateTmp
|
||||
PrivateUsers
|
||||
PropagatesReloadTo
|
||||
ProtectControlGroups
|
||||
ProtectHome
|
||||
ProtectHostname
|
||||
ProtectKernelLogs
|
||||
ProtectKernelModules
|
||||
ProtectKernelTunables
|
||||
ProtectSystem
|
||||
@ -261,20 +212,15 @@ RequiresMountsFor
|
||||
Requisite
|
||||
Restart
|
||||
RestartForceExitStatus
|
||||
RestartKillSignal
|
||||
RestartPreventExitStatus
|
||||
RestartSec
|
||||
RestrictAddressFamilies
|
||||
RestrictNamespaces
|
||||
RestrictRealtime
|
||||
RestrictSUIDSGID
|
||||
ReusePort
|
||||
RootDirectory
|
||||
RootDirectoryStartOnly
|
||||
RootImage
|
||||
RuntimeDirectory
|
||||
RuntimeDirectoryMode
|
||||
RuntimeDirectoryPreserve
|
||||
RuntimeMaxSec
|
||||
SELinuxContext
|
||||
SELinuxContextFromNet
|
||||
@ -297,8 +243,6 @@ Sockets
|
||||
SourcePath
|
||||
StandardError
|
||||
StandardInput
|
||||
StandardInputData
|
||||
StandardInputText
|
||||
StandardOutput
|
||||
StartLimitAction
|
||||
StartLimitBurst
|
||||
@ -307,11 +251,7 @@ StartupBlockIOWeight
|
||||
StartupCPUShares
|
||||
StartupCPUWeight
|
||||
StartupIOWeight
|
||||
StateDirectory
|
||||
StateDirectoryMode
|
||||
StopWhenUnneeded
|
||||
SuccessAction
|
||||
SuccessActionExitStatus
|
||||
SuccessExitStatus
|
||||
SupplementaryGroups
|
||||
Symlinks
|
||||
@ -329,9 +269,6 @@ TTYVHangup
|
||||
TTYVTDisallocate
|
||||
TasksAccounting
|
||||
TasksMax
|
||||
TemporaryFileSystem
|
||||
TimeoutAbortSec
|
||||
TimeoutCleanSec
|
||||
TimeoutIdleSec
|
||||
TimeoutSec
|
||||
TimeoutStartSec
|
||||
@ -345,7 +282,6 @@ UMask
|
||||
USBFunctionDescriptors
|
||||
USBFunctionStrings
|
||||
Unit
|
||||
UnsetEnvironment
|
||||
User
|
||||
UtmpIdentifier
|
||||
UtmpMode
|
||||
@ -353,7 +289,6 @@ WakeSystem
|
||||
WantedBy
|
||||
Wants
|
||||
WatchdogSec
|
||||
WatchdogSignal
|
||||
What
|
||||
Where
|
||||
WorkingDirectory
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user