BETH: A Browse & Edit Tcl Hypertool
------------------------------------------
Keybinding Reference Page:

Browsing: browsebind.tcl

                          Control-
                             p                    Up
Single Char Movement:      b + f      or      Left + Right
                             n                   Down

                           Meta-
Single Word Movement:      b + f

                                                 Shift-
                            M-,                    Up
Edge of Page Movement:  C-a  +  C-e    or      Left + Right
                            M-.                   Down

                                                          Meta-    Shift-
                 M-z            M-v   Prior                 <      Prior
Scrolling: Line:  |       Page:  |  or  |        Document:  |  or    |
                 C-z            C-v    Next                 >      Next
                                 (space)
                                                 Any: scrollbar button2

Select	Line 	C-K (C-k)
	Region	C-W Select (C-w)
	All	M-W S-Select
	Any	button1
	Clear	C-c

Mark	Set	C-space
	Xchange	C-x

Center cursor	C-l

Goto line	M-g

Quit		M-q Button-quit


Window Commands: windowbind.tcl

Toggle:	Control:	M-C-c
 	X Grid:		M-x
 	Y Grid:		M-y 

           Control-              Control-
              [                    Up
Resize:     ] + }      or      Left + Right
              {                    Down

            Meta-                 Meta-
              [                    Up
Move:       ] + }      or      Left + Right
              {                    Down

        Control-Meta-         Control-Meta-
              [                    Up
To Edge:    ] +        or      Left +

One can think of this as:

Control-	=Resize		=Shrink (up/left)	-Open	=rows
Meta-		=Move	-Shift-	=Expand (down/right)	-Closed	=columns
Control-Meta	=To Edge

Window:	Iconify:M-I
	Raise:	M-i
	Move:	Below:		M-M
		Below Shown:	M-m


Editing Commands: editbind.tcl

Kill:	line:	C-k
	region:	C-w

Paste:	C-y	Insert	button3

		Next:		Previous:
Delete:	Char:	C-d Delete	C-h
	Word:	M-d		M-h
	Region:				C-Delete Button1-Delete

Case:	Upper:	M-u
	Lower:	M-l
	Cap:	M-c

Open line:		C-o
Toggle overwrite mode:	M-o
Quote:			C-q
Indent:			C-i
Transpose:	Chars:	C-t
		Words:	M-t

Log:	Last:	M-C-l
	Kill:	M-C-k
	Undo:	M-C-u


Entry Commands: entrybind.tcl

Entry/Text Toggle:	Escape
Destroy Entry:		C-g
Complete String:	Tab
Possible Completions:	C-Tab
Kill:	all:		C-u

                          Control-
Single Char Movement:      b - f    or      Left - Right

                           Meta-
Single Word Movement:      b + f

                          Control-             Shift-
Line Movement:             a - e    or      Left - Right

Scrolling:	Any: button2

Select	Line 	C-K
	Region	C-W Select
	All	M-W S-Select
	Any	button1
	Clear	C-c

Mark	Set	C-space
	Xchange	C-x

Center cursor	C-l

           Control-              Control-
Resize:     ] - }      or      Left - Right

Kill:	line:	C-k
	region:	C-w

Paste:	C-y	Insert	button3

		Next:		Previous:
Delete:	Char:	C-d Delete	C-h
	Word:	M-d		M-h
	Region:				C-Delete Button1-Delete

Case:	Upper:	M-u
	Lower:	M-l
	Cap:	M-c

Quote:			C-q
Toggle overwrite mode:	M-o
Transpose:	Chars:	C-t
		Words:	M-t


File Access: filebind.tcl
					I/O Pipe Syntax:  | cmd [&]
			Prompt				  ----- ---
File:	save:	M-s	M-S				  |  |   |
	read:	M-R	M-r			 	  |  |  Gradual output
	insert:		M-C-i				  |  |
	visit:		M-C-v				  | as expected by open
							  |
							 Use a pipe

Command Execution: commandbind.tcl
					Cmd Syntax: [|] cmd [|]
Command:	Wish:		M-C-w		    --- --- ---
	 	Exec:		M-C-e		     |   |   |
			Make:	M-C-m		     |   |  Send output to text
	Region:		Edit-X:	M-C-x		     |   | 
			Print:	M-C-p		     | as accepted by exec
						     |
				 		    Get input from text
					 	  (Only for exec commands)

Incremental Search: searchbind.tcl

		 New		Old
Search:	Forward: C-s Find	C-S
	Reverse: C-r S-Find	C-R
	Regexp:	 C-M-s

Search:	Again:	Forward:	C-s Find
		Reverse:	C-r S-Find
	Exit:			Return C-g


Query Replace: replacebind.tcl

		New	Old
Change:		C-c	C-C

Change:	Search	Again:	Forward:	C-s Find
			Reverse:	C-r S-Find
	This one:			C-c
	All:				C-C
	Exit:				Return C-g


Multiple Beth Interpreters: interpbind.tcl

		All	Shown
Switch:	Next:	M-N	M-n
	Prev:	M-P	M-p

Switch:	To:	M-C-b


Key Bindings: keybind.tcl

Universal Argument:	C-u

All:		M-K
	Shown:	M-k


Text Bindings: lib/textbind.tcl

				Meta-
Paragraph:	Traversal:	a - e
		Select:		C-j
		Adjust:		M-j
		Split:		S-Return


Startup: beth.tcl

Configs:
	-c Causes Beth to seize control upon startup.
 	-i Causes Beth to start up iconified. This option overrides -c.
 	-b Browse mode only, no editing provided.
	-t Title 	Adds the next word to Beth's window & icon title.
	-l Module	Sources the module, either in pwd or Beth's directory
	-w configs	Configs get passed on to the text widget.
Options:
	-	Standard input.
	=	Standard input, gradual
	X	The X Selection
	0	Nothing
	name	The contents of the file indicated by name
	|cmd	Output of cmd.
	|cmd&	Output of cmd, gradual


User Configurations: beth.config.tcl

Add:	Text Module:	M-C-t
	Balance Module:	M-0


Overview of BETH
-----------------

Beth is a simple word-processor modeled after Emacs. Upon heavy use of Emacs,
I have come to the following postulates over what Beth should be capable of:

1. Emacs is keyboard-oriented (the result of predating mice), and achieves its
functionality soley with key-bindings. This has a significant advantages over
more current editors in that it does not require the user to alternate between
two hands on keyboard and one on keyboard / one on mouse. The user can thus
enter commands faster. (A disadvantage is the learning curve for key-commands,
much slower than for a GUI.)

Like Emacs, Beth should be completely accessable from the keyboard
(particularly the QWERTY section) so the user need not switch constantly between
keyboard and mouse. While it will have mouse-support, and support for the
arrow-keys and numeric keypad, all mouse and special-key functions also can be
accessed through the QWERTY keyboard.

2. Many of the mouse-based editors run considerably slower than Emacs. Their
slowness is hidden by the GUI and command-entry by mouse, and only becomes
apparent when the user tries to execute keys bound to various functions
repeatedly.

