Why another editor ?
--------------------

There are numerous editors around in the UNIX-World which are professional and
general. There are also lots of editors which are dedicated and X11-oriented.
But I could not find a professional and general editor which is at the same
time really X11-oriented.
I do not want to blame all old-fashioned editors here. It is simply, that
modern Desktop computers should have a modern, easy to use AND powerfull editor.
With the increasing popularity of tcl-tk I saw the chance to do something
really new which combines both: the Power of the old fashioned editors with the
ease of modern GUI-concepts and an underlying, very flexible and popular macro
language.

Some Basic Ideas and Concepts:

1. The "Quick-Panel" provides an easy and fast overview of your activities.
   All widgets are fully editable and a large number of functions can be
   performed in a very intuitive way. For example you may rename your current
   buffer simply by editing the name in the widget and typing return.
   Or if you are editing a "Read Only" file and want to save it, you can simply
   switch off the "RdOnly" indicator.
   Searching a word is also very simple: double click on the word and insert
   this word with the middle mouse-button into the "Search" widget. The old
   contents is cleared automatically. Now choose one of "first/next/prev"

2. There are 3 different Cut/Paste buffers. You will normally not notice
   this, but it may help to keep this in mind.
   You first have the "Yank-buffer" which is filled with all "Kill"
   operations and restored with [ctrl-y].
   Since the X-Selection mechanism is not always convenient with an Editor
   (try to select 500 lines with a mouse; or how to mark a column with 
   X-select ?) I have also implemented a normal cut-and-paste buffer which
   is filled in a conventional style. The priority between the latter two is
   given to the X-Selection. What may cause problems to a beginner is the fact
   that each buffer can have its own active X-Selection which is activated
   when the buffer comes to front.

3. All  functions are available over the menu, but since the keyboard is very
   limited, it was not possible to give standard keys for all functions.
   Also I felt, that you should be able to write short macros from scratch by
   just typing a sequence of keys which should be repeated over and over again.
   For these two reasons I have implemented the "Function-Key-Macros". To have
   the less common features assigned to a key, you don't have to write any
   complex scripts in an unknown language, just choose the key (keypad or
   functionkey) you want to assign the function to from the "macro" menu,
   execute the function you want to assign from the menu, select the "Macro /
   Record END" function and you have assigned the function to a key. These keys
   are saved together with the preferences if you select "preferences / Save
   Preferences" This feature also allows for building some more complex macros
   on the fly which can contain a number of simple editing functions.
   
4. To allow for easy expansion and customization of tkedit I adopted the
   "WBStartup-drawer" Concept of the "Amiga".
   The Directory $HOME/tkedit_macros contains all macros which are available
   for your personal tkedit.
   All macros ending in "*.startup" are loaded during startup of tkedit.
   There is also a global storage for all available tkedit_macros:
   "somewhere in the PATH"/tkedit_storage.
   The user can decide which macros to include and which to throw away.
   A special "update" program takes care for proper installation and
   updating of the user macros.
   
5. All (nearly) Long-Term-functions can be aborted using either the right
   mouse button or the <Escape> key
   
6. There are two different "undo" functions (this may confuse beginners, but I
   will try to explain, why this makes sense)
   The "Limited Undo" [ctrl-u] restores only one level, but it takes its
   information from a complete backup buffer. With this function you may
   restore from long-term operations (e.g. a repeated operation)
   The "MultiLevel Undo" [ctrl-shift-U] is able to restore multiple levels
   (default is 100) but may be useless or inconvenient after a longterm
   operation since each operation is undone step by step.
   
7. To allow all tcl-text widgets to use "tkedit" keys and some additional
   improvements like "searching" and "saving" I provide a special
   "text.tcl" file for your $TK_LIBRARY drawer.
   When exchanging the standard (tk4.x !) $TK_LIBRARY/text.tcl by the
   supplied text.tcl you can use the same key binding in all tcl-tk programs.
   (For an overview of editing keys read the sections
   "Cursor movement" and "Editing")

   

   

Operation and use

Requirements:

tkedit needs "tcl-tk" and the "wish" installed and accessible through the path.
On our AIX-Workstations we have installed tcl7.3 + tclX7.3a-p2 and
tk3.6 + tk3.6p1 (IBMs choice for the SP2)
Version 2.0.0 works under (and in some cases prefers) tk4.1/tcl7.5

