[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] syntax of a Modewhen file
In message <fec92bd856.jim@xxxxxxxxxxxxxxxx>
Jim Nagel <stred@xxxxxxxxxxxxxxxx> wrote:
> I'd like to get the Obey mode to recognize a Convtext scriptfile, and
> presume I need to change Userprefs.Modes.Obey.Modewhen accordingly.
>
> Convtext files are plain text (&fff) but they always begin with these
> seven characters: SCRIPT:nameofscript
>
> How would I add a line to make it respond to a Convtext file? I read
> StrongEd's help (partic the "Rules Include" section) but am confused.
What is it that confuses you?
Feedback could help to improve the instructions.
> Alternatively, I could set up a new mode for Convtext, but I would
> still need to know the syntax for its Modewhen.
> I gather that StrongEd has a way of "sniffing" the beginning of a file
> when filetype by itself isn't enough, but I can't get it to work.
Creating a new mode for ConvText is probably the better choice (see
below).
To load a file into ConvText mode based on its contents requires a '>'
rule. This tells StrongED the check the file's contents after it has
been loaded.
A '>' rule consists of 3 parts: filetype, path ; match pattern
ConvText are text files and may be located anywhere so filetype is:
'fff' and path is: '**' (meaning: accept all paths).
The match pattern is the name of a search expression defined in the
Match section of the ModeWhen file. The expression is set to simple
match "SCRIPT" at the start of a file and is case-sensitive.
Rules Include
> fff, ** ; _convtext
End
Match
_convtext "SCRIPT"
End
> The thing in common with Obey files is the use of "|" to mark a
> comment, which alone would make the Obey mode useful for Convtext.
This is only partially the case. Obey mode recognises "|" as a comment
marker only when it's the first character on a line. ConvText allows "|"
anywhere on a line.
A separate mode for ConvText would get around this problem. It would
also allow syntax colouring for the built-in commands and the ":".
> In my putative Convtext mode, it'd be nice to make Convtext's special
> use of ":" stand out more clearly, perhaps displaying wider as " : "
> with a green background.
Using different colours is not a problem but displaying as " : " is not
possible (that would require changes to StrongED itself).
> (Convtext uses colon to mean change the preceding text to the
> following text. It applies only to the first colon on a line; any
> subsequent colon on that line is literal.)
Note that StrongED won't be able to make that distinction, a colon is a
colon no matter where it occurs.
Cheers,
Fred.
--
StrongED Developer
http://www.stronged.iconbar.com/
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://diy.Torrens.org/RO/StrongED/index.html