Like Emacs, Beth should be fast enough to handle the fastest typists on text
entry (which Tcl naturally provides). In addition, simple functions like
cursor-movement that are used heavily and repeatedly should reveal no lethargy
on the part of the system.

3. Gnu-emacs contains Meta-Lisp, a language useful for extending the editing
functions. This makes for a widely configurable system.

Beth is written in Tcl, which contains many LISP-like features. While Meta-LISP
is only useful inside Gnu-Emacs, Tcl can be used for many programming functions
besides text-editing.

4. Emacs (in most incarnations) is very large, and takes up a lot of space. It
is slightly slow in starting up, and thus is not well suited for small
start-and-stop editing jobs.

Beth, thanks to Tcl's interpretive nature, is a smaller program than Emacs, and
thus starts more quickly. Using X and running as a background process, it is
ideal for quick browsing/editing of small documents, since one has access to
both the calling shell and Beth in different windows. In addition, Beth can
run in a 'browse' mode, which loads only the functions necessary for browsing,
thus saving load time.

5. Emacs allows multiple buffers per session, making it well-suited for editing
many files in one session. This and it's slow load time make it a
'run-once-and-add-new-files' editor.

Beth only edits one file at a time. For multiple-file-editing, you run one
instance of Beth on each file. Thus each Beth interpreter is self-sufficient.
Tcl's send command is useful for 'inter-beth' communication. In addition, there
are several modules which provide functions to switch between Beth
interpreters, or execute a command in all interpreters.

6. As a terminal-based editor, Emacs provides no GUI.

Probably the most important point here. While the current GUI for Beth is
minimal, Tcl allows for the quick addition of graphical functions and
customizability.

7. The text widget provides all the necessary functionality for text editing; no
alternate widget is necessary.

Well, it doesn't completely...you can't view the same text in mulitple windows,
for instance (Beth fakes this), and paging up/down doesn't always work as
expected. But the text widget is well supported, and can be easily extended.

8. I won't think of everything. People will want features I never thought to
add. Beth is therefore very modular, and simplifies module-adding as much as
possible.

The following core widgets are made by Beth:

Text: 	The text widget contains the actual text that will be edited. Note that
the normal text bindings have been replaced with BETH bindings. The only
bindings that remain are the bindings for mousebuttons 1 and 2. Button 1 is used
to select text, and button 2 is used for scanning. (see the Text(n) manpage for
details).

Scrollbar:   A scrollbar that assists in scrolling through the text widget.

Interpreter entry:   This is an entry widget that contains the name of the
interpreter running Beth. Note that its contents may not be changed, the only
bindings allowed in it are mouse button 2 (for scanning) and mouse button 1
(which selects the enitre interpreter name) In this way every Beth process
advertises its interpreter name, so the user can interactively send commands to
the running interpreter (from a remote wish script, for example).

Quit button: A standard button that when pressed, closes down Beth. Note that
this button can be invoked from the keyboard (see Browsing)

Menu Bar: Contains the functionality of Beth's keybindings via menus. Each
function that has a keybinding also has an entry in one of Beth's menus. These
menus are classified by function, not by module. For example, the replacement
options are contained in the search menu, even though replacement is a separate
module. The menus serve as a handy keybinding reference chart, and they can be
used anywhere a keybinding would get used. Selecting a menu option performs the
same event as if you had typed the option's corresponding keybinding. Most of
the options are independent of whether the cursor is in the Text widget or an
Entry widget, however some, such as the browsing and editing commands, work
particularly on the widget the cursor is in. In almost all cases, if a
keybinding has a text binding and an entry binding, these bindings perform the
same function. (such as cursor movement, or character deletion/
transformation.)


Browsing: browsebind.tcl
------------------------

This section handles simple browsing functions (those that don't modify the
text). It first disables most regular keys, any key with no other function is
set to ring the bell.

Simple cursor movement:

For single-char movement, C-b moves back one char, and C-f moves forward. For
single-line movement, C-n moves down a line, and C-p moves up. These are the
same bindings provided by Emacs.

The arrow keys (Left,Right,Up,Down) are also bound to these same functions.

                          Control-
                             p                    Up
Single Char Movement:      b + f      or      Left + Right
                             n                   Down

One can also traverse words. In Tk, a word is a sequence of letters, numbers, or
_ or any single character not one of the above. M-b moves backward one word, and
M-f moves forward one word.

                           Meta-
Single Word Movement:      b + f

To go to one edge of the text window, the following are used:
C-a goes to the beginning of the current line, C-e goes to the end.
M-, goes to the beginning ot the top line on the page, M-. goes to the last
character on the page (to be precise, it goes to the character one before the
first non-visible line; this is usually the last char). These are the same
bindings provided by Emacs.

Pressing Shift and an arrow key will execute these same commands.

                                                 Shift-
                            M-,                    Up
Edge of Page Movement:  C-a  +  C-e    or      Left + Right
                            M-.                   Down

To scroll the text by one line, one can use C-z for scrolling up and M-z for
scrolling down. To scroll by one page, one can use C-v to go down, or M-v to go
up. One can also page down and up with the Prior and Next keys. Also, in browse
mode (where text entry is disabled) the space bar will page down. (in normal
editing mode, this, naturally, inserts a space). Finally, one can go to the
beginning of the text with M-<, and to the end with M->. Or one can use S-Prior
or S-Next for beginning and end of text, respectively.

                                                          Meta-    Shift-
                 M-z            M-v   Prior                 <      Prior
Scrolling: Line:  |       Page:  | or   |        Document:  |  or    |
                 C-z            C-v    Next                 >      Next
                                 (space)
                                                 Any: scrollbar button2

To select text, one can use C-K to select a line. Repeatedly hitting C-K adds
more lines to the selection (this is just like Emacs, except Emacs kills the
text instead of selecting it.) In Browse mode, C-k has the same functionality.

The C-space key sets a mark, just like in Emacs, and one can then use C-W to
select the region between the mark and the insert cursor. (emacs is similar, but
kills the region instead of selecting it.) The Select key has the same
functionality as C-W, and in Browse mode, C-w also has the same functionality.

One can automatically select all of the text by hitting M-w. Or one can hit
S-Select.

The selection is exported as the X selection, so you can paste a selection in
Beth into another Beth interpreter, or, in fact, any application which can
take the X selection.

And, you can select arbitrary lengths of text by using mouse button 1 (see
text(n) for details.)

Finally you can clear the selection by hitting C-c or making another selection
in or outside Beth.

Select	Line 	C-K (C-k)
	Region	C-W Select (C-w)
	All	M-W S-Select
	Any	button1
	Clear	C-c

The C-x key switches the location of the insert cursor and the mark.

Mark	Set	C-space
	Xchange	C-x

One can set the cursor at the center of the scrren (vertically) by hitting C-l. (Note this does not move the cursor...it just scrolls the text)

Center cursor	C-l

