Since I currently have to work on code in multiple languages stored
in files without extensions I've been annoyed by them not being styled
by default so am looking at adding some detection of language from the
initial #! line that is favoured by Unix users. This would work only
when there was no extension, and would use the same override mechanism
used by the Language menu. The plan is after the file is opened:

if first line starts with "#!":
    for each word in line:
        if properties["shbang." + word]:
            use that property value as the override file extension

    So with properties:

shbang.python=py
shbang.ruby=rb

   Then files that start with, for example "#!/usr/bin/env python" or
"#!/usr/bin/ruby" would be treated as Python or Ruby respectively.
This is open to some confusion if any languages are called usr, bin,
env, or similar. The precedence is arguable with the possibility of
files with known extensions overridden by #! but this seems safest.
The "shbang." properties can be placed in each .properties file so
there is no need for a central property collecting them together as
there is for menu.language. The name "shbang" is a little too cute.
Since this occurs after reading some of the file contents, it will
result in processing the properties twice.

   Neil

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to