Here you find a collection of useful macros for THE (The Hessling Editor, by Mark Hessling) users have contributed (mostly via the mailing list THELIST) to share them with other users. Feel free to check these out. Interesting concepts and valuable examples can be seen here.
In general the macros are free to use, some are even in public domain.

TABLE OF CONTENTS

all extended with GNU regular expressions by interfacing to grep
color setup easy visual change of color layout
column macros for prefix area
count lines containing a string target (like XEDIT count)
filelist enhancement to dir file
filename completion on command line
filter parts of current file through external program (e.g. for formatting, indenting, recoding)
FW-client/server drop a file on the client icon and load it into the ring of a running THE server
FW-folding outline your text by hiding parts you don't need
FW-macros (complete) enhance THE with lots of features
FW-utilities (from FW-Macros) some useful utilities independent from FW-macro concept
localeSimulate dead keys or compose keys for inserting accented characters
move to line containing a specified string target (comparable to clocate)
power input text typed in at the command line
prefix put/del/get of marked regions
search in file for string target using the all command

Converting KEDIT-macro-library (.kml)
Porting XEDIT-macros
Coding conventions
Coding THE-macros with other editors than THE

DETAILS ON MACROS

all extended

Author Franz-Josef Wirtz
Download allx.the (1601 Byte)
Restriction needs GNU grep utility
Description
You can use allx when you need more power for selecting the wanted lines.
License GNU General Public License

color setup

Author Franz-Josef Wirtz
Download thefwset25c.zip (16166 Byte)
Restriction THE 2.5, color version
Description
Under construction
License GNU General Public License

column macros

Author: Vance Johnson
Download: col.zip (4221 Byte)
Restriction: unknown (THE 2.4?)
Description:
See README
License: unknown

count lines

Author: Scott Mattes
Download: count.the (1587 Byte)
Restriction: unknown
Description:

License: public domain

filelist