One can go to any arbitrary line by hitting M-g. An entry widget will be brought
up, and the user enters a location to go to. (see Entry Bindings). If the user
enters a number, the cursor moves to the beginning of that line (just like
Emacs). In addition to specifying a line number, the user can instead enter any
index accepted by the Text widget (see text(n) for details) 

Goto line	M-g

Finally, the user can quit Beth by hitting M-q, or clicking on the 'Quit'
button.

Quit		M-q Button-quit

All the bindings except for Quit have menuoptions under the Browse menu. The
Quit option is under the File menu.


Window Commands: windowbind.tcl
-------------------------------

This section includes commands to handle geometry management, control, and
various windowing functions.

Beth uses Tcl's global grab routine (see grab(n) for details about grab) to
direct the input focus. A beth editor that has a grab in effect is said to be in
control. While an editor is in control all mouse events are disabled except the
ones within that editor. When no editor is in control, the focus for mouse and
keyboard events is determined by the window manager. An editor in control will
display a 'Grab' label. Note that you cannot perform X events on a grabbed
window's titlebar using the mouse, but you can perform X events inside the
grabbed window. Fortunately, beth provides keybindings for window functions like
resize and iconify. Also note that you cannot grab an iconified window.

The standard key for control is M-C-c. It toggles control on or off.

Toggle Control:		M-C-c

Beth also can bring up optional grids to display line or column numbers. The M-x
key brings up a grid of column numbers above the text widget, pressing M-x
causes thhe grid to disappear again. And the M-y key brings up a grid of line
numbers to the left of the text widget's scrollbar, which scrolls along with the
text widget to keep the line numbers accurate, and disappears from another M-y.

Toggle:	X Grid:		M-x
	Y Grid:		M-y

Be aware of the limitations of the horizontal and vertical grids. The horizontal
grid is useful only if you are using a fixed-width font. The vertical grid stays
correct through any scrolling or paging functions, but if the text contains
multiple fonts, or logical lines that take up several physical lines, the line
numbers may be inaccurate. The top line number, however, is guarenteed to be
correct under all circumstances. However, if the text_nowrap_on_grid variable is
set to 1 (which is the default), turning on the y grid changes the text's
wrapping to be none, so all grid lines are accurate.

Tcl's text widget can be arbitrarily small or large, but it determines the
geometry of the window. The window geometry is gridded by the size of the font
in the text window. (see the wm(n) manpage for details on geometry management).

One resizes the window by enlarging or shrinking it by a single row or column at
a time. During this resizing the title bar and text remain stationary and the
bottom or right edge moves in the specified direction. To shrink the window
horizontally, one uses C-[, to expand it one uses C-{. To shrink the window
vertically, one uses C-], to expand it, one uses C-}. Hitting Control over one
of the arrow keys has the same effect.

One can think of the functionality by what each key does to the lower right
corner:

           Control-              Control-
              [                    Up
Resize:     ] + }      or      Left + Right
              {                    Down

One can also move the window one column/row in any direction. Here the window
size remains constant. M-[ moves the window up one line, M-{ down one line, M-]
right one char, and M-} left one char. Using Meta with an arrow key achieves the
same effect.

            Meta-                 Meta-
              [                    Up
Move:       ] + }      or      Left + Right
              {                    Down

Finally, one has the option of placing the window at the top or the left of the
screen. C-M-[, and C-M-Up move the window to the top edge, and C-M-] and C-M-Left move it to the left edge.

        Control-Meta-         Control-Meta-
              [                    Up
To Edge:    ] +        or      Left +

One can think of this as:

Control-	=Resize		=Shrink (up/left)	-Open	=rows
Meta-		=Move	-Shift-	=Expand (down/right)	-Closed	=columns
Control-Meta	=To Edge

There are two other move commands, which are useful for aligning windows with
each other. Pressing Meta-m puts the current Beth window right below the
previous Beth window that is currently deiconified. Also, Meta-M is similar,
except that it puts the current window under the previous Beth window, whether
iconified or not. If the previous Beth window is iconified, it is brought up,
right above the current window. These commands are useful for aligning windows
in a single column.

Window:	Move:	Below:		M-M
		Below Shown:	M-m

M-I iconifies the current window. The window automatically turns off control
when iconified. M-i performs back-to-back iconify and deiconify commands, which
has the effect of raising the window. If the window had control before M-i, it
regains control after being deiconified.

Window:	Iconify:M-I
	Raise:	M-i

All commands, except for M-C-c (toggle-control) are contained in the Window
menu. Note that both grid options are checkbuttons. The control command is
represented by a checkbutton under the Interpreter menu.


Editing Commands: editbind.tcl
------------------------------

This module sets up basic editing commands. Text entry is enabled. A checkbutton
is displayed that becomes set when the file is modified.

One can erase text in one of two ways. Killing text removes it from the window,
but puts it in a 'kill' buffer, just like in Emacs. It also selects the text in
the kill buffer, so it can still be pasted by Beth, or any other X
application.

One can kill a line of text with Control-k, just like Emacs. Be careful, though.
Control-k will remember the last point where text was killed from, and one can
increase the kill region by hitting Control-k repeatedly; however, unlike Emacs,
a single 'kill session' is not terminated by hitting another key, it is
terminated when a kill occurs at some point different than the previous kill.
This can occasionally yield unexpected results upon pasting killed text. In
addition to C-k, one can kill the region between the insert cursor and the mark
with C-w. As before, C-c clears the selection, whether it be in the main text
region or the kill buffer.

Kill:	line:	C-k
	region:	C-w

Pasting is done with C-y, which will insert the contents of the X selection
before the insertion cursor. The X selection may be created with one of Beth's
select functions, or from the kill buffer, or from another X application. The
Insert key and mouse button 3 (normally unused in Tcl) have the same
functionality.

Paste:	C-y	Insert	button3

In lieu of killing, one can delete characters or ranges of text, never to be
seen again. C-d removes the character after the insert cusror and C-h removes
the one before the cursor. The Delete key has the same functionality as C-h. You
can delete words as well. The M-d key deletes the range of the word from the
cursor to the end, and the M-h key deletes from the cursor to the beginning of
the current word. When the cursor is at a word boundary, these delete the next
and previous word, respectively. Also, you can delete the current selection by
hitting C-Delete, or by hitting Delete with mouse button 1 pressed. Thus button
1 is useful for both selecting and deleting text.

		Next:		Previous:
Delete:	Char:	C-d Delete	C-h
	Word:	M-d		M-h
	Region:				C-Delete Button1-Delete

There are a few functions to change the case of a range of letters. M-u, for
example, converts all letters within the selected region to UPPER CASE. If no
selected region exists, the characters between the cursor and the end of the
current word are UPPERCASED. M-l is similar, but it converts its range to lower
case. Finally, there is M-c, which Capitalizes Its Range Of Text.

Case:	Upper:	M-u
	Lower:	M-l
	Cap:	M-c

There are a handful of other editing features. C-o inserts a newline character
*after* the insertion cursor. C-t has the effect of transposing the two
characters adjacent to the cursor. For word transposition, M-t transposes two
words around the cursor. Actually, M-t transposes three words, which usually
does the right thing, exchanging two alphanumeric words while leaving intact the
whitespace between them. Also, C-q allows one to enter a control character
directly into the text.

There is also a command C-i to indent the selected region. It prompts for an
indentation prefix, to be inserted at the start of every line. This is useful
for indenting a textual paragraph or commenting out lines of code.

Normally characters that are inserted leave the characters to the right of the
insert cursor intact. However this is not always necessary. To have new
characters inserted overwrite previous characters, one can turn on the overwrite
mode. This is done by pressing M-o.

Open line:		C-o
Toggle overwrite mode:	M-o
Quote:			C-q
Indent:		C-i 
Transpose:	Chars:	C-t
		Words:	M-t

Last, but not least, you can undo most commands that alter the text. The key
M-C-u will undo the last undoable cmd (even if you have done other commands that
are not undoable). Multiple undo's are possible, and the variable max_undos
determines how many are possible at one time, when set to -1 (the current
setting) there is no limit.

Currently any Paste, Delete, Indent, Case, Adjust, File-insert, Transpose, or
Search/Replace can be undone. (These are all the simple editing commands that
cannot be undone with a single keystroke, commands like Kill and Backspace are
easy to undo by themselves.)

A word of warning about undo's: most commads that are undoable use marks to
store the locations where they performed actions. Should the text around those
marks be deleted, the marks may move around in unpredictable ways. For example,
if deletions used marks, they would get bunched up together, and would not undo
properly, hence deletions use absolute indices instead of marks.

If one is unsure about what might get undone by a M-C-u press, one can view the
last command on the undo log, by typing M-C-l. One can clear the log with
M-C-k.

Log:	Last:	M-C-l
	Kill:	M-C-k
	Undo:	M-C-u

All the editing commands described above are listed under the Edit menu.


Entry Commands: entrybind.tcl
-----------------------------

In Tcl, entry widgets are similar to text widgets, except that they only provide
one line for entry. Thus they are useful for entering parameters like numbers
and simple words. Most functions that take arguments get them from the userr via
entry widgets. 

When any entry widget is active in Beth, one can toggle the cursor between entry
and text by hitting Escape. One can also destroy the entry widget and exit
whatever function was invoked with C-g. Both Escape and C-g work in either entry
or text widgets. 

Entry/Text Toggle:	Escape
Destroy Entry:		C-g

All entry widgets perform string completion. Pressing Tab in an entry will
normally attempt to complete the word immediately before the insert cursor. Beth
will beep if no completion is possible or ambiguous completions exist. If more
than one completion is possible, then one can press C-Tab to see the possible
completions. This is presented as a dialog window with a listbox, so you can
select "OK" by pressing the 1 or <Return> keys. Or you can select a completion
by double-clicking on that particular list entry.

Complete String:	Tab
Possible Completions:	C-Tab

Since completion uses Tcl's string match command, pressing Tab on a string with
a * will substitute any set of characters for the *. For more info, see the
string.n manpage.

By default, Beth completes file/directory names (when preceded by a space),
variable/array names and indices (when preceded by a $), and Tcl commands (when
preceded by a [). Beth will also replace a complete Tcl command with it's
output, a complete variable with it's value, and a file glob expression with the
expanded files. Some entries will also allow special types of completion in
addition to this default setup.

All of the above functions are listed in the Entry menu. Note that this menu is
inactive unless there is an entry available on the screen.

Entrys themselves take many of the same commands that the text widget takes, but
keep in mind that the keybinding will affect the entry widget only if the cursor
is in the entry widget, otherwise the keybinding will affect the text widget.

The following keys perform the same function in entries that they perform in
text. (Be aware that word cmds behave slightly differently in entries than in
text, due to the fact that text widgets have a concept of a word, while Entries
do not.)

                          Control-
Single Char Movement:      b - f    or      Left - Right

                           Meta-
Single Word Movement:      b + f

                          Control-             Shift-
Line Movement:             a - e    or      Left - Right

Scrolling:	Any: button2

Select	Line 	C-K
	Region	C-W Select
	All	M-W S-Select
	Any	button1
	Clear	C-c

Mark	Set	C-space
	Xchange	C-x

Center cursor	C-l

           Control-              Control-
Resize:     ] - }      or      Left - Right