The First line of "tkedit" "tke" FileSelect" and "ColorSelect" contains an
absolute path to the "wish" which could need some attention:
#!/usr/local/bin/wish -f
You should also have the "FileSelect" and the "ColorSelect" Utilities
accessible through your PATH.
This File (tkedit_storage/tkedit.txt) also serves as "Help"-text when loaded
from the "Misc/Load Docu" menu if tkedit_storage is accassible through your PATH
tkedit_storage also contains the optional startup macros.
I would recommend that you type:
   cd /usr/local/bin/X11
   gtar xvzf tkedit-x.y.z.tar.gz

Feel free to copy "_tkedit" to "~/.tkedit".

Resources needed (Tested on a RS6000 (IBM 220), AIX 3.2.5, 64MB RAM)
   editing tkedit (100k) and tkedit.txt (25k)
   Normal operation (typing text)         MEM: 2.2MB  CPU: 15% - 20%
   Editing empty buffer (doing nothing)   MEM: 1.3MB  CPU: 15% -> 1.5%
   tke (micro tkedit, empty, no action)   MEM: 1.3MB  CPU: 15% -> 1.5%

   Here I have to address a specific Problem of tkedit:
   I need to do some things in the Background, when tkedit is running (a small
   kind of "multitasking") like auto saving, updating the informational widgets
   and highlighting keywords. Therefore I need to update all widgets by myself.
   But this method is very time consuming, since the updating is done, even if
   it is not needed.
   At the Beginning, this was not such a big problem, but over the time the
   things to be done in the background have increased and the system load
   also increased dramatically. With the last versions of tkedit (I think since
   I introduced the polled routines for keyword highlighting) this had become a
   real problem and "tkedit" was on the way to be an even worse hog than
   "emacs".
   With this Version (1.7.6) I hope to reduce this problem and I am thinking
   about possible solutions to make "tkedit" more "system friendly" (I must
   admit, that my first aim was to make "tkedit" more "user friendly")
   What has been done with this Version (1.7.6) is the following:
   
   Dynamic system load reduction:
   The system load decreases dynamically after a few seconds without
   user requests. The update intervall varies between 33 updates per second
   during interaction times and 2 updates per second during times without
   interaction. The Informational widgets are updated every second during
   interaction time, else every 4 seconds.
   This should result in a good performance from the user point of view and an
   acceptable system load from the "system administrators" point of view.
   The CPU usage measured before was on a small system, which should be
   comparable to a Power PC 601 system (maybe slightly faster)
   On larger systems the Load will vary between 8% and 0.1% (on an
   SP2-node with Power2 Processor, 128 MB RAM and 800MB Swap space)
   Three other references:
   Amiga 4000 (68040, 8MB RAM, 64MB swap, NetBSD_1.0) between 20% and 0.2%
   Power SGI (R3000, IRIX 5.3) between 20% and 1.0%
   SGI Challenge (R4400, IRIX 5.3) between 7% and 0.4%
   I think a much better performance can be yielded, when more care is taken to
   build an optimized wish for the specific architecture (I have had not the
   time to do this, I just took the wish "out of the box" without any special
   optimization)
   NOTE FOR SYSTEM ADMINISTRATORS:
      Since Version (1.7.7) you can configure the dynamic update behaviour
      with a configuration script in /etc/tkedit.cfg !
      Please read the instructions in the example file "tkedit.cfg"
   

tkedit light or tke:
   It is similar to "tkedit" (in fact it is just a link to tkedit) except that
   it does not load any startup macros (except the preferences file ~/.tkedit).
   This may become usefull as the number of macros is expected to increase
   and this will certainly slow down starting up the editor.
   After loading of tke you may run all startup macros by selecting
   "File/Exec Startup" from the Menu.
   
Mouse Buttons:

The Left Mousebutton selects text, and operates the buttons as in X
The Middle Mouse Button pastes selected X-Text as in X
   This can also be done with [ctrl-v] from the keyboard !
The Right Button has a special function:
   It deselects X-selects and clears all markers
   AND IT ABORTS LONGTERM FUNCTIONS 
   (like Replace All, Find matching Bracket...)
   You should use this button if you are not certain, which selection is taken
   or if your window gets too coloured (red from select, green from match, blue
   from X-select)

