Rob McMullen wrote:
The upshot is that the code needs to be imported to check to see if a
file works with a major mode.
Perhaps there could be a two-stage importing -- one small plugin
that's always imported and contains the logic to determine if a file
is editable with the major mode, and the other larger plugin that
contains the bulk of the code.
In emacs (Gnu, at least), there are three basic schemes for doing this:
* auto-mode-alist, which is a list of pairs of regular expressions
and modes, and applies each regex to the file name until it gets a
match;
* magic-mode-alist, which is a similar list, except the regex is
applied to the beginning bytes of the file (a function can be used
in place of the regex to do the matching);
* interpreter-mode-alist, which is used with files that begin
"#!{interpreter file path}".
Pretty simple, really, but it works reasonably well, and it might spark
some ideas.
--
Don Dwiggins
Advanced Publishing Technology