Kill:	line:	C-k
	region:	C-w

Paste:	C-y	Insert	button3

		Next:		Previous:
Delete:	Char:	C-d Delete	C-h
	Word:	M-d		M-h
	Region:				C-Delete Button1-Delete

Case:	Upper:	M-u
	Lower:	M-l
	Cap:	M-c

Quote:			C-q
Toggle overwrite mode:	M-o
Transpose:	Chars:	C-t
		Words:	M-t

All these options are under the Browse and Edit menus.

There is one entry binding with no correspondence to a text binding. C-u kills the entire entry's text. One can recover this text with C-y.

Kill:	all:	C-u

This option is under the Entry menu.


File Access: filebind.tcl
-------------------------

This module introduces file I/O access. It brings up two label widgets on the
display, one displaying the current path of the loaded file, and one displaying
the current file name. Pressing mouse button 1 over either label replaces its
contents with a '-', pressing button 1 again brings the path or name back again.
This is useful for keeping the bottom status line short.

With file bindings, Beth monitors the contents of the text buffer (via the
modification checkbutton, see the editbind section for details.) It also
monitors the modification time of the file, and thus will know if the contents
of the text buffer differ from the contents of it's associated file. Any attempt
to load a new file (or the same one), or to quit will require a confirmation
dialog if the modification checkbutton is set. (see the dialog section for help
on using the dialog)

File selection can be done either with XF's file selector widget (see the XF
help for info on the file selector), or with a small file selector entry widget
within Beth itself. See the startup section for information about how to switch
between file selectors.

The file bindings are as follows:

To save the current file, use M-s. M-s will prompt if no current filename is
known to Beth, otherwise it will silently save the file (and turn off the
modification checkbutton). To force file prompting, so you can save to a
different file, use M-S.

M-r reads in a new file, specified by the user. M-R is similar, but it 'reverts'
to the old file, it reads the old file without prompting (of course, if the
current buffer is modified, it will require confirmation.) Both M-r and M-R
erase the old contents of the text buffer.

To read a file without destroying the text contents, use M-C-i. It inserts the
contents of the (to-be) specified file before the insert cursor.

Finally M-C-v can be used to bring up another incarnation of Beth on a specified
file.

			Prompt
File:	save:	M-s	M-S
	read:	M-R	M-r
	insert:		M-C-i
	visit:		M-C-v

In addition to normal files, Beth can use a command pipeline for input or
output, as accepted by Tcl's open command (see the manpage on open(n) for
details on open's syntax). To use a pipeline for I/O, simply enter the command,
prepending it with a |. The command pipeline should be entered in the NAME entry
widget if you are using the XF File Selector, or, if you are using Beth's file
selection entry, it should be entered there. Specifying a command pipeline for
writing will send the entirety of the text widget to the pipeline; specifying a
command pipeline for reading will enter the output of the pipeline into the text
widget. Any errors generated from the pipeline will appear in a Tk error
window. (Keep in mind that many commands like diff send their output to stderr,
so they will generate an error message, even if the command does the Right
Thing.). If you want the error message to get inserted into the text widget
along with the output (such as in a terminal), append a "|& cat" to your
command, which will merely pipe stdout and stderr of your original command
through cat.