Cursor movement:
   The following cursor movements can be used. All employ the arrow keys and
   some additionally the <shift> or <ctrl> key.
   For compatibility with "fvwm" you may additionally press the <Alt> or
   <Compose> key. The keys are mnemonically assigned:
   
   next char/previous char = right, left arrow
   end of word = [shift-right]
   begin of word = [shift-left]
   end of line = [ctrl-right]
   begin of line = [ctrl-left]
   next line/previous line = down, up arrow
   next screen = [shift-down]
   prevoius screen = [shift up]
   end of file = [ctrl-down]
   top of file = [ctrl-up]

   tcl-procs for external use:

 NextChar PrevChar EndOfWord  BeginOfWord EndOfLine BeginOfLine NextLine 
 PrevLine NextScreen PrevScreen TopOfFile BottomOfFile

Editing:
   The following delete functions can be used:
   BackSpace (trivial)
   Delete Char [ctrl-=]
   Delete Word [ctrl-d]
   Delete to EOL [ctrl-.]  deletes from cursor to End Of Line
   Delete to EOW [ctrl-,]  deletes from cursor to End Of Word
   Delete to BOL [ctrl-/]  deletes from cursor to Begin Of Line
   Delete Line [ctrl-k]
   Delete Spaces [ctrl-space]
   Join lines [ctrl-minus]
   Back-Tab [ctrl-tab]     backspace to the previous TAB position
   
   More complex operations are performed using the cut/paste buffer
   
   tcl-procs for external use

  MarkBegin MarkEnd CopyToClip CutToClip PasteFromClip DelWord DelLine
  DelSelect DelSpace JoinLines Capitalize LowerCase DoIndent YankLine DoTab

Search and Replace:
   Here we have probably the biggest difference between conventional
   X11-editors and tkedit. Search/replace was designed to be easy AND
   convenient to use.
   Unlike most other editors tkedit does not open a special requester
   for search or replace strings. Instead it has two string input
   windows which may be edited directly (just click inside the window)
   or which are activated when you type [ctrl-s]/[ctrl-r].
   When the search window is activated from the shortcut key, the input is
   cleared. If you want to keep the text click inside the search window with
   the mouse. The search and replace windows offer a history with
   cursor up/down. Searching starts when you type <return>
   If the string was found, then the cursor is placed at the beginning of the
   string and the string is marked in red. If the string was not found, tkedit
   does NOT pop a a special requester which must be explicitly closed, instead
   simply nothing happens.
   There is also another way of feeding text to the Search String Widget: you
   may select a piece of text with the mouse and paste it into the widget.
   The old contents of the widget is cleared automatically when text is
   X-pasted. This enables an easy mouse driven Search.
   If the "Case" flag is on, search and replace is case sensitive.
   If the "RExp" flag is on, the search pattern is interpreted as a regular
   expression.
   With Version 1.6.2 replacing is done according to the rules specified with
   the "regsub" command if the "RExp" flag is set. This means, that it is
   possible in the replace string to refer to the text which was matched
   (using "&").
   
   Searching for matching brackets is also located in the "Search/Replace"
   menu. The shortcut is bound to [ctrl-m]. It brings you in front of the
   matching bracket and paints the text in between in green colour. If you have
   an unclosed bracket in a long file, this operation may take too long. Abort
   the search with the right mouse button.

   tcl-procs for external use

   AskGotoLine GotoLine AskSearchString SearchNext SearchPrev MatchBracket
   AskReplaceString ReplaceNext ReplaceAll InsertText

Textmarkers:
   The textmarker options can be found under the "search" menu
   You can define 4 markers directly, the other markers are defined
   by the system. You go to a markerposition by typing [ctrl] and a
   number. The 4 user definable markers can be stored with [ctrl] and
   the function key with the matching number (or from the menu).
   Position 5 and 6 correspond to the select buffer,
   position 7 and 8 are the insert positions in the two Views (if split views
   are active)
   position 0 is the last position before a goto or search and
   position 9 is the last result from a search


Paste Buffers:
   tkedit offers 3 paste buffers.
   1. The Yank-buffer is filled with deleted lines ([ctrl-k]) deleted Words 
      ([ctrl-d]) and deleted X-select ([ctrl-x]) and can be restored with the
      Yank option ([ctrl-y])
   2. The normal X-Select Clipboard. You can select text with the mouse
      and insert the selected  text with the middle button or [ctrl-v]
   3. The Paste Buffer which is normally filled with the [ctrl-b]
      [ctrl-e] sequence. Between Begin and End you may use all editor
      features to look for the end of the text to be selected.
      With [ctrl-e] you mark the text and copy the selected text into
      the paste buffer.
      Columnar Blocks are marked in the same way, just type [ctrl-t] instead of
      [ctrl-b]
      The Paste Buffer can also be retrieved with [ctrl-v] or the middle button
      if no X-selection is active. This allows you to use the X-Buffer
      as temporary paste buffer and return to the main buffer with
      deselecting the X-Selection (Right button)
      You can also copy the temporary (X-select) buffer to the main buffer
      with [ctrl-e].
   One Problem occurs, when you want to use X-Selection between buffers:
   The rule here is: the last active X-Selection is used.
   Lets assume you have four buffers: a,b,c,d and you have X-Selected text
   in "b" which you want to use in "d", but you also have an active X-selection
   in "c". With the rules above and using the "cycle buffer"-key you would
   insert in "d" the buffer from "c". To have the right buffer inserted go back
   to "b" and choose the buffer "d" directly from the menu or the hotlist.
   The Paste Buffer can also be stored to one of 4 locations and restored later
   on. This feature has been implemented to support macros.

