> Could you add a preferences directive to specify that all file types
> (.html, .java, .php, etc) should be edited in a specific mode,
> regardless of the extension?
> In other words, if PHP were specified in this directive, any files would
> be edited in PHP mode by default, regardless of its extension.
> Logically, this could still be overridden by changing the mode within J.
> A site I'm working on uses HTML files that are largely PHP-based; this
> would save me from having to change the mode to PHP every time a
> different file is opened.
As things stand now, you could add a line like this to ~/.j/prefs (or
PHPMode.files = ".+\\.php?|.+\\.html?|.+\\.java"
That would let PHP mode pick up .java and .htm[l] files too.
I just tested this and it does work, but there's one more thing to
When you open a file, j iterates through the various modes looking for
one that will handle the extension of the file in question, and the
iteration stops as soon as a willing mode is found.
In the current implementation, the iteration happens to go through the
modes in reverse alphabetical order, so PHP mode will be tested before
HTML mode or Java mode, and therefore PHP mode will get first crack at
the file, but this is just a quirk of the current implementation and
it conceivably might change.
So for robustness you might also want to add a couple more lines to
prevent Java and/or HTML mode from getting to the file first:
JavaMode.files = ".+\\.xxx"
HtmlMode.files = ".+\\.xxx"
That's assuming, of course, that you don't plan to edit any files with
the extension ".xxx"... ;)
Is this good enough?