I/O pipelines complete all their output before adding any to text, which is fine
for most commands. However, sometimes you'd like to see the output of a command
while it is still in operation. When reading/inserting, you can indicate that
the output be gradually inserted into the text widget as it is produced. This is
done by appending an & to the pipeline command. When gradual output is
specified, Beth switches to 'busy' mode, whereby the cursor changes to a watch,
and the output of the command is entered line-by-line into the text widget.
After the output is inserted, Beth exits busy mode, and reports any errors that
occurred. The text widget is normally scrolled to accomodate the new output,
however one can excape the scrolling by moving the view or the cursor away from
the end of output.

Beth goes into busy mode when reading files or I/O pipelines. However, Beth is
responsive (somewhat) to user interaction while reading an I/O pipeline
gradually. Also you can stop a gradual read any time by pressing C-g, which will
bring Beth out of busy mode. Keep in mind that some commands will yield Tk
errors if interrupted.

All of these options are available from the File menu. The File menu also
contains two checkbutton entries to cover the artificial syntax of pipe I/O. If
the 'Use a Pipe' checkbutton is on, the file is assumed to be a pipe to be
written to or read from. If the 'Gradual output' checkbutton is on, all I/O
pipes that are read are read in gradually.


Command Execution: commandbind.tcl
----------------------------------

This module implements command execution for wish and for Tk's exec commands,
including several examples.

Beth can take wish commands and execute them. The command M-C-w brings up a
prompt for a wish command. Once confirmed, the command is executed in Beth's
global level, and output is handled accordingly: If no errors occurred, the
return value is discarded, otherwise, the error is brought up in a Tk error
window. However, if one wishes to see the return value, one may append a | to
the command. This will cause the return value to be placed in the text widget at
the insertion cursor, provided the command executes with no errors, and Beth is
in Edit mode and allows insertion. If Beth does not allow insertion, or an error
occurs, a Tk error window will be brought up containing the output or message.

Cmd:		Wish:		M-C-w