The Status Indicator/Close Button:
   The "Close Button" has two functions:
   1. It closes the actual buffer (And leaves the Editor if there is no other
      buffer)
   2. It serves as "Status Indicator" which shows you if a CLOSE is save
      or not
   The Status indicator shows the following states:
   1. Green:   No changes made, Quit without confirmation
   2. Red:     Changes made, no backup, Quit must be confirmed
   3. Orange:  Changes made, saved to backup, Quit must be confirmed
   4. Blue:    Macro record active
   5. Violett: Select Sequence Active

Function Key Macros:
   For short repeated sequences of operations you may find it convenient
   not to write a tcl script, but instead simply record the key sequences
   you type. You may append Text to your Function key macros by
   selecting the text with the mouse and then choosing "Append to Macro"
   from the "Macro" menu.
   But you should be careful: The Macro recorder does not really know which
   characters you type and which mouse actions you do. The macro recorder
   gets its Information from any control operations you make (Cursor movement
   with cursor keys, Functions from the menu...) and tries to guess, which
   characters you may have typed in between. If you move the cursor with the
   mouse, the macro recorder thinks, you have typed the characters in between !
   So please (unless you know what you do):
   
       DO NOT MOVE THE CURSOR WITH THE MOUSE DURING MACRO RECORDING !

   Example:
   Sometimes you want to reformat a number of lines with new indentations.
   The key sequence you type to do this is:
      [ctrl-left]  Go to begin of line
      [ctrl-space] delete all spaces
      [ctrl-i]     indent text
      [down]       go to next line
   Select "Record F1" from the "Macro" menu, type the keys and
   select "Macro END" from the "Macro" menu
   Now the Key "F1" performs the 4 actions with one keystroke.

   You may wish to assign an external macro to a function key.
   This can be done with the "append external" option from the
   "Macro" Menu. External Macros can contain any legal
   tcl-construct and may call editor procs.

   Macros are saved with the "save" option from the "Preferences" menu.
   
My favorite Keyboard layout:
   The file "_tkedit" contains my favorite keyboard layout. If you have a
   tektronix keyboard (or something similar) you may copy this file to 
   $HOME/.tkedit
   <Do>     "Repeat Key"
   <PF1>    "Rpt.K. Range"
   <PF2>    Begin of Line ; Insert Tab ; Next Line
   <PF3>    Begin of Line ; End of Word ; Begin of Word ; Back Tab ; Next Line
   <PF4>    Begin Of Line ; Delete Spaces ; Indent ; Next Line
         PF1, PF2 , PF3 and PF4 are used to reformat ranges of lines
   <K7>     Comment C Line
   <K8>     Uncomment C Line
   <K9>     Comment C Frame
   <K->     Remove C Frame
   
   <K4>     Comment TCL Line
   <K5>     Uncomment TCL Line
   <K6>     Comment TCL Frame
   <K,>     Remove TCL Frame
   
   <K1>     Comment FORTRAN Line
   <K2>     Uncomment FORTRAN Line
   
   <K0>     Close View
   <K.>     Split View
   
   <F17>    Extract C-functions
   <F18>    Extract TCL procs
   <F19>    Extract FORTRAN subr.+func.
   <F20>    Extract Search
   
   <Enter>  End Of Word ; Begin Of Word
   
   <F13>    Uppercase Word ; Next Word
   <F14>    Lowercase Word ; Next Word
   
