NAME
acme, win, awd – interactive text windows |
SYNOPSIS
acme [ –ab ] [ –c ncol ] [ –f varfont ] [ –F fixfont ] [ –l loadfile
| file ... ] win [ command ]
awd [ label ] |
DESCRIPTION
Acme manages windows of text that may be edited interactively
or by external programs. The interactive interface uses the keyboard
and mouse; external programs use a set of files served by acme;
these are discussed in acme(4). Any named files are read into acme windows before acme accepts input. With the –l option, the state of the entire system is loaded from loadfile, which should have been created by a Dump command (q.v.), and subsequent file names are ignored. Plain files display as text; directories display as columnated lists of the names of their components, as in ls –p directory|mc except that the names of subdirectories have a slash appended. The –f (–F) option sets the main font, usually variable–pitch (alternate, usually fixed–pitch); the default is /lib/font/bit/lucidasans/euro.8.font (.../lucm/unicode.9.font). Tab intervals are set to the width of 4 (or the value of $tabstop) numeral zeros in the appropriate font.
Windows
If a window holds a directory, the name (first word of the tag)
will end with a slash. Scrolling Layout
Tags exist at the top of each column and across the whole display.
Acme pre–loads them with useful commands. Also, the tag across
the top maintains a list of executing long–running commands. Typing Most text, including the names of windows, may be edited uniformly. The only exception is that the command names to the left of the bar in a tag are maintained automatically; changes to them are repaired by acme.
When a window is in autoindent mode (see the Indent command below)
and a newline character is typed, acme copies leading white space
on the current line to the new line. The option –a causes each
window to start in autoindent mode. Directory context Errors Mouse button 1 Mouse button 2
Some commands, all by convention starting with a capital letter,
are built–ins that are executed directly by acme:
EditTreat the argument as a text editing command in the style of sam(1). The full Sam language is implemented except for the commands k, n, q, and !. The = command is slightly different: it includes the file name and gives only the line address unless the command is explicitly =#. The `current window' for the
FontWith no arguments, change the font of the associated window from fixed–spaced to proportional–spaced or vice versa. Given a file name argument, change the font of the window to that stored in the named file. If the file name argument is prefixed by var (fix), also set the default proportional–spaced
ID Print window ID number (q.v.). InclWhen opening `include' files (those enclosed in <>) with button 3, acme searches in directories /$objtype/include and /sys/include. Incl adds its arguments to a supplementary list of include directories, analogous to the –I option to the compilers. This list is per–window and is inherited when
LoadRestore the state of acme from a file (default $home/acme.dump) created by the Dump command. Local
New Make new window. With arguments, load the named files into windows. Newcol
Putall
SendAppend selected text or snarf buffer to end of body; used mainly with win. Snarf
Tab Set the width of tab stops for this window to the value of the argument, in units of widths of the zero character. With no arguments, it prints the current value. UndoUndo last textual change or set of changes. Zerox
If the text indicated with button 2 is not a recognized built–in,
it is executed as a shell command. For example, indicating date
with button 2 runs date(1). The standard and error outputs of
commands are sent to the error window associated with the directory
from which the command was run, which will be created if
necessary. For example, in a window /adm/users executing pwd will
produce the output /adm in a (possibly newly–created) window labeled
/adm/+Errors; in a window containing /sys/src/cmd/sam/sam.c executing
mk will run mk(1) in /sys/src/cmd/sam, producing output in a window
labeled
/sys/src/cmd/sam/+Errors. The environment of such commands contains
the variable $% with value set to the filename of the window in
which the command is run, and $winid set to the window's id number
(see acme(4)). Mouse button 3 If the text names an existing window, acme moves the mouse cursor to the selected text in the body of that window. If the text names an existing file with no associated window, acme loads the file into a new window and moves the mouse there. If the text is a file name contained in angle brackets, acme loads the indicated include file from the directory appropriate to the suffix of the file name of the window holding the text. (The Incl command adds directories to the standard list.) If the text begins with a colon, it is taken to be an address, in the style of sam(1), within the body of the window containing the text. The address is evaluated, the resulting text highlighted, and the mouse moved to it. Thus, in acme, one must type :/regexp or :127 not just /regexp or 127. (There is an easier way to locate literal text; see below.) If the text is a file name followed by a colon and an address, acme loads the file and evaluates the address. For example, clicking button 3 anywhere in the text file.c:27 will open file.c, select line 27, and put the mouse at the beginning of the line. The rules about Error files, directories, and so on all combine to make this an efficient way to investigate errors from compilers, etc. If the text is not an address or file, it is taken to be literal text, which is then searched for in the body of the window in which button 3 was clicked. If a match is found, it is selected and the mouse is moved there. Thus, to search for occurrences of a word in a file, just click button 3 on the word. Because of the rule of using the selection as the button 3 action, subsequent clicks will find subsequent occurrences without moving the mouse.
In all these actions, the mouse motion is not done if the text
is a null string within a non–null selected string in the tag,
so that (for example) complex regular expressions may be selected
and applied repeatedly to the body by just clicking button 3 over
them. Chords of mouse buttons Commands may be given extra arguments by a mouse chord with buttons 2 and 1. While holding down button 2 on text to be executed as a command, clicking button 1 appends the text last pointed to by button 1 as a distinct final argument. For example, to search for literal text one may execute Look text with button 2 or instead point at text with button 1 in any window, release button 1, then execute Look, clicking button 1 while 2 is held down.
When an external command (e.g. echo(1)) is executed this way,
the extra argument is passed as expected and an environment variable
$acmeaddr is created that holds, in the form interpreted by button
3, the fully–qualified address of the extra argument. Support programs
Awd loads the tag line of its window with the directory in which
it's running, suffixed –label (default rc); it is intended to be
executed by a cd function for use in win windows. An example definition
is
Applications and guide files
Whenever a command is executed by acme, the default search path
includes the directory of the window containing the command and
its subdirectory $cputype. The program directories in /acme contain
appropriately labeled subdirectories of binaries, so commands
named in the guide files will be found
automatically when run. Also, acme binds the directories /acme/bin
and /acme/bin/$cputype to the beginning of /bin when it starts;
this is where acme–specific programs such as win and awd reside. |
FILES
$home/acme.dump default file for Dump and Load; also where state
is written if acme dies or is killed unexpectedly, e.g. by deleting
its window. /acme/*/guide template files for applications /acme/*/readme informal documentation for applications /acme/*/src source for applications /acme/*/mips MIPS–specific binaries for applications |
SOURCE
/sys/src/cmd/acme /acme/bin/source/win /sys/src/cmd/awd.c |
SEE ALSO
acme(4) Rob Pike, Acme: A User Interface for Programmers. |
BUGS
With the –l option or Load command, the recreation of windows under
control of external programs such as win is just to rerun the
command; information may be lost. |