A variation on the wish-command is the exec-command. The command M-C-e brings up
a prompt for a command which, once confirmed, gets passed to Tcl's exec command
(see the exec(n) manpage for details of exec's syntax). The exec command takes
syntax much like a normal shell, it allows pipelines, stream redirection, and
background processing.

By prepending the command with a |, one indicates that the selected region of
text (or all the text if none is selected) should be fed in to the standard
input. Similarly, appending a | to the command indicates that output is to be
added to the text, just as in the wish-command. If a | is appended to the
command (and Beth is not in browse mode), then stdout and stderr get piped out
to the text widget at the insert cursor. If | is not appended, and no errors
occured, the contents of stdout is discarded. Otherwise, the contents of stdout
and stderr are shown in a TK error window (unless they are both empty). 

Cmd:	 	Exec:		M-C-e

Since commands passed to wish or exec may take some time to complete, Beth goes
into a 'busy' mode during their execution. The cursor changes to a watch and the
title and icon name change. Beth also ceases responding to user events. Beth
exits busy mode when the wish or exec command is finished.

There are several commands which merely pass predefined commands to
exec-command. One is M-C-m, which supplies a make command (that brings the
output of make up on a new Beth interpreter).

The print command, M-C-p, is an example of a command that uses input from the
text. If a region is selected in the text, that region alone is printed. If no
text is selected, the text in its entirity is printed.

Finally the Edit-X command, M-C-x simply brings up a new Beth interpreter, which
contains the region of selected text, or all text if none was selected. This is
useful for saving text from a Beth interpreter in browse mode, since the newly
instantiated Beth interpreter can save/load files, while the Beth interpreter in
Browse mode can not.

Cmd:		Exec:	Make:	M-C-m
	Region:		Edit-X:	M-C-x
			Print:	M-C-p

Note that while I/O pipelines and exec-commands can be used to do the same
things, they behave differently in a few subtle ways:

Attribute	I/O Pipeline	Gradual Pipe	Wish/Exec command
-----------------------------------------------------------------------
Can be Beth's
main file:		Yes	Yes		No

Can be inserted	
into another file:	Yes	Yes		Yes

Responds to user
commands:		No	Yes		No

C-g interrupts		No	Yes		No

Simultaneous I/O	No	No		Yes

Syntax		  | cmd [&]			    [|] cmd [|]
		  ----- ---			    --- --- ---
		  |  |   |			     |   |   |
	 	  |  |  Gradual output		     |   |  Send output to text
		  |  |				     |   | 
		  | as expected by open		     | as accepted by exec
		  |				     |
		 Use a pipe			    Get input from text
		(Gradual output is only for pipes) (Only for exec commands)

Default Output	Stdout always goes to text	Depends on command, but
Direction:	Stderr always goes to Tkerror	stdout & stderr always
						stay together.

All functions described here are under the Command menu. There are also two menu
options with no corresponding keybindings. They control when I/O can occur
between the text and wish/exec commands. The "Get Input from Text" option is
similar to prepending exec commands with a |, it sends the contents of the text
widget, or the selected region, to the exec command's standard input. And the
"Send Output to Text" option is similar to appending exec and wish commands with
a |, it sends the output of the wish or exec command back to the text widget at
the insert cursor. Thus these checkbuttons replace the artificial syntax of
prepending or appending wish and exec commands with |'s.


Incremental Search: searchbind.tcl
----------------------------------

Beth has a search system that performs a search on the string as the user types
it in. It can search forward from the insert cursor to the end of text, or
backwards from insert to beginning.

Entering search brings up a label named "Search" or "Reverse Search" depending
on the direction, and an entry containing the search string. To enter the search
mode, press C-s. C-r is similar, but it goes in reverse direction. C-S and C-R
are like C-s and C-r, except they bring up the previous contents of the search
entry; they are useful for searching the same string over and over again. The
Find key has the same function as C-s, and Shift-Find is the same as C-r

		 New		Old
Search:	Forward: C-s Find	C-S
	Reverse: C-r S-Find	C-R

The search entry accepts all entry bindings, including C-g (destroy entry) and
Escape (entry-text toggle). Every key pressed, including a control key that may
modify the entry performs another search. When a search string is found in the
text it is tagged with the 'search' tag. (There are no highlight bindings to the
search tag; it is recommended you add one, see the Startup section for details
on configuring the tags) The insertion cursor is moved to the region of the
search tag when a search succeeds.

Some keys have special bindings in the search entry. C-s performs another search
on the string, after the currently found one. If none exist, it signals an error
message. Pressing C-s after a failed search starts the search over from the
beginning. C-r is similar, except it goes in the reverse direction, and starts
from the end of text if pressed after a failed reverse search. The Find and
S-Find keys are bound to C-s and C-r in search mode, just like in regular mode. 
Finally, Return has the same effect as C-g, it exits the search.

Search:	Again:	Forward:	C-s Find
		Reverse:	C-r S-Find
	Exit:			Return C-g

Beth also has regular expression search. The keybinding C-M-s starts a search
for a regular expression the user inputs. This search is not incremental; to
actually perform the search, the user must hit C-s after entering the regexp.
There is also no reverse regular expression search. Other than C-r, and the
incremental aspect, regular expression searching has the same keybindings as
regular searching.

Search:	Regexp:	C-M-s

All of these options are available from the Search menu. Of course some of them
will be inactive depending on whether a search is in progress.


Query Replace: replacebind.tcl
------------------------------

This module implements global replace and query replace functionality in Beth.
It adds no bindings to the text widget, it merely extends the bindings of the
incremental search facility.

When the cursor is in the search entry (and thus has the special search
bindings), some extra bindings are added: One can enter replace mode by hitting
C-c. One can also use C-C, this also enters replace mode, but uses the previous
string; this is useful for doing the same search/replace in a variety of
sections in the text.

		New	Old
Change:		C-c	C-C

Entering replace mode brings up a new label named "Change to" and an entry with
the current replacement string (which would be empty if you used C-c). The
Escape key lets you toggle between this entry and the search entry and the text
widget. You can exit both search and replace with C-g or Return.

To change the current instance of the search string (that is, the instance
highlighted with the search tag), press C-c. It makes the change and moves on to
the next instance (or complains if there is none). Using C-c in conjunction with
C-s and C-r, you have the full functionality of a query replace system. You can
use query-replace with incremental search in both directions and with regular
expression search. Finally, you can issue a global replace with C-C. It replaces
all future instances of the search string with the replace string and destroys
the search and replace widgets. Note that this does not change all
occurrences...just the ones between the inseartion cursor and the end of text
(or beginning, if the current search direction is reverse).

Change:	Search	Again:	Forward:	C-s Find
			Reverse:	C-r S-Find
	This one:			C-c
	All:				C-C
	Exit:				Return C-g

Exiting replace mode automatically exits the search mode as well, and informs
you how many occurrences were replaced.

All of these options are available under the Search menu. They will all be
inactive if no search is in progress, and only some will be active depending on
the state of search/replace going on.


Multiple Beth Interpreters: interpbind.tcl
------------------------------------------

Each interpreter maintains a list of currently active interpreters, and can
interact with them via the send command. Upon startup, any new interpreters
reevaluate the active interpreter list, including themselves, and they update
all the interpreters accordingly. Also when any interpreter quits, it notifies
the other interpreters. This ensures that interps keep track of each other, and
every interpreter has the same knowledge of active interpreters.

Any interpreter that quits while in control gives control to the next
non-iconified interpreter on the list, if there is one. This way you don't lose
control by quitting or iconifying an interpreter.

The following functions can be used to traverse through all non-iconified
interpreters. M-n switches control from the current interp to the next one on
the list. If the end of the list is reached, it continues searching from the top
of the list. M-p is similar, except it searches backwards through the list.
Also, there is M-N and M-P, which work similarly, except they traverse through
iconified windows as well, deiconifying any window they land on.

		All	Shown
Switch:	Next:	M-N	M-n
	Prev:	M-P	M-p

Finally, there is a function, M-C-b, which lets you identify the interp to
switch to. It brings up an entry where you specify the interp to switch to, then
it goes to that interp. You can specify a Beth interp by entering the contents
of its titlebar. Pressing Tab will attempt completion of the title name. The
buffer you switch to will be deiconified if necessary and raised, and receives
control.

Switch:	To:	M-C-b

Under some circumstances, it is possible for an interpreter to not be included
on every interpreter's list. If an interpreter has an incomplete list of
interpreters, you can fix this by issuing the wish command
refresh_interpreter_list. (You can find out any interpreter's list of
interpreters implicitly by pressing M-C-b and then Tab.)

These options are all available off the Interpreter menu.


Key Bindings: keybind.tcl
-------------------------

This module performs some operations dealing with the current keybindings. It
provides two main functions.

The first one is a universal-argument function, bound to C-u. It provides the
ability to iterate through a key many times. Pressing C-u brings up an entry
window which takes the iteration number. This entry accepts number keys, and
reacts in the usual entry fashion for Escape (toggle text/entry) and C-g
(destroy entry) However, any key other than Escape, C-g, or a number key is
considered the iteration key, and the function associated with that key is
iterated as many times as was specified in the entry. If the entry was blank,
the key is executed 10 times by default. One can use C-u in conjunction with
many other key functions. For example, the sequence "C-u 20 C-n" goes down 20
lines, the sequence "C-u 5 C-[" shrinks the window by 5 lines, and the sequence
"C-u Return" inserts 10 carridge returns.

Universal Argument:	C-u

The other feature provided is a function to send keybindings to a set of
currently active Beth interpreters, so pressing a single key in one interpreter
executes the appropriate function in each beth interpreter. (Keep in mind that
each interpreter may have a different function associated to a key, for example,
sending M-s to every interpreter will cause those in browse mode to beep, since
they don't have a binding for M-s, but those in edit mode will save their
contents. There are two bindings to this 'all' function: M-k, which elects to
send the next key to all interpreters that are not currently iconified, and M-K
which sends the next key to all interpreters. When M-k or M-K is pressed, a
label marked "All" is pressed to indicate the next key is going to many
interpreters. Once the key is pressed, the 'all' mode terminates.

All:		M-K
	Shown:	M-k

Pressing M-k in 'All' mode again causes 'All' mode to become permanent, in which
case every keybinding is sent to each interpreter, until the next occurrence of
Escape. Some example sequences are: "M-K M-s" saves every interpreter's
contents, "M-k M-<" goes to the beginning of each interpreter's contents, "M-k
M-I" iconifies each deiconified interpreter, "M-k Esc C-s foo" brings up the
next instance of "foo" in every shown interpreter, and "M-K M-q" causes each
interpreter to quit.

During All mode the cursor will stay in the All entry, however the old focus
will be remembered, and keybindings and menu options will be sent to the old
focus, as well as any other interpreters involved. One can still switch between
Text and Entries with Escape. If the cursor should fall out of the All entry,
then keys will not execute in all interpreters, however, pressing Escape will
bring the cursor back into the All entry and things should work properly.

You can have more than one interpreter in All mode, however any keybinding
executed in All mode destroys All mode for each window except the one the
keybinding originated in.

All of the functions here are contained in the Extras menu. Remember that you
can use a keypress or any menuoption with a keybinding as a parameter of
universal-argument or all-interps. Universal-argument and all-interps will not
recognize a menu option with no keybinding, or the quit button, they will
execute the same way they always do. Also note that the menu options for All are
slightly different than the keybindings, they perform the same functions, but
not in the same protocol.


Text Bindings: lib/textbind.tcl
-------------------------------

This module implements some text functions, and sets the text widget to
word-wrap mode. Normally typing beyond the end of the right edge merely moves
the cursor to the next line on the left column (though to the text widget it's
still one line of text), and cares not if it has broken a word across the edge.
With word-wrap mode on, it will move the entire word to the next line. (See
text(n) for details on wrap mode.)

Note that lines to the text widget are not quite like lines to the user. To the
text widget, a line is a sequence of chars separated by a newline, but the user
sees an array of columns and rows. Line commands like C-n and C-p are
interpreted by the text widget's concept of lines. Thus if you type a multi-line
paragraph with no newlines, the text widget considers this as one line, and C-n
and C-p (and other line functions) will behave slightly different than
expected.

Two functions exist to alleviate this problem, however. The Return key, in
addition to entering a newline, will break up the line into several if it is
longer than the window's width. This should not visibly change the text, but it
fixes the behavior of line functions like C-n and C-p.

The other extreme is when many short lines appear in the text. Normally you want
paragraph lines to take up the entire width of the window, and splitting up long
lines via the Return key accomplishes this for lines that are too long, but
lines that are too short are another problem, and operations such as adding
newlines, or changing the window width can exacerbate this problem. Therefore
there is a function, bound to M-j, which adjusts the currently selected text so
it takes up the width of the window and contains no wraps. M-j does this by
first removing all newlines from the selection, and then splitting the selection
up into lines of the appropriate length. M-j operates on the selected region, or
on the current paragraph if no text is selected.

Several functions for paragraph selection and traversal are provided. A
paragraph is any range of text bounded by two newlines (or the beginning/end of
text). One can select the current paragraph with C-j. M-a moves to the beginning
of the current paragraph, and M-e goes to the end. Finally you can create a new
paragraph with S-Return, it simply adds two newlines.

				Meta-
Paragraph:	Traversal:	a - e
		Select:		C-j
		Adjust:		M-j
		Split:		S-Return

The indentation function C-i is also slightly changed. It works the same way as
before, but if no region is selected, C-i will indent the current paragraph.
Also it adjusts the paragraph to a shorter width before indenting, so no lines
wrap.

This module is only loaded when the startup file is a text document. Your .beth
file can indicate when to load textbind.tcl, or you can load it upon startup, by
typing "beth -l textbind.tcl ...". One can also load this file in an existing
Beth interpreter by executing the wish command (C-M-w) and typing
'$add_text_bindings" (and then tabbing to get the variable's value, which is a
command to load the text module.)

The paragraph traversal and selection functions are appropiately added in the
Browse menu hierarchy, and the paragraph splitting and reformatting functions
are added to the Edit menu. There is also a "Load Text Module" option under the
Extras menu that will load the text bindings; it's active only if the text
bindings are not loaded.


Parentheses Balancing: lib/balancebind.tcl
------------------------------------------

This module implements balancing of parenthesis, brackets, and braces. It adds
no new keybindings or widgets to the screen, but, when loaded, it adds to the
bindings of the close paren, bracket, and brace a balancing routine. This
balancing routine ensures there is an open partner to the one just entered, and
highlights it if it exists, otherwise it complains about an imbalance. If a
partner exists, it then checks the region between the insertion cursor and the
partner to make sure things are internally consistent. It counts the number of {
and }'s for example, and complains if they are unequal.

In browse mode, this module will indicate the partner of a right paren, bracket,
or brace, w/o inserting the new character.

The Find option under the Extras menu contains a submenu of partners to look
for, each of which is equivalent to pressing }, ), or ].