External macros:
   External macros are TCL-TK scripts which can be invoked during editing or
   during startup. Typically startup macros will add menu items and increase
   the functionality of tkedit, whereas the dynamically called macros do simple
   things which should not add functions and menupoints to tkedit.
   Dynamically called macros can be called directly from the "Macro" menu
   and they can be assigned to a function key
   Startup macros can be loaded from your "~/.tkeditrc" file or from a special
   directory "~/tkedit_macros".
   Since Version 1.5.0 this directory is under control of the 
   "Macro / Load Startup" menu item. The function looks for any 
   "tkedit_storage" directory, lets you select any "*.startup" and copies it to
   your "~/tkedit_macros" directory. The Macro is then called to add its
   functions to the running tkedit.
   Removing Startup Macros is under control of the "Macro / Remove Startup"
   Menu point. This function lets you select a startup macro from your
   "~/tkedit_macros" directory and removes this file. It also calles the
   "unload_" function entry of the macro.
   Of course you can also do this from the shell, but one of my aims was to give
   the full power even to UNIX beginners.

Multiple Buffers:
   When working with a large project you often have to edit a large number of
   files. Multiple buffers can help organizing this work. They are also usefull
   to help with the implementation of complex functions like "Shell execute"
   and "Extract Search".
   Every Time you open a file with "Open" or [ctrl-o] the actual file is stored
   internally, the new file is loaded into the display buffer and an entry is
   made into the "Buffer Menu" which allows you to restore the old buffer. You
   may also cycle through your buffers with [shift-Tab].
   You can also generate a "dynamic HotList" of all buffers with the
   "Buffer/Actual Hotlist" menu item. A click on the buffer name in the HotList
   brings you to the desired buffer.
   Sometimes it is convenient to have two buffers simultaneously on the screen
   for comparision and copying. Emacs would allow you to open a second "view"
   (view is the Tkedit-Terminology, but Window is not quite correct in an
   X-Windows environment) and work with the two views. Tkedit has restricted
   the use of views to different views in the same file. To allow editing
   multiple files simultaneously you can spawn a new editor window with the
   actual buffer. This is done with the "Buffer/Launch Buffer" menu item.
   The buffer is then removed from the actual editor. After closing the
   external editor the file is loaded back into the current editor (This
   feature requires the send command to work. If you are using tk3.6 the file
   is loaded into the FIRST "tkedit" on the display)
   CLOSE and QUIT are now handled in a different way:
   The "Close" button closes the actual Buffer, whereas "Quit" or [ctrl-q]
   leaves the whole editor (all buffers are checked).
   The other (X11-like) way is to open a new editor window with "Open New"
   from the Menu. All Editor windows share the same paste buffer (which is
   in fact stored to ~/.pastebuffer to enable buffer sharing in a distributed
   computing environment).

   tcl-procs for external use

   NewBuffer RenameBuffer ChangeBuffer
   
Split Views:
   Split views provide two different locations at which the same file may be
   edited and viewed. The following restrictions apply in this Version:
   It is not possible to open more than 2 views (one additional view).
   You can not resize a view individually.
   You may observe hangs and crashes when closing a view; resizing to an
      improper value will also very likely kill the editor.
      Since I know about these bugs, I have implemented that a savety
      Backup Copy (FILENAME~) is made before closing a view...
      With Version 1.3 I hope that this bug is fixed by setting the focus to
      the main window before closing the secondary view...

   tcl-procs for external use

   SplitView CloseView
      
Limited Undo:
   The limited undo feature uses the split-view buffer to hold a copy from
   the actual buffer which is updated before LF, any kill and any Paste or
   replace operation AND any long term operations.
   You may restore this buffer with [ctrl-u] if you are unhappy with the
   result of a longterm operation. When you abort a long term operation (either
   right mouse button or <Escape>) the buffer is restored automatically.

   tcl-procs for external use

   SyncText LimitedUndo
   
View Only Feature:
   If tkedit opens a "Read Only" file or is called as viewer instead of more
   The "View" flag is activated. You may also decide to use this flag on a file
   you have normally opened to avoid writing it back in an undefined state.
   Turning this flag off (from an initial "On") changes the write 
   permission flag of the file. (This will of course fail if you are not
   allowed to do this)

More / Less Feature:
   As explained under "View Only Feature" it is possible to pipe the output of
   a command to "tkedit" and use "tkedit" as an "X11-replacement" for more

Shell Feature:
   You may want to process your Text with any UNIX commands. For example you
   want to have a listing of all lines containing the Word "proc".
   choose "Misc/Shell/Execute Command". A new Buffer is opened.
   type "| grep proc" and <return>
   The Command is executed and the output will be displayed in the window.
   If you do not start your line with a pipe, then no input is feeded to the
   shell command.
   If you have processed your file through a unix command (sed or awk) then you
   might want to copy it back to your file. For this you can use the "Copy
   back" command in the shell menu. But be carefull: it does not ask !
   If you have accidently overwritten your file you can get back your original
   version with "undo" ([ctrl-u])
   
