
			      JEd V2.01
		    Yet another programmer's editor.
		     Copyright (c) 1992 John Harper


my address:
    John Harper,
    91 Springdale Road,
    Broadstone,
    Dorset BH18 9BW,
    ENGLAND.

note:
    If you write to me you may have to wait a long time for an answer, after
    the start of October I'll be at university.


INTRODUCTION.
=============

JEd is a text editor best suited to programming, it has no text formatting
capabilities (except for a dumb wordwrap). I wrote it because I found that
no available editor suited me perfectly - this one does (maybe). You may
have seen my previous attempt at this goal, JEd 1.something, 2.0 is similar
in some respects but completely different in others.

a quick feature list,
    totally customizable
    powerful programming language
    multi-file/multi-view editing
    number of windows is only limited by memory
    clipboard support (cut/paste on any unit)
    any window can have any (non-proportional) font
    fast enough

JEd needs system 2.0 or later.


DISCLAIMER.
===========

THIS PROGRAM IS PROVIDED ON AN `AS IS' BASIS, NO WARRANTIES ARE MADE, EITHER
EXPRESSED OR IMPLIED. IN NO EVENT WILL I, JOHN HARPER, BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING FROM ANY USE
OR MISUSE OF THESE PROGRAMS. THE ENTIRE RISK AS TO THE RESULTS AND
PERFORMANCE OF THIS PROGRAM IS ASSUMED BY YOU.


DISTRIBUTION.
=============

Distribute these files as much as you want, from now on and until further
notice they are classed as freeware and may not be sold for more than a
nominal fee to cover disks, etc.

I certainly won't refuse any donations sent to me but there is no
obligation.

If you want the latest version send me a disk and return postage and you'll
get it. If you just send a disk you probably won't see it again (I'm only a
poor student you know :-)


INSTALLATION.
=============

Copy the executables, jed and makerefs, to somewhere in your path.
Create a directory s:jed and copy the contents of the macros directory into
it.

These system libraries are needed in libs:
    asl.library
    diskfont.library
    iffparse.library

The clipboard.device is usually needed in devs:
If you want to use the ARexx interface ARexx should be running.

Note:
    If you want to increase the editor's scrolling speed make sure that the
    commodities.library hasn't installed it's input handler. As long as no
    program has the library open it should be OK, ie, don't have any
    commodities installed, use DMouse or something similar instead. If you
    don't believe me try scrolling through a file with no cx, then 'run
    exchange' and try it again. I think that you only need to do this if
    you have a 68000 cpu, it certainly works on my Amiga.


STARTUP.
========

JEd can be run from the CLI or the Workbench, when run from the CLI any
filenames specified in the command line are loaded (names can be surrounded
by double quotes ("") if the name contains spaces), NO files are loaded when
run from the Workbench.

The first window's preferences are loaded from the file s:jed.config, this
file can be written by the (saveprefs) command.

After loading any files specified by the command line the script file
jed-startup is executed, this can contain any normal JEd command strings, it
is looked for first in the current directory and then (only if not already
found) in the s:jed/ directory and then the s: directory.
This file is normally used to create keybindings, macros, maybe load a menu
if you want, etc...

If you don't supply a startup file the editor will be totally unusable (but
you can quit :-) since initially all keys (except the cursor keys) just
insert the characters that they are mapped to by the system keymap.


COMMAND INTERPRETER.
====================

Although it is possible to use JEd without understanding its script language
*much* more power can be got with a full understanding. That is what this
chapter tries to give.

There are only two data types to deal with, these are strings and 32 bit
signed integers (henceforth referred to as numbers). The language heavily
enforces data typing in that it is (almost) impossible to pass a number when
a string is needed, if you do manage to do this (maybe when formatting a
string) you could well pay a visit to the guru's replacement.

Variables, on the other hand, have less typing, they assume the type of
whatever is assigned to them.

A value is a piece of data, either a string or a number.

Each command is constructed from clauses, each clause has a value, these are
all possible clause types,

    (variable)                  The value of this clause is the value of
				of whatever is in the variable, example, if
				you have a variable called "var" to get its
				value you would type (var).
				At the moment nasty things will happen if
				you try to pass arguments to a variable.

    (command arg-clauses)       The syntax of this is similar to the above
				variable - this is because commands and
				variables are considered to be (almost) the
				same by the interpreter.

				The value of this type of clause is the
				return value from the command.

				The arg clauses are the arguments you wish
				to pass to the command, they are the same as
				any other clause and their _value_ is passed
				to the command after being interpreted.
				This means that you can very easily pass the
				result of one command as an argument to
				another, eg, to increment a variable "num"

					(= `num' (+ (num) 1))

				What this does is add 1 to num and the value
				of that calculation is given to the outer
				command which sets the value of num to the
				result of the addition.

    `string'                    The value of this clause is the string
    {string}                    enclosed by the quotes (or braces). The
				quotes (or braces) nest so if you gave a
				clause,
				    `an example `of nested strings'!'
				you would get a value of,
				    an example `of nested strings'!

				At present quotes and braces are considered
				equivalent so you can't surround one by the
				other (This may change soon).
				The braces are provided for two reasons,
				1) So that the quotes don't get screwed up
				   by ARexx.
				2) If you use braces to enclose command
				   strings everything is much easier to read
				   in complex statements (macros, loops, etc)

				INPORTANT: unlike similar languages (LISP, 
				the Wack script language, etc) all clauses
				are evaluated -- this means that when you
				give a command string as an argument to a
				command (eg, macro, while, etc) it must be
				enclosed in quotes (or braces) to stop it
				being executed too early.
				eg,
				    (macro `name'
				    {
					(somecommand)
				    })

				NOT,
				    (macro `name'
					(somecommand)
				    )
				this would assign the value of (somecommand)
				to the macro "name" not the actual command
				string itself.

    0xHex Number                Value is a hex number eg, 0xfff
    0Octal Number               eg, 0777
    Decimal Number              eg, 123
				Any of these number clauses may have an
				optional minus sign ('-') preceding it.

    ~c - ascii value of c       Value is the ascii value of the character
				after the ~ character, eg, ~a has a value
				of 97. Escape characters (see below) can
				also be given.

    @                           This is the null clause, it has no value.
				All it does is take up one argument, can
				be useful for initializing groups of
				variables at once when they don't have to
				have a value,
				ie,
				    (global
					`var1'  @
					`var2'  @
				    )