Module Adding: lib/sendfile.tcl
-------------------------------

The sendfile.tcl module is useful to modify Beth interps while they are
running. It takes two command-line arguments, the name of the interpreter to
send to, and the file to send. In this way, for example, you could add the
text bindings to an interpreter that did not originally load them. The name of
the interpreter is displayed in the interpreter entry widget.


Protecting Text: lib/preventbind.tcl
------------------------------------

This module adds no keybindings or options to Beth, it is mainly for application
programs that wish to enbed Beth. It provides tag bindings to protect text under
3 circumstances: select, move, and edit. The three functions most useful are:

	prevent_select_bind tag

Called with the tag name, this procedure rebinds events so that it becomes
impossible to select part of any text with the associated tag. It is still
possible to select entire ranges of text with the tag, but not a part of the
text, nor the characters immediately before and after a range of tagged text.
Assumes every tag range begins at a line beginning. For example, the rmth
program uses this routine to prevent selection over each prompt.

	prevent_move_bind tag

Called with the tag name, this procedure rebinds events so that it becomes
impossible to place the insert cursor inside a range of tagged text. including
the preceding and ending (untagged) characters. Most keys that would leave the
cursor in the tag range instead leave the cursor after the tagged text. A few,
such as C-b (back one char) put the cursor before the tagged text, so the tag
doesn't act as a barrier. Assumes every tag range begins at a line beginning. As
an example, the rmth program uses this routine to prevent traversal over each
prompt.

	prevent_edit_bind tag

Called with the tag name, this procedure rebinds events so that it becomes
impossible to edit text with the tag, which includes, as usual, the preceding
and ending untagged characters. Attempts to edit tagged text result in a beep.
The rmth program, for example, uses this procedure to prevent all text, except
the current command, from being changed.


Dialogs: dialog.tcl
-------------------

This is basically the same as the Tk dialog widget, and it is used for Tk dialog
sessions and Tk error messages. In addition to Tk's binding of Return to select
the default button, you can press 1 to select the leftmost button, 2 for the
next leftmost, 3 for the next, etc. There is also a dialog widget that provides
a list of options, along with an 'OK' button. You can press OK automatically by
hitting <Return> or 1, or, using the mouse, you can select an option in the
listbox.


Startup: beth.tcl
------------------

beth.tcl is the calling program. You can install Beth by copying or symlinking
this file to your favorite bin directory.

Beth takes any number of command-line arguments. Arguments are divided into two
types, options and configs. For each option, Beth starts a new interpreter, the
option signifies what to load into that interpreter. Each config modifies the
Beth interpreters for the options that follow it. For example, typing:

	beth alpha -b beta -i gamma &

is equivalent to typing:

	beth alpha &
	beth -b beta &
	beth -b -i gamma &

Each option indicates some material to put in th e text widget of a Beth
interpreter. The following are valid options:

	0	Nothing is loaded. Useful if Beth is embedded in another program

	X	The X Selection is copied.

	file	The contents of the file indicated by pathname. If this file
does not exist, the text widget is left blank, but the file is remembered as a
new file, so saves automatically go to that file. The first save will create the
new file.

	-	Standard input. This is useful to put Beth at the end of a pipe.
		(Example: ls -l | beth.tcl -)

	=	Standard input, gradual, for those long commands.
		(Example: make all |& beth =)

	|cmd	Output of exec-ing cmd, just like reading an I/O pipeline.
		(Your shell may require you to place this in quotes.)

	|cmd&	Gradual output of exec-ing cmd.
		(Again, your shell will most likely want this in quotes.)

If no option is supplied when Beth is called interactively, Beth prints out a
quick description of its calling syntax. If Beth is embedded, and the option
variable is left blank or undefined, Beth will not try to fill the text widget
with anything.