Extract_Search Feature:
   You may want to operate on a subset of lines from your file which contain a
   special keyword. For Example you may want to operate on all "procs" of a tcl
   program.
   Search for your keyword ("proc")
   Choose "Misc/Extract/Extract Search" from the menu
   In the Extract_Search buffer the return key brings you to the corresponding
   line of your file. Any changes to the buffer may be copied back to the main
   buffer with "Misc/Extract/Copy back". But be carefull: it does not ask !
   If you have accidently overwritten your file you can get back your original
   version with "undo" ([ctrl-u])
   With Version 1.4.9 you can also mark a line in the extract buffer for
   complete deletion with [ctrl-k]. The marked lines will be deleted during
   "copy back".
   
Repeat Key Feature:
   Often you have to repeat a keypress a number of times
   This feature is meant to help you in doing this fast.
   Select "Misc/Repeat Key" from the menu.
   Wait until the cursor is blinking in the File Name Widget !
   Now type the Number of repetitions (finish with <return>)
   The last step is to type the key which is to be repeated.
   This may be a single function key, a Macro Key or just a character.
   You may want to assign the "Repeat Key" function to a macro key.
   This is a little bit tricky, since during macro recording all
   functions are really executed !
   To assign the "Repeat Key" function to a macro key follow this description:
      Select a key from the "Macro" menu.
      Now Select "Misc/Repeat Key"
      Wait for the cursor in the File Name widget
      type "1" (and <return>)
      type <esc> (the Macro termination key)
   If your Terminal provides a "Do" or "Execute" key, I would recommend that
   you use this key for the "Repeat Key" feature.
   
   The following keywords can be used instead of numbers:
      all      The key will be executed starting from the top, until
               the end of the file is reached
      end      The key will be executed until the end of the file is reached
      range    The key will be executed in the range of the paste selection
      
   There is an "abreviation" Function "Rpt.K. Range" which is similar
   to "Repeat Key" with "range" except that you don't have to type anything
   else. But be carefull: It is easy to fool this function and yourself !
   It was intended to use together with "Formatting" options and the functions
   must provide any cursor movement ! If not, this function may seem to hang.
   Press the right mouse button to escape. If your Keyboard provides a "PF1"
   on the numeric keypad, I would recommend that you use this key for the
   "Rpt.K. Range" function. It may be a little bit tricky to program. Please
   ignore any error message.
   
   If you have trouble to program these keys to a function key you may also
   simply edit the "$HOME/tkedit" file and add a line in the form
      set MacF(21) "^YRepeatKeyRange"
      set MacF(53) "^YRepeatKey"
   But you should take care, that you do not overwrite this file with your
   current preferences when leaving the editor (turn off the "Pref-Autosave"
   flag)
   You can also simply "eval" the following lines with the "misc/EvalClip"
   feature and then save the preferences:

global MacF
set MacF(21) "^YRepeatKeyRange"
set MacF(53) "^YRepeatKey"
 
   
   Functions for external use: RepeatKey RepeatKeyRange

Converting Text:
   The Converting functions are located in the "File" menu.
   The Menu points are:
   "BS Remove (man)"
      Some manual pages are containing BS characters and are looking
      unreadable when viewed with tkedit. Wait until the file status flag is
      agreen nd then choose this option to convert the manual page.
   "File/convert/0x09 -> spaces %8"
      Since tkedit does not handle tabs (char 0x09) in a correct way (counts
      just one character) you should consider converting your text so that only
      spaces are left instead of tabs.
   "File/convert/CR-LF -> LF"
      If you have imported your text from an MS-DOS PC
      Also converts "Umlaute"
   "File/convert/CR -> LF"
      If you have imported your text from OS-9
   "File/Export to/MS-DOSe"
      saves your file in the usual CR-LF format
      Also converts "Umlaute"
   "File/Export to/OS-9"
      saves your file with CR instead of LF

