The systemd.unit(5) manpage sorts unit file specifiers alphabetically
since commit systemd/systemd@709f4c472c, and since the order in this
regular expression is even less relevant than in the manpage, let’s just
do the same to make it easy to compare the letter sets between the two.
between font-lock-keywords, the elisp manual, examples in the emacs
source (sh-mode is one) and the webernets, it is rather difficult to
find a way to properly deal with multi-line construct syntax
highlighting. this is a way leveraging anchored matching and
jit-lock.
more importantly, bind systemd-font-lock-keywords to a _symbol_.
this makes hacking font-lock-keywords on the fly a little easier, in
addition to adding to customization/granularity
(info "(elisp) Font Lock Basics")
The new regex is not too hard to generate with some set/combinatorics
fun, but perhaps going about this a different way would be better
(let ((s (delq nil (powerset '("@" "-" "+")))))
(concat "="
(regexp-opt
(mapcar (lambda (ls) (apply #'concat ls))
(apply #'append (mapcar #'permutations s)))
"\\(?1:")))
many thanks to @Lompik
* don't match empty unit names. AIUI unit names are alphanumeric with
the exception of the group [-_.@], non ascii are backslash-escaped.
* more strictly match temp file names: .# prefix, [[:hexdigit:]]{16}
suffix. the filenames are a unit name with a unit suffix (systemctl
edit --full) or just override.conf (edit without --full option)
* add regex for dropin config files. This is just a file with ".conf"
extension, with the added constraint that it's a file having some
parent directory named "systemd"
hopefully didn't break everything \o/
* eventual goal is to have the large lists generated at byte compile
time from the text files now present in the repo. updating the lists
in lisp is very annoying
* capf completion now exists and draws from the same infrastructure
* added capability to add a "=" after company completion of a directive
* systemd-use-company-p still works, but does not need to exist