Each config indicates some modification to future options. The following are
valid configs:

	-c Causes Beth to seize control upon startup.

 	-i Causes Beth to start up iconified. This option overrides -c.

 	-b Browse mode only, no editing provided. With this option, Beth starts
up in Browse mode. This mode only contains the functions from browsebind.tcl,
windowbind.tcl, interpbind.tcl, keybind,tcl, searchbind.tcl and entrybind.tcl,
none of which allow modification. Browse mode is useful for quick perusal of
files. Without this option, Beth also loads the filebind.tcl, replacebind.tcl,
and editbind.tcl modules.

	-t Title	Adds the next word to Beth's window & icon title.
If more than one -t is specified, all the -t titles are concatenated and put
into the title, before Beth's usual stuff.

	-l Module	Sources the module, which must live either in the
current working directory or Beth's directory. May also be specified multiple
times to load many modules.

	-w configs	The configs are passed on to the creation of the text
widget. Thus, for example, one could specify the size of the text widget by:

beth -w "-height 4 -width 40" ...

Of course, one can use the -geometry option (implicitly provided by wish) to
dictate the initial starting location of the Beth window. See the text(n)
manpage for possible text configurations.


User Configuration beth.config.tcl
----------------------------------

The startup file checks for the existance of a .beth file in the user's HOME
directory, and if it exists, sources it. It also checks for a .beth file in the
current directory and sources it too, if it exists. This enables the user to
customize Beth to his needs. For example, the user may specify when to load
various other modules, such as textbind.tcl. A sample config file, called
beth.config.tcl is included...to use it, just copy it to $HOME/.beth. 

The beth.config file adds the following keybindings (which could be changed in
the user's .beth file):

Add:	Text Module:	M-C-t
	Balance Module:	M-0

The following variables are set by beth, but may be useful to the user for
reference or modification:

	beth_dir /afs/ece/usr/svoboda/src/beth

Location of Beth source code.

	config_file ".beth"
	config_dir1 $env(HOME)
	config_dir2 [pwd]

Locations for finding Beth's config files. Beth first tries to source
$config_dir1/$config_file, and then $config_dir2/$config_file.

	default_tmpfile "/tmp/beth.output"

A temporary file Beth will use for scratchwork.

	beth_exec "beth"

The shell command to invoke beth. (You need to have beth.tcl copied or symlinked
to a file called 'beth' in your path for this to work)

	option [lindex $argv [incr argc -1]]

This is an option (there is only one per Beth interpreter). If Beth is embedded
in another program, this variable may be set to a null string, in which case
Beth does not fill the text widget with anything.

	configs [lrange $argv 0 [incr argc -1]]

This is set to all command-line arguments but the last one, and will generally
be any switches Beth was called with (-b, -i, etc). A program embedding Beth can
set these switches to modify Beth's startup behavior.

	edit_flag

When set to 0, only browsing is possible, when set to 1, editing is also
possible.

	modified 0

Set when file is modified.

	undo_data {}
	max_undos -1
	max_undo_label 30

Undo material. Undo_data contains the log of undos. Max_undos specifies a limit
on the size of undo_data, when -1 there is no limit. Max_undo_label specifies
the maximum length of the string displayed by M-C-l.

	flash_time 3000

Length of time (in ms) labels are displayed.

	label_abbrev "-"

Replaces contents of labels upon a press by Button1. (This only affects
permanent labels)

	fsBox(path)
	fsBox(name)

Set to the path and name of the file being edited. If the current option is
stdin, the X selection, or an I/O pipeline, the path is set to the current
working directory. The name is set to the I/O pipeline command. If the current
option is stdin or the X selection, the name is blank.

	file_prompter

The routine used to prompt for a file. If unset, Beth uses its own file
prompter. The sample beth.config.tcl file shows how to use FSBox for file
selection.

	confirm_save_msg " has been modified. Do you want to save it first?"
	save_msg "Select a file to save"
	read_msg "Select a file to read"

You'll see these after pressing M-[RrSs].

	mutual_edit_conflict_msg " is being editied by another interpreter.
 What should I do?"

When a Beth interp tries to edit a file another Beth interp is already editing,
you'll see this message. Used to ensure mutually exclusive editing.

	default_universal_number 10

The default number of times a command gets executed by universal-argument, if a
numerical parameter is not specified.

	replace_msg "Change to: "
	search_msg "Search: "
	reverse_search_msg "Reverse Search: "
	search_failed_msg "Search failed: "
	reverse_search_failed_msg "Reverse Search failed: "
	regexp_msg "Regexp Search: "
	regexp_failed_msg "Regexp Search Failed: "

You'll see these message during Search and Replace operations.

	balance_list {{\( \) parenright} {\[ \] bracketright} {\{ \} braceright}}

This list is used by balancebind.tcl to know what pairs to associate with each
other.

	wish_cmd ""
	shell_cmd ""
	make_cmd {$beth_exec -b "| make |& cat &" &}
	print_cmd "| lpr -m -p -T [lindex [wm title .] 1]"
	browse_cmd "| $beth_exec - &"
	help_cmd "$beth_exec -b $beth_dir/HELP &"

The default commands for M-C-w (wish command), and for M-C-e (exec command). The
make command brings up a new Beth interpreter that gradually reads in the output
of a make command (including any warning messages a compiler may generate). The
print command takes part or all of the text and passes it to lpr. The browse_cmd
, bound to M-C-x, brings up a new Beth interpreter on the standard input, which
is part or all of the current text. Finally, the help command brings up a Beth
interpreter to browse this file.

	embedded

If you wish to embed Beth in another app, define this variable. (Beth will exit
if called with no arguments, unless this variable is defined).

	frame .frame

The widget path of the frame that messages and entries get posted to. If already
defined before Beth starts, Beth does not create a frame widget.

	text .ts.text

The text widget. If already defined before Beth starts, Beth does not create a text widget or a scrollbar.

	menu .menu
	grid_x .grid
	grid_y .ts.grid

The menubar, and grid widgets (which don't exist unless the grid is active)

	quit_hook

Beth executes this code upon quitting, if it is defined. (If Beth is embedded in
another program, that program should call the quit_beth procedure (no args) to
quit, and set this hook to its own quit routines.)

	dont_make_quit_button

If already defined before Beth starts, Beth does not put up a QUIT button in the
frame. (Beth can still be exited via C-q)

	dont_make_menubar

If already defined before Beth starts, Beth does not make a menubar.

	dont_change_title

If already defined before Beth starts, Beth does not change the window title
upon startup.

	grid_width 4

The width of the vertical grid, it currently displays 4 digits. You might want
to change this if your line numbers exceed 9999.

	text_nowrap_on_grid 1

If set to 1, when the y grid is turned on, the text widget no longer displays
long logical lines on multiple physical lines, which means that every line
number in the y grid is accurate. After the grid disappears, the wrapping goes
back to normal.


Maintainer
----------
David Svoboda	svoboda@ece.cmu.edu
