On Jan 10, 11:16 am, Gil Shwartz <[email protected]> wrote:
> This is a long post for a simple solution, but I prefer to provide a
> good background.

Many thanks for these thoughtful remarks.  I would like to resolve
this issue before Leo 4.7 b2.

> Problem Definition:

I agree.

> Failed or Discouraged Approaches:

I agree.

> I did a simple experiment and edited the file php.py in modes to have
> php_main map to rulesDict4. The idea is to make the colorizer behave
> as if it has already found an opening tag and should now color
> according to the proper PHP coloring rules. This proved successful and
> effective. Given the problem definition, it becomes very logical.

Good work.

> However, this is not THE desired solution because the files in modes
> are automatically generated from jEdit's XML files and hand editing
> them is undesired.

Actually, it is ok with me to do this, or something very like it.  The
jEdit .xml files were the starting point, and they saved work in the
early days when I was revising the jEdit2py script regularly.
However, I haven't touched this script in years, and am unlikely to do
so ever again.  Indeed, all recent work has consisted of changes (aka
hacks) to the colorizer in qtGui.py. Thus, I would not rule out
changing any particular .py file in leo/modes.  If we do that, we
would probably want to disable the corresponding .xml file by moving
it to a subfolder, say disabled-modes.

> Proposed Solution:
> nameToRulesetName() is the function that assumes that the starting
> coloring rule is <language>_main. I suggest making this user
> customizable in leoSettings,

Ville has convinced me that some user options are to be avoided, and
I'm pretty sure this is one of them :-)

At present, only php suffers this problem, so there is no need to try
for a general solution.  The situation for xml is quite different.
There, we *do* want a setting, because only the user knows which xml
tags should generate subtrees.

> I could have "php":"php_php" and the php_php rulesDict shall be the starting 
> rulesDict for PHP.

This solves the problem. Our task is simply to package your solution.

If we wanted to make the change in the modes/.xml files, we could add
support in jEdit2py for a new property in the <props> element.
However, this would require a change to jEdit2py, and I am feeling
lazy at the moment :-)

I would rather just add a special case for php to nameToRulesetName.
This looks like the simplest thing that could possibly work, and it
will likely be all that will ever be needed.  I'll do it today, unless
I hear a compelling argument why this is a bad idea.

Edward
-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.


Reply via email to