In any string or character clause the escape character '\' can be given
to force a special meaning to a character, the supported escape sequences
are,

    \n      insert a newline character
    \t      insert a tab character
    \f      insert a form feed character
    \0xFF   insert a hex byte
    \0377   insert an octal byte
    \255    insert a decimal byte

    \`      These escape sequences take away the special meaning from the
    \'      character, eg, to get a quote in a string.
    \{
    \}

A command string is just a load of clauses one after the other, the value
of the command string is the value of the last clause in the string.

Comments can be started by a ';' character, comments last from the ; to the
end of the line. The ; can be put anywhere a whitespace character could be
put without affection the clauses, ie, between arguments, after commands,
etc. Example,

    (move `l' 20)   ; this is a comment,
    (settitle       ; and so is this.
	`foobar')

Actually there is a problem with comments, if they are inside a string, eg,
in a command string which is to be a macro the comments will not be stripped
until the command string is executed. If the comment contains un-escaped
quotes or braces the string will be prematurely terminated and things will
go wrong. eg,

    (macro `amacro'
    {
	(settitle `hello')  ; this is ok until I put in a ' or a ` or {}
    })

to fix this you can put in escape characters like,

    (macro `amacro'
    {
	(settitle `hello')  ; this is ok until I put in a \' or a \` or \{\}
    })

alternatively just don't put these characters in comments inside strings.

Finally, remember that all symbol names (commands, macros, variables, etc)
are case significant.


AREXX.
======

The first copy of JEd run (I can't think why you would need more than one
copy in memory at once?) will try to create an ARexx message port called
JED.

Command strings can be sent to JEd, they will probably need to be enclosed
in quotes so ARexx doesn't try to interpret them.

The way that results are returned to ARexx is slightly different to most
ARexx supporting applications, successful commands return 1 not zero in the
RC variable. If the result of a command is a string RC will be zero and the
RESULT variable will contain the string.

Currently there's no way to receive a result from an ARexx macro.


COMMAND SUMMARY.
================

explanation of synopsis:

    (command arg1  arg2 ...)
rtn          arg1  arg2
type         type  type

The rtn type and the arg type show the kind of value the command returns and
expects to be given, they can be one of the following,

    (S)     --  string value
    (N)     --  numeric value
    (S|N)   --  string or numeric value

Arguments surrounded by <...> are compulsory and must be provided for the
command to work, arguments surrounded by [...] are optional and arguments
surrounded by {...} mean one or more arguments can be given.

If I have shown that a command returns a number but have not documented what
it will be, then this scheme will apply, a zero means that the command
failed. If the return is non-zero (usually 1) the command was successful.

Another convention which I have used is that if a command is passed an
incorrect type of value (ie, a number instead of a string, or nothing at all)
the command will not return _any_ value. This will in turn make any command
using the value of this command as an argument fail, and so on...