Language Menu Features:
   For C, FORTRAN and TCL (initially) I have implemented a "small" set of
   utilities which should assist you in writing programs as long as no real LSE
   features are included.
   There is just one real option for each language:
   You can generate a list of Functions and procedures in a separate buffer.
   If you position the cursor in the declaration line you want to edit and type
   <return>  you will be positioned at this function in your text.
   The lines are automatically renumbered during editing.
   One other feature is related to this: you may edit the declaration lines in
   the LSE buffer and copy them back to the main program.
   In some aspects, this functionality is similar to what can be done with
   "ctags", but it can do this dynamically.
   
   For C there is also a C-Comment / C-Uncomment Feature
   C-Comment sets the line at the cursor position in comments.
   C-Uncomment removes the first "*/", searches backwards for "" and removes
   this.
   You may want to program macro keys with these functions or assign two
   ctrl-keys in your .tkeditrc
   For TCL and C I have also included the "Frame Range" facility which draws
   a comment frame around selected text. To remove the frame the cursor must be
   located inside the frame.
   
   tcl-procs for external use
   
   CComment CUncomment   
   

Preferences:
   The following options can be modifyed and stored with the Preferences:
   - Case sensitive Search / replace
   - Regular Expression Pattern Search / replace
   - Auto Indent
   - Pref Autosave         Automatically save preferences when leaving editor
   - Font Type
   - Font Size
   - colors                Set Colours for all kind of widgets and markers
   - Default Colors        Reset to some default values
   - Enable Split/Undo     Enables the Split/Undo buffer. On small Systems
                           this may cause problems when editing large files.
   - X-Kill on BS/DEL      Kills X-Selection when typing BS or DEL.
                           This would make "tkedit" somewhat painfull to use,
                           but it is the default on other editors. Decide on
                           your own.
   - Dim FocusOut          makes a window dim if it looses the keyboard focus
   - Old Style Select      This is usefull on small systems using tk4.x
                           since the new tk4.x X-Selection tends to be painfully
                           slow on systems equipped with an older Processor
                           (like 68040 or 80486). May have negative side effects
                           (I haven't checked this extensively)
   - Ins. follow View      Let the Insert point follow the View
   - Copy Attributes       Allows Tags to be copied between buffers and views.
                           May get very annoying when editing large files with
                           language sensitive highlighting.
   - Scrollbar-X           Activates a horizontal scrollbar. This is usefull
                           for long lines. It resets the wrap mode.
   - Autosave              makes a periodical backup in "FILENAME~"
   - AutoBackup            makes a Backup Copy before the first "Write" in 
                           "FILENAME.tkbak"
   - Tabs can be configured as white spaces modulo 2 to 8 or as char 0x09
   - AutoNewLine           inserts a NL after the specified number of
                           characters. The Variable "AutoNewLine" may be used
                           from outside. The "Text Formatting" features do also
                           use this variable
   - Macro definitions     the Macros from the Macro menu are also saved with
                           the preferences

Startup files:
   Two files will be read and executed when you start the editor:
   1. $HOME/.tkedit    contains the last preferences saved.
   2. $HOME/.tkeditrc  is the user modifiable startup tcl-program
      ".tkeditrc" is somewhat superfluos due to the
      "$HOME/tkedit_macro.startup" mechanism but it is included for
      backward compatibility and for the rare cases where you want to do
      something in a well defined order or just before the startup macros were 
      executed
   If you specify the "-do" option together with a filename,
   the file will be loaded and the specified tcl-program will be
   executed. No further macro execution is done, so you have to
   execute the normal startup macros explicitly from within your
   "do" macro (call ReadConfig). The first argument to tkedit must
   be the filename to edit !
   

Startup Macros:
   The directory "$HOME/tkedit_macros" will be created when you first install a
   startup macro with "Macro/Load Startup".
   It can contain any number of TCL-macros for tkedit.
   All Macros ending with ".startup" will be loaded when you start the editor.
   Other macros (for dynamic loading) should have names "*.tcl"
   NOTE: This is the Behavior since Version 1.5.3 !
         Earlier releases used the names "*.tcl" for startup macros.
         The Macros are extended to include an "unload" function and to
         recognize, if they were called before. You should copy the new macros
         to your "tkedit_macros" directory and remove the old macros

Available macros so far (Version 2.0.0):
AutoMatch.startup       marks matching "bra's" when you type a "ket"
CTAGS_support.startup   UNIX "ctags" support
MAKE_support.startup    make and error analysis support

BW_Terminal.startup        File status display for BW-Terminals
LP_Printer.startup         Sets "lp" print mechanism instead of "lpr"
ISO_Font_Type_In.startup   Type In support for National Character sets

TextFormat.startup         Formatting selected text
KeyBindings1.startup       Standard Key bindings (should not be loaded !)
                           Only for information !
KeyBindings2.startup       Key bindings for <Shift><Ctrl> keys
InitialFKey.tcl            some simple FKey macros. Load once and save with
                           Preferences !
HighLight_C.startup        Highlighting for C-Keywords
HighLight_FORTRAN.startup  Highlighting for FORTRAN-Keywords
HighLight_TCL.startup      Highlighting for TCL-Keywords
ProcList_TCL_Perl.startup  Proc/Sub list for TCL and Perl (Hotlist + Extract)
ProcList_C.startup         List C-Function declarations (Hotlist + Extract)
ProcList_FORTRAN.startup   List FORTRAN subroutines and functions
Fold_Expand.startup        Folding and expansion of functions
MultiLevel_Undo.startup    The support for multilevel Undo/Redo, as separate
                           macro to enable use of undo package for text-widget
EnableDeleteKey.startup    forces Delete Key to delete the right character
                           (not working as Backspace)
EmacsKeys.startup          Simple support for emacs key bindings (igittigitt !)
EmacsMigrationKeys.startup Emacs Keys with ADDITIONAL <Alt> or <Mod> key
                           (leaving the "tkedit" keys untouched)
Use_tkdir.startup          Uses "tkdir" instead of "FileSelect"
                           "tkdir" is a separate package, available at
                           ftp.ifh.de:/pub/unix/tcl/code/tkdir-n.m.i.tar.Z
Hide_Mouse.startup         Hides mousepointer in text window and activate
                           during motion
Ispell_Support.startup     allow spell checking of a text buffer
MarkCurrent.startup        Mark current line and cursorposition in colour

Command line options:
   The File Name MUST be the first string after "tkedit"
   followed by:
   -ro                     starts "tkedit" in "Read Only" mode
   -do "tcl-script"        execute tcl script instead of ~/.tkedit and
                           ~/.tkeditrc
   -pos line.column        position cursor after loading file
   -search "string"        Search for String
   -width characters       set width of window
   -height characters      set height of window
   -fg "#rrggbb"           sets foreground color
   -bg "#rrggbb"           sets background color
   -cmd "tcl-string"       execute tcl and tkedit commands
   -exit "tcl-string"      execute tcl command on exit
   


Still To Do:
   LSE - Formatting                    [depends...]
   HEX Mode                            [Unsolved problem with char 0x00]
   HTML Mode                           [some work...]
      
Known Bugs to Version 2.0.0:
   - The Insert point at the view behaves strange on the first activation
   - When the Buffer is cycled with split views activated, the File status
     is set to "Changed"
   - When going to a byte position (by writing to the file length string)
     The File status is set to "Changed"
   - Tabs do not count % 8 character positions !
   - If you have opened a split view and choose "Close View" from the Menu
     you should wait for some seconds. The view will be closed in a two step
     process: first the focus is set to the main view and then the secondary
     view will be removed. If you try to activate the secondary view, in the
     meanwhile, tkedit will hang !
     A Backup Copy (FILENAME~) is made before closing a view... 
   - X-Insert (middle Button) near the border of the text window sometimes
     resets the viewing position to the beginning or end of the file.
     If this happens to you, just press a cursor key and the view position is
     restored
   - Searching backwards with regular expressions enabled only gives you the
     first occurence in a previous line. This is not a bug, this is a feature!
   - Sometimes the Editor crashes when you try to iconify the window
     And I am NOT able to stop "updating" the window when it is iconifyed
     since "wm state ." is not very reliable.
   - After folding of functions the linenumber displayed refers to the folded
     text. This bug can not be solved easily and fast within TCL (any Idea ?)
      
Open Questions with Version 2.0.0:
   - Does anyone know a reliable way to tell, if a program is iconifyed
     (since I would like to disable any activity of tkedit during this time
      and I am suspicios, that the crashes of tkedit after iconifying the
      window are due to the fact that I try to do something during this time)
      BTW "wm state ." does not work RELIABLE !
      After deiconifying it stays at "iconic" !
   - Any Idea how to handle binary files containing char 0x00 (for HEX mode) ?

Thanks for hints and suggestions to:
Raul Barral Tamayo (raul@ordago.uc3m.es)
Harry Baecker (hbaecker@duncan.island.net)
Eric Jan Malotaux (emalotau@gak.nl)
Alan G. Yoder (The Programmer of CEdit for better function extraction routines)

to be continued...



------------------------------------------------------------------------------
Rainer Kowallik         postdoc at           DESY-Ifh Zeuthen
Kowallik@ifh.de                              Platanenallee 6, D-15738 Zeuthen
