I’ve just realised Consfigurator 1.3.0, with some readtable enhancements. So now instead of writing
(firewalld:has-policy "athenet-allow-fwd"
#>EOF><?xml version="1.0" encoding="utf-8"?>
<policy priority="-40" target="ACCEPT">
<ingress-zone name="trusted"/>
<egress-zone name="internal"/>
</policy>
EOF)
you can write
(firewalld:has-policy "athenet-allow-fwd" #>>~EOF>>
<?xml version="1.0" encoding="utf-8"?>
<policy priority="-40" target="ACCEPT">
<ingress-zone name="trusted"/>
<egress-zone name="internal"/>
</policy>
EOF)
which is a lot more readable when it appears in a list of other properties. In addition, instead of writing
(multiple-value-bind (match groups)
(re:scan-to-strings "^uid=(\\d+)" (connection-connattr connection 'id))
(and match (parse-integer (elt groups 0))))
you can write just (#1~/^uid=(\d+)/p (connection-connattr connection 'id))
.
On top of the Perl-inspired syntax, I’ve invented the new trailing option p
to attempt to parse matches as numbers.
Another respect in which Consfigurator’s readtable has become much more useful
in this release is that I’ve finally taught Emacs about these reader macros,
such that unmatched literal parentheses within regexps or heredocs don’t cause
Emacs (and especially Paredit) to think that the code couldn’t be valid Lisp.
Although I was able mostly to reuse propertising algorithms from the built-in
perl-mode
, I did have to learn a lot more about how parse-partial-sexp
really works, which was pretty cool.