Many commands which deal with parts of the text file expect what I have
referred to as a section type, often this is the argument <section>, this
should be one of the following strings,

    c       --  character under the cursor
    p       --  the character behind the cursor (previous)
    w       --  the word under the cursor (alpha-numeric only)
    b       --  the currently marked block (the block will then be cleared)
    l       --  the whole line that the cursor is on
    f       --  the whole file
    sf      --  from the cursor to the start of the file
    sl      --  from the cursor to the start of the line
    ef      --  from the cursor to the end of the file
    el      --  from the cursor to the end of the line

eg, to copy a marked block,
    (copy `b' 0)


synopsis                        function
------------------------------- --------------------------------------------
    (+ <value1> <value2>        Returns <value1> + <value2>.
(N)    (N)      (N)

    (- <value1> <value2>        Returns <value1> - <value2>.
(N)    (N)      (N)

    (* <value1> <value2>        Returns <value1> * <value2>.
(N)    (N)      (N)

    (/ <value1> <value2>        Returns <value1> / <value2>.
(N)    (N)      (N)

    (% <value1> <value2>        Returns the remainder from <value1> /
(N)    (N)      (N)             <value2>.

    (~ <value>)                 Returns the bitwise NOT of <value>.
(N)    (N)

    (! <value>)                 Returns the logical NOT of <value>.
(N)    (N)

    (| <value1> <value2>)       Returns the bitwise OR of <value1> and
(N)    (N)      (N)             <value2>.

    (|| <value1> <value2>)      Returns the logical OR of <value1> and
(N)     (N)      (N)            <value2>.

    (& <value1> <value2>)       Returns the bitwise AND of <value1> and
(N)    (N)      (N)             <value2>.

    (&& <value1> <value2>)      Returns the logical AND of <value1> and
(N)     (N)      (N)            <value2>.

    (== <value1> <value2>)      Returns 1 if <value1> is equivalent to
(N)     (S|N)    (S|N)          <value2>. Strings are compared case
				insignificantly.

    (!= <value1> <value2>)      Returns 1 if <value1> is not equivalent
(N)     (S|N)    (S|N)          to <value2>. Strings are compared case
				insignificantly.

    (> <value1> <value2>)       Returns 1 if <value1> is greater than
(N)    (N)      (N)             <value2>.

    (< <value1> <value2>)       Returns 1 if <value1> is less than <value2>.
(N)    (N)      (N)

    (<= <value1> <value2>)      Returns 1 if <value1> is greater than or
(N)     (N)      (N)            equal to <value2>.

    (>= <value1> <value2>)      Returns 1 if <value1> is less than or equal
(N)     (N)      (N)            to <value2>.

    (= <name> <value>)          Sets the variable <name> to <value>, global
(N)    (S)    (S|N)             or local variables can be set in this way.

    (activatefile <file>)       Attempts to activate the window holding a
(N)               (S)           file <file>. If <file> is not already in
				memory an attempt will be made to load it
				into a new window.

    (addsym {<name> <value>})   Creates a new global variable <name>, it's
(N)          (S)    (S|N)       value will be set to <value>.
				A synonym for addsym is global, ie,
				    (global `var' 0) is the same as,
				    (addsym `var' 0)

    (addpath {<dir>})           Adds a directory to the list of directories
(N)           (S)               searched for reference indexes.

    (arg <n> <type> <prompt>)   MACRO-ONLY. Returns the <n>'th argument
(S|N)    (N) (S)    (S)         passed to the macro on invocation. If no
				argument was supplied it is prompted for
				with <prompt>. If the argument is not of the
				type specified by <type> (`s' = string, `n'
				= number) the macro will be aborted.

    (atol <string>)             Returns the number represented by the ascii
(N)       (S)                   <string>. Decimal, hex and octal bases are
				supported.

    (bind {<key> <command>})    Binds the <command> to <key>.
(N)        (S)   (S)            IMPORTANT: Remember that the command string
				must be enclosed in quotes (or braces :-)

				<key> should be a string containing any
				number of qualifiers then one key. The
				supported things are,

				qualifiers,
				    SHIFT
				    ALT
				    CONTROL/CTRL
				    COMMAND/AMIGA
				    NUMERICPAD
				keys,
				    SPACE
				    BACKSPACE
				    TAB
				    ENTER
				    RETURN
				    ESC/ESCAPE
				    DEL/DELETE
				    HELP
				    UP
				    DOWN
				    RIGHT
				    LEFT
				    F1 -> F10

				some example <key>'s
				    shift tab
				    j
				    numericpad *
				    control x
				    alt F (or, alt shift f)
				    control alt i
				    f2

				If you bind onto a key which already has a
				binding the old command string will be not
				be lost. If the key is subsequently unbound
				the old binding will come back into effect.

    (block <type>)              Set the block markings according to <type>,
(N)        (S)                  this is a standard section type (see above)
				or,
				    `s'     mark start of block
				    `e'     mark end of block
				    `k'     kill block marks

    (break <depth>)             Stops the execution of <depth> number of
()         (N)                  strings being interpreted. The <depth> arg
				is mainly intended to enable break'ing out
				of loops (or similar) due to a condition.

				In the following example the (break) will
				cause a branch to the (req) instruction
				displaying the <depth> broken.

				(if 1
				{
				    (if 1
				    {
					(if 1
					{
					    (break 2)
					    (req `0' `zero')
					})
					(req `1' `one')
				    })
				    (req `2' `two')
				})
				(req `3' `three')

				eg, if you change the '(break 2)' to
				'(break 1)' only the '(req `0'...)' will be
				skipped. Test it out.

    (cd <dir>)                  Makes <dir> the current directory for the
