Subject: bug#50674: Major mode for etc/AUTHORS with basic font-locking

From: Juri Linkov <[email-masked]>
Date: Mon, 20 Sep 2021 18:24:32 +0300

> Thinking about this a bit more, what is the problem with just keeping
> this in its own file?  It is fairly self-contained and not really
> related to anything else.  If the worry is that it will clutter
> lisp/textmodes, perhaps we could add a new directory where such
> "small" modes could go.

It really will clutter lisp/textmodes.  For the same reasoning
all modes in generic-x.el should be moved to separate files
that makes no sense.

So the current situation is following: we have generic-x.el for such
small modes like etc-passwd-generic-mode and etc-authors-mode.
But the problem is that modes in generic-x.el are not autoloaded.
I don't understand why visiting /etc/passwd doesn't highlight it
properly when etc-passwd-generic-mode is available for this file?
But I see no problem to autoload all available modes from generic-x.el.

> A natural first step would be to make those modes load unconditionally,
> but that proposal has been rejected; see my last two commits to
> generic-x.el.  Perhaps it will be okay to load only some of the modes
> unconditionally.

I agree that only some should be loaded unconditionally.  For example,
we should not use modes for filename regexps that are not specific,
such as '("alias\\'") and '("inventory\\'") that has too wide coverage
to produce false matches.  OTOH, autoloaded modes should be enabled
by default for "/etc/passwd", "/etc/fstab", "emacs.*/etc/AUTHORS\\'"
that has no problem of mismatching.