Author: Shintaroh Hori, Scott Mattes
Download: not yet available :-(
Restriction: unknown
Description:
It seems, that there are macros available, but not yet fully ported from KEDIT (Shintaroh Hori) or restricted in access (cern) or not complete (Scott Mattes).
Some suggest:
It seems that something has been done in the CERN. Take a look at http://wwwcn.cern.ch/regina/ in the VM/CMS migration issues section.
License: not yet publically available

filename completion

Author: Pablo Garcia-Abia
Download: complete.the (4728 Byte)
Restriction: needs 'ls' utility (e.g. from GNU-filetools)
Description:
Macro to complete filenames in the command line, whenever the first command typed is XEDIT or THE. Otherwise, an alternative command is executed.

More sophisticated completion may be implemented in the future for other commands, eventually.

To use it, define a key in the following way:

DEFINE keyname MACRO complete alternative_command

For example:

define TAB macro complete sos tabfieldf

In this example, the TAB key will complete filenames when typed IN the CMDline (after XEDIT or THE commands). Otherwise it will execute "sos tabfieldf".
License: unknown

filter

Author: Ian Collier
Download: filter.the (1541 Byte)
Restriction: obviously needs a utility which can act as filter
Description:
Filters the region from the current line to the target.

example: filter 5 fmt -72

format the next 5 lines of text with Unix "fmt" utility
License: unknown

FW-client/server

Author: Franz-Josef Wirtz
Download: thefwcs23.zip (3156 Byte)
Restriction:Only on OS/2 (needs rxqueue for named queues)
Description:

License: GNU General Public License

FW-folding

Author: Franz-Josef Wirtz
Download: thefwfold24.zip (20025 Byte)
Restriction: none (THE 2.4?)
Description:

License: GNU General Public License

FW-macros (complete)

Author: Franz-Josef Wirtz
Download: thefw25c.zip (296031 Byte)
Restriction: THE 2.5, OS/2, WIN32, X11
Description:

License: GNU General Public License

FW-util

Author: Franz-Josef Wirtz
Download: thefwutil25c.zip (36573 Byte)
Restriction: THE 2.5, file system with long filenames
Description:

License: GNU General Public License

locale

Author: Franz-Josef Wirtz
Download: locale.zip (1504 Byte)
Restriction: implementation for X11
Description:

License: GNU General Public License

move to line

Author: Scott Mattes
Download: ml.the (1202 Byte)
Restriction: unknown
Description:
Locates the line the target is in and then place the cursor at the beginning of the target.

If anything is on the command line at the time of execution, then that is used as the target; otherwise the user is prompted for the target.

The search starts at either the line the cursor is on or the focus line, depending.
License: public domain

power input

Author: Jonathan Beach
Download: pow.zip (3761 Byte)
Restriction: unknown
Description:
Its purpose is to provide a means of inputting text in THE in a manner similar to the power typing mode in the VM/CMS version of XEDIT (or at least my memory of how it operated 5 years or so ago.).

After putting the POW.THE command in your macro path, you just issue the POW command from the THE command line and begin typing. As you type, the text is inserted directly into the document as the line is typed indented by the amount of the left margin setting. It stores the current line in a working variable and updates any changes to the line with the REPLACE command.

When you get to the end of the line, POW performs a word wrap based on the difference of your right margin setting and the left margin setting It does this by truncating the current line at the last space before the margin length, inserting that line into the file (or at the margin if there are no spaces on the line). The macro then inserts a new blank line in the file and puts the leftover text on that line.

If you press the ENTER key before reaching the end of the line, that line will be inserted into the document right away and a new blank line is started. To exit the macro, you just need to hit return on a blank line. To enter a blank line into the text, just precede it with a space. While the macro is running, the backspace, del, left cursor key and ^H (C-H) can all be used to go back one space to the beginning of the current line (mistakes on lines other than the current line must be corrected outside of the POW macro).
License: Copyright to the Author

prefix put/del/get

Author: or Wesley J. Metzger
Download: ppt.zip (2034 Byte)
Restriction: unknown
Description:
Copy selected lines in a ring of files from one file to a selected position (with g in the prefix region) of an other file. prefixpt: REXX prefix macro to PUT or to PUT DELETE a line or block of lines.

prefixg: REXX prefix macro to do a GET after a line.

These commands are intended to be used from prefix area. You should define several synonyms to make use of them.
License: unkown

search in file

Author: search in file
Download: sif.the (1648 Byte) Note: this is not the complete macro.
Restriction: unknown (THE 2.3?)
Description:
Years ago, in 1984 to be more precise, I wrote a search-macro, a bit like ALL. This macro worked fine in XEDIT and later (adjusted) in KEDIT and still works fine.
License: unknown


CONVERTING KEDIT-MACRO-LIBRARY (.kml)

Since THE does not support macro librarys you have to put each macro into a separate .the-file. You might want to contact Agustin Martin Domingo since he has written a small utility to do an automatic conversion. Thus, when you use KEDIT besides THE you only have to maintain the KEDIT-macro library.


PORTING XEDIT-MACROS

By Mark Hessling

I have been hearing from a few of you regarding the porting of XEDIT macros to THE, and thought I would suggest a couple of things that may make your life easier in the future.

While most XEDIT users will use THE in full XEDIT compatibility mode, I would strongly suggest that macros be written in THE compatibility mode.

The reason for this is that the behaviour of THE wrt movement of focus and current lines, movement of cursor etc in various commands in THE compatibility mode is stable and unlikely to change, whereas in XEDIT compatibility mode, it is likely that behaviour will change as I fix it. The end result is that your macros will break :-(

You should add an EXTRACT of COMPAT at the beginning of the macro, followed by a SET COMPAT THE THE THE, and when the macro finishes, restore the settings saved.


CODING CONVENTIONS

There are several styles around for coding REXX according to
  • Maxwell,
  • Cowlishaw or
  • Wide.

  • To follow one of these styles would improve the readability of your macros to others.

    Some other guidelines might be:

  • Don't use abbreviated THE commands.
  • Avoid multiple statements in one line.
  • Introduce names for line targets with an underscore to differentiate to procedures.
  • Put the macro name followed by at least two dashes into the first comment line, so the rxtag-Utility can respect macro calls.
  • More to be added.


  • CODING THE-MACROS WITH OTHER EDITORS THAN THE

    Sometimes it's desired to have an editor at hand, which can correct a macro just changed and disallowing to edit files properly with THE. For emacs there is a powerful REXX-mode available (Written by Scott Maxwell, archie for rexxmode). There is also a highlight mode for this mode to have the code in fancy colors (from Franz-Josef Wirtz). The FW-macros contain also a file (rxtag.cmd) to utilize egrep for creating TAG files on the-macros. With such a TAG file you can quickly look up the called macro or procedure.
    Realization of this page Franz-Josef Wirtz
    Parts of this file are taken from the documents available in the packages or from the postings on THELIST.
    Last edited on: 03 Jan 1998