(N)     (S)                     editor.

    (changes <number>)          Sets the counter of changes for a file to
(N)          (N)                <number>.

    (cli)                       Prompts for a command string and then
(S|N)                           executes it. Note that as with all commands
				who use the prompt mechanism a sleeping
				window will be woken up.
				Returns the value of the executed command
				string.

    (close)                     Closes the current window, if it is the only
(N)                             view of the file the file will be unloaded.

				If using this from a script do NOT assume
				which window will be activated when this
				one closes. It is left up to intuition to
				decide which window to activate. Until it
				does this (it may not even activate one of
				my windows, or if it does I won't hear about
				it until after processing the script) the
				window which the editor reguards as 'active'
				is guaranteed to be a view of the file
				which closed (if there are any other views).
				Another potential problem is what happens
				if the last window closes during a script,
				currently the script is aborted.
				Be warned, this command is weird.

    (copy <section> <unit>)     Copies a section of text to the clipboard
(N)       (S)       (N)         device. <unit> is the clipboard unit to copy
				to (usually 0). A <unit> of -1 means that
				the text is to be copied to a clipboard
				which is internal to the editor. This is
				faster than normal clipboard units.

    (cut <section> <unit>)      The same as (copy) except that the section
(N)      (S)       (N)          of text copied is then deleted from the
				file.

    (clear)                     Clears the current file.
(N)

    (changecase <section>)      Toggles the case of all alpha characters in
(N)             (S)             <section>.

    (delete <section>)          Deletes <section> from the file.
(N)         (S)

    (dlock <status>)            Sets the <status> of the display lock. When
(N)        (N)                  it is non-zero no rendering is done in the
				current window (except for on the title bar)
				The intelligent use of this command can
				significantly speed up macros.

				There could be problems if a macro who has
				turned on the display lock is aborted, by
				not being given the correct arguments
				perhaps, leaving the display locked. If this
				happens get into the (cli) command and
				unlock the display.

				This command does NOT nest (yet).

    (dowhile <body> <cond>)     First executes the string <body>, then
(N)          (S)    (S)         executes <cond>, if the result of <cond> is
				non-zero the loop is repeated. This command
				has the same safeguards against infinite
				loops as (while) has.
				Note that the <body> and <cond> are in the
				opposite order than in the while command.

    (extract <section>)         Returns the text from <section>.
