|
From: Randy K. <rhk...@gm...> - 2008-08-31 08:15:57
|
Background: I am slowly developing (mashing up?) an "application" for which I
need an editor capable of doing folding in some possibly complex ways. I
still have hopes of someday adding "real" folding to nedit, or that kate will
fix the problems that make it unsuitable for use, but I came across jedit
about a week ago, and it is not as bad as I expected (for something that
requires Java to run) ;-) (The 200 MB VIRT image (of Java) is about what I
expected based on previous encounters with Java based applications--I suppose
that when I upgrade my computer to 1.5 MB (within the next year or so), it
won't be an issue.)
I've done some googling and reading, and I've found the
ConfigurableFoldHandler plugin, tried to understand the documentation, and I
don't think it will do what I want--iiuc, it will allow me to replace the
{{{ and }}} with some other markup (or even any of several markups), but that
markup will not define the level of the fold--see below.
(I don't think I can install it either, because I'm running jedit version 4.2
final, and the two versions of the ConfigurableFoldHandler that I've found
apparently work for versions before 4.2 final or after, but not for 4.2. See
________.)
In my application, there is a "simple" level of complex folding, and then a
more complex level, I'll discuss the simple level here, and save the more
complex things for later.
In the simple version, there are 7 folding levels. The top level is basically
based on (or is) an mbox file format--the folding "mark" is the mbox "From
header", something like this:
From "A Topic Name" Fri Aug 29 18:59:55 EDT 2008
Date: Aug 29, 2008, 6:59 PM
Subject: A Topic Name
Because of some bugs in Kate (that they might or might not be working on),
I've had to add ending markup for each folding level, so, in the case of the
top level, I use:
morF
... as the terminating markup.
The next six folding levels are based on TWiki markup for headings. The
markup is like this:
---+ Level 1 heading (corresponding to H1 in HTML)
---++ Level 2 heading (corresponding to H2 in HTML)
---+++ Level 3 heading (corresponding to H3 in HTML)
---++++ Level 4 heading (corresponding to H4 in HTML)
---+++++ Level 5 heading (corresponding to H5 in HTML)
---++++++ Level 6 heading (corresponding to H6 in HTML)
Because of some of those bugs in Kate, I've had to add terminating markup for
each folding level, and am currently using markup like +--- through
++++++---. However, I *absolutely* do not want to use such terminating
markup, and that is the one of the big driving forces causing me to look for
something other than Kate.
A simplified example (simple record with 3 heading levels):
(The "| " is intended to show the start of a line within the document. To
keep the example simple, I'm also ignoring the folds started and ended by the
From / morF construct, and not counting that in my numbering of folding
levels.)
(Use a monospaced font for best viewing of the following.)
Fold Document
Level Content
0 (none) | no recognized heading markup
| optional text
1 | ---+ A L1 Heading
| optional text
2 (note a) | ---++ A L2 Heading
| optional text
3 (note b) | ---+++ A L3 Heading
| optional text
3 (note c) | ---+++ Another L3 Heading
| optional text
1 (note d) | ---+ Another L1 Heading
| optional text
0 (none) | no recognized heading markup
| optional text
As you can see, a section at a given folding level should end when a new
heading at the same or a higher level starts--or with more explanation:
Note:
a. ---+ signifies the start of a new fold at Level 2, it does not end the
Level 1 fold
b. ---++ signifies the start of a new fold at Level 3, it does not end the
Level 2 nor the Level 1 fold
c. ---++ ends the last open fold at Level 3 and signifies the start of a new
fold at Level 3
d. ---+ ends the last open fold at Level 3 and ends the open fold at Level 2
(because, as the start of a new Level 1 fold, it ends all open folds at Level
1 or lower), and finally, it signifies the start of a new Level 1 fold.
More complex levels of folding (I'm not asking about these now, just reminding
myself that eventually I also want to deal with these--the first should be
easy, the second more complex):
* Step 1: the From... morF record separator and folding level mentioned
above
* Step 2: Allowing folds within any section, like for constructs like
numbered or bulleted lists (of varying levels), tables, etc., or even
snippets (or more) of programming code, folded as you might expect for the
respective programming language
My questions are:
* Can jedit deal (or be fairly easily modified to deal) with a folding
scheme as described (the simplified version)?
* What kind of changes will it take? I assume that it will require
changes in the Java code of jedit rather than some simple configuration
changes (but it would be nice to be wrong ;-)
* Is there one module / subprogram of the jedit code where all (or most) of
the changes might be localized? (My background is in procedural languages,
not including C (e.g., Algol, Fortran, PL/1, Pascal, ..., so I'm not sure of
the proper terminology in Java--wait--I guess I'm looking for the class or
object to which the changes might be localized?)
* Has anyone already done something like this in jedit (or started on it)?
Randy Kramer
--
"I didn't have time to write a short letter, so I created a video
instead."--with apologies to Cicero, et.al.
|