Subject: bug#36759: 26.1; nftables major mode

From: "Trent W. Buck" <[email-masked]>
Date: Mon, 12 Aug 2019 11:16:34 +1000

Eli Zaretskii wrote:
>> nftables is a Linux kernel firewall.
>> I couldn't find a major mode for this, so I wrote a basic one.
>> Could someone else adopt it into mainline Emacs?
>
> Would it be possible to rewrite this mode using define-generic-mode?
> See generic-x.el for some example of using that macro.

I didn't know about define-generic-mode!

(My elisp-fu is Giraffe Book vintage, and I've been using
e.g. conf-mode instead of ini-generic-mode, and third-party
apache-mode instead of apache-conf-generic-mode.)

I can have a go, but I don't know when I'll get around to it.

At a glance, I don't see how to handle code blocks (syntax-entry for ?{ and ?}) and continuation lines in there.
In fact, I don't see ANY indent function handling in generic.el or generic-x.el?

I'm also concerned that keyword-list there will do the Wrong Thing.
For example, in this standard example document,
the second and third "filter" are keywords, but
the first "filter" is a variable.

    table inet filter {
        chain input {
            type filter hook input priority filter; default accept;
            iiftype loopback counter accept
        }
    }

That can also be written like this (the "add" and "rule" are optional).

    add table inet filter
    add chain inet filter chain input { type filter hook input priority filter; default accept; }
    add rule inet filter iiftype loopback counter accept

It's because of this reuse of keywords as variables that I wrote more
than just keyword highlighting -- I *need* the "filter"s to be colored
differently, or I can't cope.

PS: In the example above, "input" also a variable AND a keyword.