(S)          (S)

    (find `s' <string>)         Sets the <string> to search for.
(N)           (S)

    (find `n')                  Finds the next occurrence of the string set
(N)                             by (find `s'). This command returns 1 if an
				occurrence was found.

    (find `p')                  Finds the previous occurrence of the string
(N)                             set by (find `s'). This command returns 1 if
				it was found.

    (find <switch> <status>)    Defines the behaviour of the (find `n|p')
(N)       (S)      (N)          command, these <switch>es are available,
				    `c' - case dependant search when
				<status> is non-zero.
				    `w' - when <status> is non-zero the
				string set by (find `s') is parsed as
				a standard AmigaDOS 2.0 wildcard. Note that
				the search only extends to the end of each
				line and that `#?' will probably have to be
				tacked onto the end of the string to account
				for characters after the pattern that you
				are searching for.

    (freq <type> <title>        Opens a file requester and asks for a file
(S)       (S)    (S)            name. <type> can be `r' or `w', these stand
		      <start>)  for read and write.
		      (S)       <title> is the title of the requester window
				and <start> is the file (and dir.) to put
				the requester on.
				If the requester is cancelled no result is
				returned, this will probably abort any
				commands who want it as an argument.

    (format <fmt> {[values]})   Returns a formatted string made from the
(S)         (S)    (S|N)        format specification <fmt> and the [values].
				(Almost) standard C language formatting is
				done, these substitutions can be performed,
				    %s      insert string
				    %ld     insert decimal value
				    %lx     insert hex value
				    %lc     insert char value
				eg,
				    (format `%s %ld' `string' 1000)

    (getref [refname])          This command searches all directories in the
(N)         (S)                 reference path (set with (addpath)) for
				files called ".jrefs", these files should
				contain indexes to all available references.
				If a reference matching refname (or the word
				under the cursor if refname isn't given) is
				found a new window is opened and the text for
				that reference is displayed. For example if
				you make a reference file for all autodoc
				files you can, when programming, place the
				cursor on a function name and then bring
				up the explanation of that function.

				Each line in a .jrefs file which begins with
				a @ character is taken as a valid reference,
				there are three types of line format,

				    @refname@reffile@searchstring@
				reffile is loaded and searchstring is looked
				for in the start of each line. If found the
				cursor is set to the start of that line.

				    @refname@reffile@#startpos@
				reffile is loaded and the cursor is moved to
				startpos (a decimal number) many bytes into
				the file.

				    @refname@reffile@#startpos/#endpos@
				the section of text between startpos and
				endpos (both decimal offsets) is loaded into
				the window.

				In each case refname is the name of the
				reference, this is matched case-significantly
				with what is being searched for.
				reffile is loaded relative to the directory
				that the .jrefs file containing it is found
				in.

				The program makerefs is provided for making
				references for autodocs, C header files and
				(special) C source files, see the file
				makerefs.doc

    (getstr <prompt>)           Prompts the user for a string, if the prompt
(S)         (S)                 is cancelled (<ESC>) no value will be
				returned.

    (getnum <prompt>)           Prompts the user for a numeric value, if the
(N)         (S)                 prompt is cancelled no value is returned.

    (getpref <pref>)            Returns the current setting of preference
(N)          (S)                <pref> (see (setpref)), currently you can't
				get the font settings.

    (if <cond> [true-cmd]       If <cond> is non-zero the command string
(S|N)   (N)    (S)              [true-cmd] is executed, else, [false-cmd] is
		  [false-cmd])  executed. The result of this command is the
		  (S)           result of the string executed, or no value
				if the string which should have been
				executed wasn't provided.

    (ilock <status>)            Sets the status of the input lock. This is
(N)        (N)                  intended for use by ARexx macros to lock
				out user input. Only commands from ARexx are
				received. Input through the window just
				queues up until the <status> is set back
				to zero. (actually the getstr and getnum
				commands are allowed to break the lock).
				The returned value is the OLD status of the
				lock.
				It is polite behaviour to reset the lock to
				whatever it was before you set it, ie,
				from ARexx,

				'(ilock 1)'
				oldilock = rc
				...your code...
				'(ilock 'oldilock')'

    (insert <section>)          Inserts section into the file at the current
(N)         (S)                 cursor position, since you can't insert into
				the text to be inserted it is probable that
				only blocks can be inserted with this
				command.

    (insert `f' <file>)         Inserts the file <file>.
(N)             (S)

    (insert `s' <string>)       Inserts the string <string>.
(N)             (S)

    (insert `a' <value>)        Inserts the ascii code <value> into the
(N)             (N)             file.

    (info <type>)               Returns information. <type> can be,
(S|N)     (S)                       col      column number (N)
				    cols     number of columns in line (N)
				    line     line number (N)
				    lines    number of lines in file (N)
				    char     ascii code of current char (N)
				    views    number of views of file (N)
				    files    number of files loaded (N)
				    windows  total number of windows (N)
				    time     current time (S)
				    date     current date (S)
				    cd       current directory (S)
				    fullname full filename (S)
				    filename file name(S)
				    dirname  path name(S)
				    screenx  width of screen (N)
				    screeny  height of screen (N)
				    leftedge x position of window (N)
				    topedge  y position of window (N)
				    width    width of window (N)
				    height   height of window (N)
				    size     # of characters in file (N)
				    offset   distance from start (N)
				    asleep   1 if window is sleeping (N)

    (join)                      Joins this line to the following one, if
(N)                             there is no line below this one it has no
				effect.

    (local {<name> <value>})    MACRO-ONLY. Creates a variable local to this
(N)         (S)    (S|N)        macro definition. When the macro is exited
				the variable (and it's contents) are lost.
				The variable is visible to other commands
				until another macro is entered.
				The variable will be created containing
				<value>.
				Local variables take precedence over global
				variables of the same name.

    (macro <name> <commands>)   Creates a macro symbol of <name> with an
(N)        (S)    (S)           associated command string of <commands>.
				Macros are treated by jed (almost) exactly
				the same as normal (primitive) commands,
				(they are also kept in the same hash table
				so you could redefine a primitive command as
				a macro :-). Macros are invoked in the same
				way as commands and can have arguments given
				to them (through the (arg) command) and
				return a value ((return) command).
				Some examples (oh no, tabulation breaks!),
; Word count macro.
(macro `wc'
{
    (dlock 1)                           ; lock display update
    (local `words' 0)                   ; word counter
    (move `sm' 0)                       ; save our position
    (move `sf')                         ; go to top of file
    (while {(move `nw' 1)}              ; loop till we get to last word
    {
	(= `words' (+ (words) 1))       ; increment counter
    })
    (req `There are %ld word(s) in this file.' `wow!' (words))
    (move `bm' 0)                       ; back to old position
    (dlock 0)                           ; unlock display
    (return (words))                    ; return the number of words
})

    (move <type> <number>)      Moves the cursor according to <type>,
(N)       (S)    (N)                d   --  move down <number> lines
				    dp  --  move down <number> pages
				    u   --  move up <number> lines
				    up  --  move up <number> pages
				    ln  --  move to line <number>
				    cn  --  move to column <number>
				    nc  --  move <number> characters ahead
				    nw  --  move <number> of words ahead
				    pc  --  move <number> of characters back
				    pw  --  move <number> of words back
				    r   --  move <number> columns right
				    rt  --  move <number> of tabs right
				    l   --  move <number> columns left
				    lt  --  move <number> of tabs left

				    bm  --  move to bookmark <number>
				    sm  --  set bookmark <number>, there are
				65535 bookmarks from -32767 through 0 to
				+32767. Bookmarks track any changes to the
				file and are cleared when a new file is
				started. Bookmarks are shared between all
				views of a file.

				The difference between `nc' and `r' is that
				nc will move onto the start of the next line
				at the eol whereas r will just keep moving
				right (to a maximum of 32768 columns!).

				If the specified position can't be moved to
				the command will return 0, otherwise 1.

    (move <type>)               There also these move commands which don't
(N)       (S)                   take a <number> argument,
				    ef  --  move to the last line
				    el  --  move to the last column
				    sf  --  move to the first line
				    sl  --  move to the first column
				    bs  --  move to block start
				    be  --  move to block end
				    am  --  move to the auto bookmark, this
				is set after a large(ish) move command, or
				after the find command.
				    mb  --  move to the next bracket which
				is at the same level of nesting as the one
				under the cursor, this is what matches what,
				    (   )
				    {   }
				    [   ]
				    <   >
				    `   '

    (match <pattern> <string>)  Matches the AmigaDOS wildcard string
(N)        (S)       (S)        <pattern> case-insignificantly with <string>
				returning 1 if they are equivalent, 0 if
				they aren't.

    (menu <status>)             Sets whether or not a menu is displayed in
(N)       (N)                   this window. If <status> is non-zero the
				menu is on.
				Currently this (probably) has a bug, in that
				when a window is slept the menu status is
				not remembered for when it is un-slept.
				Note that (setmenu) must have been
				successfully called for a menu to be
				displayed.

    (nargs)                     MACRO-ONLY. Returns the number of arguments
(N)                             passed to a macro when it was called.

    (newfile <file>)            Opens a new window for <file>, if <file>
(N)          (S)                exists it will be loaded into the window.

    (newview)                   Opens an additional window for editing the
(N)                             current file in. The windows share the same
				text buffer and bookmarks but are otherwise
				independant.

    (nextwind <type>)           Activates the next window in the list.
(N)           (S)               <type> can be `f' to activate the next
				_separate_ file, `v' to activate the next
				view of this file or `a' to step through all
				editor windows.

    (nop)                       This command does absolutely nothing, it
(N)                             returns 0.

    (openfile <file>)           Tries to load <file> into the current window
(N)           (S)               (and all other windows of the same file), if
				it can't be loaded the window is cleared.

    (prevwind <type>)           Activates the previous window in the list,
(N)           (S)               <type> can be `f' to signify the next file,
				`v' to activate the next window sharing a
				buffer with this window (the next view) or
				`a' to step through all editor windows.

    (poke <value>)              Sets the current character to <value>, only
(N)       (N)                   the lower 8 bits of <value> are used.

    (position <x> <y> <w> <h>)  Sets the position of the current window,
(N)           (N) (N) (N) (N)       <x>     x position
				    <y>     y position
				    <w>     width
				    <h>     height
				all measurements are in pixels.

    (replace `s' <string>)      Sets the replace string to <string>.
(N)              (S)

    (replace `r')               If the string under the cursor matches the
(N)                             string set by (find `s') it is replaced with
				the string set by (replace `s') and the
				cursor is advanced to the end of the replaced
				string.
				Note that it probably isn't a good idea to
				replace text found with wildcards.

    (remsym {<name>})           Removes <name> from the symbol table, <name>
(N)          (S)                can be a primitive command, a macro or a
				global variable.

    (rempath {<dir>})           Removes directories from the reference path
(N)           (S)               list which were added by (addpath).

    (rename <name>)             Change the name of the current file to
(N)         (S)                 <name>.

    (req <body> <gads>          Displays a requester containing <body> as
(N)      (S)    (S)             its main text and <gads> as its gadgets. The
		   {[values]})  <gads> specification can define multiple
		    (S|N)       gadgets by separating each one by a vertical
				bar ('|') character.
				Both <body> and <gads> can contain format
				characters (%s, %ld, etc), <body> takes
				formatting arguments from [values] first.
				The value returned is the number of gadget
				that was selected (starting at 1 for the
				leftmost gadget) or zero if the rightmost
				gadget was selected.

    (rexx <type> <string>)      Send a command to ARexx, type can be,
(N)       (S)    (S)                `m'     <string> is a macro file to be
				executed by ARexx. It should have a filename
				extension of ".jed". If you want you can
				specify any arguments to the macro after
				the macroname, eg,
				    (rexx `m' `amacro arg1 arg2')
				    `s'     <string> is a string of ARexx
				commands to be executed.

    (return [result])           MACRO-ONLY. Returns control from a macro to
()          (S|N)               whatever invoked it, the value of the macro
				is [result], this can be a string or a
				number.
				This command has no result since control is
				never returned to the caller.

    (savefile)                  Saves the current file as the file it was
(N)                             loaded from (or as what it has been renamed
				to).

    (savefileas <name>)         Saves the current file as file <name>.
(N)             (S)

    (savesection <section>      Saves the specified section of text to disk
(N)              (S)            as file <name>.
		       <name>)  If you're writing a macro or ARexx script
		       (S)      for something like integrated compilation
				this command makes more sense than
				savefileas since it doesn't change the state
				of the 'changes' counter or the name of the
				file. ie, use (savesection `f' `t:???')

    (saveprefs)                 Saves the current windows preference
(N)                             settings to the file s:jed.config. This file
				is read (if it exists) each time the editor
				is started. The dimensions of the current
				window are also saved.

    (select {<cond> <cmd>}      If <cond> is non-zero <cmd> is executed, the
(S|N)        (N)    (S)         result of the executed <cmd> is returned. If
		    [default])  none of the supplied <cond>'s are non-zero
		    (S)         the [default] command string is executed (if
				it is given).

				An example,
				(select
				    (== (info `char') ~a)
				    {
					(settitle `a')
				    }
				    (== (info `char') ~b)
				    {
					(settitle `b')
				    }
				    {
					(settitle `neither')
				    }
				)

    (setmenu <file>)            Reads <file> and makes a set of menus from
(N)          (S)                it, each line represents one part of the
				menu, the format of the different types
				of lines are,

MENU "name"                     Creates a new menu block
ITEM "name" "key" "commands"    Creates a menu item, key is the command-key
				shortcut, commands is what gets executed
				when the item is selected.
SUB  "name" "key" "commands"    Creates a sub item on the last menu item.
BAR                             Creates a separator bar in the menu block
SBAR                            Creates a separator bar in the sub items.
END                             Terminates the menu.

    (setpref <pref> [arg1]      Sets one of the preference settings,
(N)          (S)    (S|N)
		       [arg2])  pref            arg1        arg2
		       (S|N)    `tabsize'       size (N)
				`leftmargin'    col (N)
				`rightmargin'   col (N)
				`autoindent'    bool (N)
				`wordwrap'      bool (N)
				`font'          name (S)    size (N)
				`disktab'       size (N)
				`savetabs'      bool (N)
				`scrollhack'    bool (N)
				`bakdir'        name (S)
				`baknum'        number (N)

				explanations:
				  - tabsize is the size of tabs on the
				screen
				  - disktab is the size of tabs read from
				and written to disk.
				  - when savetabs is non-zero the leading
				spaces in a line will be optimised into tabs
				  - leftmargin is where the cursor is put
				after the split command unless autoindent is
				non-zero when the line will be indented the
				same amount as the previous line.
				  - rightmargin is where long lines are
				chopped when wordwrap is non-zero.
				  - font sets the (non-proportional) font for
				this window. remember the .font suffix.
				  - scrollhack doubles the speed of vertical
				scrolling when no block is being shown. It
				does this by fooling intuition into just
				scrolling one bitplane. By default this is
				on, the option to turn it off is in case it
				breaks under a future operating system
				revision. Thanks to Adriaan van den Brand
				for this cunning idea.
				  - bakdir, this is specifies the name of
				the directory which backup files are saved to
				when a file is saved.
				  - baknum, this specifies the number of
				backups to keep of any one file at once. They
				are stored in the directory set by 'bakdir'.
				eg, if bakdir is set to t: and baknum is set
				to three you would get backups like this,
				    t:afile.bak1  - newest after actual file
				    t:afile.bak2
				    t:afile.bak3  - oldest

				All preferences except disktab and savetabs
				are local to each window, when a new window
				is created it inherits its preferences from
				its parent.

				'bool' is short for boolean, 1 will turn the
				option on, 0 will turn it off.

    (settitle <title>)          Sets the current window's title string to
(N)           (S)               <title>.

    (script <section>)          Executes the text in the specified section
(S|N)       (S)                 of the current window.

    (script `x' <file>)         Executes the script file <file>. (`x' stands
(S|N)           (S)             for eXternal). If <file> can not be found
				relative to the current directory "s:jed/"
				will be prepended to <file> and it will
				be looked for again.

    (script `s' <string>)       Execute <string>
(S|N)           (S)

    (sleep)                     Make the current window go to 'sleep', it
(N)                             will become a small window on the screen
				title bar. It can be set back to normal by
				the (unsleep) command or clicking the right
				mouse button when the window is active.

				All commands (except for those which use
				the prompt, these will enlarge the window)
				can be executed while the window is
				sleeping. Anything you type while a window
				is asleep will be inserted!

    (split)                     Break the line into two at the cursor.
(N)

    (symboldump <file> <type>)  Writes the symbol table's contents to <file>
(N)             (S)    (S)      <type> can be,
				    globals     all global symbols
				    locals      all local symbols
				    all         all symbols

    (system <command>)          Execute an AmigaDOS command string. The
(N)         (S)                 value of this command is the return code
				of the executed command or -1 if the command
				couldn't be executed.

    (toupper <section>)         Make all characters in <section> upper case.
(N)          (S)

    (tolower <section>)         Make all characters in <section> lower case.
(N)          (S)

    (unbind {<key>})            Remove any command string bound to <key>.
(N)         (S)

    (unsleep)                   Wake up a (sleep)'ing window.
(N)

    (while <cond> <body>)       First, <cond> is executed, if it returns a
(N)        (S)    (S)           non-zero value <body> is executed and the
				above steps are repeated, else abort the
				loop and return the number of times that
				<body> was executed.
				There are a couple of in-built protections
				against infinite loops, firstly, if the
				number of iterations reaches a million the
				loop is aborted. Secondly (and more
				usefully), the loop can be aborted by
				sending a ^c break signal to the editor.
				This signal can be sent by the break command
				or, if you have the software toolkit disks,
				the breaktask command.

				example,
				    (while {(move `dn' 1)}
				    {
					...do something...
				    })


MISC. NOTES.
============

The maximum length of any line is 32768 characters, there are no problems
loading lines this long either (anymore). The maximum number of lines you
can have is 2147483648. I think that these limits won't be too restrictive.
Currently no checking is done to make sure that these limits aren't broken,
this means that you can crash the system if you do.

Sometimes error messages will be shown (on the titlebar) which may seem to
be a bit strange. These will normally be of the type "syntax error: argument
n should have been a xxx" and they are normally encountered when you cancel
a requester or prompt (or when some command types fail). These just show
that the command that wanted the input you didn't give is complaining at
being given nothing (huh?).

JEd appears to be mungwall-clean and to not permanently steal any resources,
I haven't been able to run it under Enforcer (no mmu!), if any hits are
found please send me the output together with information as to the version
of jed you're using.

The prompt mechanism used by the commands cli, getstr and getnum responds
to these keypresses,
    return  --  accepts the string
    esc     --  cancel the prompt
    bs      --  delete the character behind the cursor
    up/down --  recall the string entered in the last prompt
    (any other keys are just inserted into the string)


NOTE TO DME-USERS.
==================

I know this editor is somewhat similar to DME, I liked most of DME a lot but
there were some features I hated, so I wrote this.

