ref: ec35f468e0eba87c9f09cbbe5fa8af2591e6f914
dir: /man/1/acme/
.TH ACME 1 .SH NAME acme, win \- interactive text windows .SH SYNOPSIS .B acme [ .B -f .I varfont ] [ .B -F .I fixfont ] [ .B -c .I ncol ] [ .B -b ] [ .B -l .I file | .I file \&... ] .LP .B win [ .I command ] .SH DESCRIPTION .I 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 .IR acme ; these are discussed in .IR acme (4). .PP Any named .I files are read into .I acme windows before .I acme accepts input. With the .B -l option, the state of the entire system is loaded from .IR file , which should have been created by a .B Dump command (q.v.), and subsequent .I file names are ignored. Plain files display as text; directories display as columnated lists of the names of their components with the names of subdirectories having a slash appended. .PP The .B -f .RB ( -F ) option sets the default variable-pitch (fixed-pitch) font; the default is .B /fonts/lucidasans/euro.8.font .RB ( \&.../lucm/unicode.9.font ). Tab intervals are set to the width of 4 numeral zeros in the variable-pitch font. .PP .SS Windows .I Acme windows are in two parts: a one-line .I tag above a multi-line .IR body . The body typically contains an image of a file or the output of a program. The tag contains a number of blank-separated words, followed by a vertical bar character, followed by anything. The first word is the name of the window, typically the name of the associated file or directory, and the other words are commands available in that window. Any text may be added after the bar; examples are strings to search for or commands to execute in that window. Changes to the text left of the bar will be ignored, unless the result is to change the name of the window. .PP If a window holds a directory, the name (first word of the tag) will end with a slash. .SS Scrolling Each window has a scroll bar to the left of the body. Scrolling occurs when the button is pressed, rather than released, and continues as long as the mouse button is held down in the scroll bar. For example, to scroll slowly through a file, hold button 3 down near the top of the scroll bar. Moving the mouse down the scroll bar speeds up the rate of scrolling. Scrolling backwards is performed similarly using button 1. Button 2 allows absolute movement within the text; clicking it at different heights within the scroll bar changes the focused text without intermediate scrolling. .SS Layout .I Acme windows are arranged in columns. By default, it creates two columns when starting; this can be overridden with the .B -c option. Placement is automatic but may be adjusted using the .I layout box in the upper left corner of each window and column. Pressing and holding any mouse button in the box drags the associated window or column. For windows, just clicking in the layout box grows the window in place: button 1 grows it a little, button 2 grows it as much as it can, still leaving all other tags in that column visible, and button 3 takes over the column completely, temporarily hiding other windows in the column. (They will return .I en masse if any of them needs attention.) The layout box in a window is normally white; when it is black in the center, it records that the file is `dirty': .I Acme believes it is modified from its original contents. .PP Tags exist at the top of each column and across the whole display. .I Acme pre-loads them with useful commands. Also, the tag across the top maintains a list of executing long-running commands. .SS Typing The behaviour of typed text is as one would expect except that the characters are delivered to the tag or body under the mouse; there is no `click to type'. (The experimental option .B -b causes typing to go to the most recently clicked-at or made window.) The usual backspacing conventions apply. The ESC key selects the text typed since the last mouse action, a feature particularly useful when executing commands. A side effect is that typing ESC with text already selected is identical to a .B Cut command .RI ( q.v. ). .PP 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 .IR acme . .SS "Directory context Each window's tag names a directory: explicitly if the window holds a directory; implicitly if it holds a regular file (e.g. the directory .B /module if the window holds .BR /module/sys.m ). This directory provides a .I context for interpreting file names in that window. For example, the string .B sys.m in a window labelled .B /module/ or .B /module/draw.m will be interpreted as the file name .BR /module/sys.m . The directory is defined purely textually, so it can be a non-existent directory or a real directory associated with a non-existent file (e.g. .BR /module/not-a-file ). File names beginning with a slash are assumed to be absolute file names. .SS Errors Windows whose names begin with .B - or .B + conventionally hold diagnostics and other data not directly associated with files. A window labelled .B +Errors receives all diagnostics produced by .I acme itself. Diagnostics from commands run by .I acme appear in a window named .IB directory /+Errors where .I directory is identified by the context of the command. These error windows are created when needed. .SS "Mouse button 1 Mouse button 1 selects text and double-clicking highlights the text for replacement text to be typed in. .PP Button 1 is also useful for matching symbols. For example to match curly brackets in some limbo source, double click button 1 immediately after the open curly bracket. The whole of the text up to any matching end curly bracket will be highlighted. A similar match is made if the double click is performed immediately before the end bracket. In all, .I acme will match the pairs { and }, [ and ], ( and ), < and >, « and », ' and ', " and ", ` and `. Also whole lines of text may be highlighted by double clicking at the beginning or end of the line. .SS "Mouse button 2 By an action similar to selecting text with button 1, button 2 indicates text to execute as a command. If the indicated text has multiple white-space-separated words, the first is the command name and the second and subsequent are its arguments. If button 2 is `clicked'\(emindicates a null string\(em\c .I acme .I expands the indicated text to find a command to run: if the click is within button-1-selected text, .I acme takes that selection as the command; otherwise it takes the largest string of valid file name characters containing the click. Valid file name characters are alphanumerics and .B _ .B . .B - .B + .BR / . This behaviour is similar to double-clicking with button 1 but, because a null command is meaningless, only a single click is required. .PP Some commands, all by convention starting with a capital letter, are .I built-ins that are executed directly by .IR acme : .TF "Lineno\ \ " .PD .TP .B Cut Delete most recently selected text and place in snarf buffer. .TP .B Del Delete window. If window is dirty, instead print a warning; a second .B Del will succeed. .TP .B Delcol Delete column and all its windows, after checking that windows are not dirty. .TP .B Delete Delete window without checking for dirtiness. .TP .B Dump Write the state of .I acme to the file name, if specified, or .B $home/acme.dump by default. .TP .B Edit Treat the argument as a text editing command in the style of Plan9's .IR sam. The full .B Sam language is implemented except for the commands .BR k , .BR n , .BR q , and .BR ! . The .B = command is slightly different: it includes the file name and gives only the line address unless the command is explicitly .BR =# . The `current window' for the command is the body of the window in which the .B Edit command is executed. Usually the .B Edit command would be typed in a tag; longer commands may be prepared in a scratch window and executed, with .B Edit itself in the current window, using the 2-1 chord described below. See the later section on editing for a full description of the commands available here. .TP .B Exit Exit .I acme after checking that windows are not dirty. .TP .B Font With no arguments, change the font of the associated window from fixed-spaced to proportional-spaced or .I vice versa\f1. 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 .B var .RB ( fix ), also set the default proportional-spaced (fixed-spaced) font for future use to that font. Other existing windows are unaffected. .TP .B Get Load file into window, replacing previous contents (after checking for dirtiness as in .BR Del ). With no argument, use the existing file name of the window. Given an argument, use that file but do not change the window's file name. .TP .B ID Print window ID number .RI ( q.v. ). .TP .B Incl When opening `include' files with button 3, .I acme searches in the directories .B /module and .B /include . .B Incl adds its arguments to a supplementary list of include directories, analogous to the .B -I option to the compilers. This list is per-window and is inherited when windows are created by actions in that window, so .I Incl is most usefully applied to a directory containing relevant source. With no arguments, .I Incl prints the supplementary list. .TP .B Kill Send a .B kill note to .IR acme -initiated commands named as arguments. .TP .B Lineno Give the line number(s) of the currently selected text. .TP .B Load Restore the state of .I acme from a file (default .BR $home/acme.dump ) created by the .B Dump command. .TP .B Local When prefixed to a command run the command in the same file name space and environment variable group as .IR acme . The environment of the command is restricted but is sufficient to run .IR bind (1), .IR mount , etc., and to set environment variables. .TP .B Look Search in body for occurrence of literal text indicated by the argument or, if none is given, by the selected text in the body. .TP .B New Make new window. With arguments, load the named files into windows. .TP .B Newcol Make new column. .TP .B Paste Replace most recently selected text with contents of snarf buffer. .TP .B Put Write window to the named file. With no argument, write to the file named in the tag of the window. .TP .B Putall Write all dirty windows whose names indicate existing regular files. .TP .B Redo Complement of .BR Undo . .TP .B Send Append selected text or snarf buffer to end of body; used mainly with .IR win . .TP .B Snarf Place selected text in snarf buffer. .TP .B Sort Arrange the windows in the column from top to bottom in lexicographical order based on their names. .TP .B Undo Undo last textual change or set of changes. .TP .B Zerox Create a copy of the window containing most recently selected text. .PP A common place to store text for commands is in the tag; in fact .I acme maintains a set of commands appropriate to the state of the window to the left of the bar in the tag. .PP If the text indicated with button 2 is not a recognized built-in, it is executed as a shell command. For example, indicating .B date with button 2 runs .IR 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 .B /module/sys.m executing .B pwd will produce the output .B /module in a (possibly newly-created) window labelled .BR /adm/+Errors ; in a window containing .B /appl/cmd/date.b executing .B "limbo date.b" will run .IR limbo (1) in .BR /appl/cmd , producing output in a window labelled .BR /appl/cmd/+Errors . .SS "Mouse button 3 Pointing at text with button 3 instructs .I acme to locate or acquire the file, string, etc. described by the indicated text and its context. This description follows the actions taken when button 3 is released after sweeping out some text. In the description, .I text refers to the text of the original sweep or, if it was null, the result of applying the same expansion rules that apply to button 2 actions. .PP If the text names an existing window, .I 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, .I acme loads the file into a new window and moves the mouse there. If the text is a file name contained in double quotes, .I acme loads the indicated include file from the directory appropriate to the suffix of the file name of the window holding the text. (The .B Incl command adds directories to the standard list.) .PP If the text begins with a colon, it is taken to be an address 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 .IR acme , one must type .B :/regexp or .B :127 not just .B /regexp or .BR 127 . (There is an easier way to locate literal text; see below.) .PP If the text is a file name followed by a colon and an address, .I acme loads the file and evaluates the address. For example, clicking button 3 anywhere in the text .B file.c:27 will open .BR 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. .PP 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. .PP 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. .SS "Chords of mouse buttons Several operations are bound to multiple-button actions. After selecting text, with button 1 still down, pressing button 2 executes .B Cut and button 3 executes .BR Paste . After clicking one button, the other undoes the first; thus (while holding down button 1) 2 followed by 3 is a .B Snarf that leaves the file undirtied; 3 followed by 2 is a no-op. These actions also apply to text selected by double-clicking because the double-click expansion is made when the second click starts, not when it ends. .PP Thus to copy a word a number of times, double click on the word with button 1 to highlight it leaving button 1 down, press and release button 2 to cut it and save it in the snarf buffer, press and release button 3 to paste it back and then release button 1. Now move the cursor to any selected place in the text, press button 1 down, then button 3 and the word is copied in. .PP Similarly lines may be deleted by double clicking at the beginning or end of the line and then pressing button 2 with button 1 still down. .PP 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 .B text one may execute .B Look text with button 2 or instead point at .B text with button 1 in any window, release button 1, then execute .BR Look , clicking button 1 while 2 is held down. .PP When an external command (e.g. .IR echo (1)) is executed this way, the extra argument is passed as expected and an environment variable .B $acmeaddr is created that holds, in the form interpreted by button 3, the fully-qualified address of the extra argument. .SS "Support programs .I win creates a new .I acme window and runs a .I command (default .BR /dis/sh.dis ) in it, turning the window into a shell window in which commands may be executed. Executing text in a .I win window with button 2 is similar to using .BR Send . .PP Similarly .I winm creates a new window but runs the shell .BR /dis/mash.dis by default. .I adiff behaves as diff in finding the difference between two files but the listing uses filename:linenumber format to allow the user to simply click on this to be sent to that line in the file. .I agrep does for grep what adiff does for diff above. .I cd changes directory but when used in a win window for example, sends information to the window to display a new heading reflecting the new directory. .SS "Mail" In the directory .B /acme/mail there are two mail programs that may be used under acme. These .I Mail and .I Mailpop3 can be run to display the user's current mail, read the mail, reply to mail, save or delete mail, send mail and write the user's mail box. .PP The former expects the user's mail box to be in the directory and file specified as its first argument, the latter uses the POP3 protocol to connect to a server for the user's mail and will prompt for a password when first run. Otherwise their behaviour is the same. .SS "Applications and guide files In the directory .B /acme live several subdirectories, each corresponding to a program or set of related programs that employ .I acme's user interface. Each subdirectory includes dis files and a .B readme file for further information. It also includes a .BR guide , a text file holding sample commands to invoke the programs. The idea is to find an example in the guide that best matches the job at hand, edit it to suit, and execute it. .PP Whenever a command is executed by .IR acme , the default search path includes the directory of the window containing the command. Also, .I acme binds the directory .B /acme/dis in front of .B /dis when it starts; this is where .IR acme -specific programs such as .I win reside. .SH EDITING This section explains the commands available when using acme's Edit command. .PP .SS Regular expressions Regular expressions are as in .IR regexp (6) with the addition of .BR \en to represent newlines. A regular expression may never contain a literal newline character. The empty regular expression stands for the last complete expression encountered. A regular expression matches the longest leftmost substring formally matched by the expression. Searching in the reverse direction is equivalent to searching backwards with the catenation operations reversed in the expression. .SS Addresses An address identifies a substring in a file. In the following, `character .IR n ' means the null string after the .IR n -th character in the file, with 1 the first character in the file. `Line .IR n ' means the .IR n -th match, starting at the beginning of the file, of the regular expression .LR .*\en? . All files always have a current substring, called dot, that is the default address. .SS Simple Addresses .PD0 .TP .BI # n The empty string after character .IR n ; .B #0 is the beginning of the file. .TP .I n Line .IR n ; .B 0 is the beginning of the file. .TP .BI / regexp / .PD0 .TP .BI ? regexp ? The substring that matches the regular expression, found by looking toward the end .RB ( / ) or beginning .RB ( ? ) of the file, and if necessary continuing the search from the other end to the starting point of the search. The matched substring may straddle the starting point. When entering a pattern containing a literal question mark for a backward search, the question mark should be specified as a member of a class. .PD .TP .B 0 The string before the first full line. This is not necessarily the null string; see .B + and .B - below. .TP .B $ The null string at the end of the file. .TP .B . Dot. .TP .B \&' The mark in the file. .TP \fL"regexp"\fP Preceding a simple address (default .BR . ), refers to the address evaluated in the unique file whose menu line matches the regular expression. .PD .SS Compound Addresses In the following, .I a1 and .I a2 are addresses. .TF a1+a2 .TP .IB a1 + a2 The address .I a2 evaluated starting at the end of .IR a1 . .TP .IB a1 - a2 The address .I a2 evaluated looking in the reverse direction starting at the beginning of .IR a1 . .TP .IB a1 , a2 The substring from the beginning of .I a1 to the end of .IR a2 . If .I a1 is missing, .B 0 is substituted. If .I a2 is missing, .B $ is substituted. .TP .IB a1 ; a2 Like .IB a1 , a2\f1, but with .I a2 evaluated at the end of, and dot set to, .IR a1 . .PD .PP The operators .B + and .B - are high precedence, while .B , and .B ; are low precedence. .PP In both .B + and .B - forms, if .I a2 is a line or character address with a missing number, the number defaults to 1. If .I a1 is missing, .L . is substituted. If both .I a1 and .I a2 are present and distinguishable, .B + may be elided. .I a2 may be a regular expression; if it is delimited by .LR ? 's, the effect of the .B + or .B - is reversed. .PP It is an error for a compound address to represent a malformed substring. Some useful idioms: .IB a1 +- (\f2a1-+\fP) selects the line containing the end (beginning) of a1. .BI 0/ regexp / locates the first match of the expression in the file. (The form .B 0;// sets dot unnecessarily.) .BI ./ regexp /// finds the second following occurrence of the expression, and .BI .,/ regexp / extends dot. .SS Commands In the following, text demarcated by slashes represents text delimited by any printable character except alphanumerics. Any number of trailing delimiters may be elided, with multiple elisions then representing null strings, but the first delimiter must always be present. In any delimited text, newline may not appear literally; .B \en may be typed for newline; and .B \e/ quotes the delimiter, here .LR / . Backslash is otherwise interpreted literally, except in .B s commands. .PP Most commands may be prefixed by an address to indicate their range of operation. Those that may not are marked with a .L * below. If a command takes an address and none is supplied, dot is used. The sole exception is the .B w command, which defaults to .BR 0,$ . In the description, `range' is used to represent whatever address is supplied. Many commands set the value of dot as a side effect. If so, it is always set to the `result' of the change: the empty string for a deletion, the new text for an insertion, etc. (but see the .B s and .B e commands). .br .ne 1.2i .SS Text commands .PD0 .TP .BI a/ text / .TP or .TP .B a .TP .I lines of text .TP .B . Insert the text into the file after the range. Set dot. .PD .TP .B c\fP .br .ns .TP .B i\fP Same as .BR a , but .B c replaces the text, while .B i inserts .I before the range. .TP .B d Delete the text in the range. Set dot. .TP .BI s/ regexp / text / Substitute .I text for the first match to the regular expression in the range. Set dot to the modified range. In .I text the character .B & stands for the string that matched the expression. Backslash behaves as usual unless followed by a digit: .BI \e d stands for the string that matched the subexpression begun by the .IR d -th left parenthesis. If .I s is followed immediately by a number .IR n , as in .BR s2/x/y/ , the .IR n -th match in the range is substituted. If the command is followed by a .BR g , as in .BR s/x/y/g , all matches in the range are substituted. .TP .BI m " a1 .br .ns .TP .BI t " a1 Move .RB ( m ) or copy .RB ( t ) the range to after .IR a1 . Set dot. .SS Display commands .PD 0 .TP .B p Print the text in the range. Set dot. .TP .B = Print the file name and line address of the range. .TP .B =# Print the file name and character address of the range. .PD .SS File commands .PD0 .TP .BI * " b " file-list Set the current file to the first file named in the list that .I acme has displayed. The list may be expressed .BI < "command" in which case the file names are taken as words (in the shell sense) generated by the command. .TP .BI * " B " file-list Same as .BR b , except that file names not displayed are entered there, and all file names in the list are examined. .TP .BI * " D " file-list Delete the named files from the menu. If no files are named, the current file is deleted. It is an error to .B D a modified file, but a subsequent .B D will delete such a file. .PD .SS I/O Commands .PD0 .TP .BI * " e " filename Replace the file by the contents of the named external file. Set dot to the beginning of the file. .TP .BI r " filename Replace the text in the range by the contents of the named external file. Set dot. .TP .BI w " filename Write the range (default .BR 0,$ ) to the named external file. .TP .BI * " f " filename Set the file name and print the resulting menu entry. .PP If the file name is absent from any of these, the current file name is used. .B e always sets the file name; .B r and .B w do so if the file has no name. .TP .BI < " command Replace the range by the standard output of the command. .TP .BI > " command Send the range to the standard input of the command. .TP .BI | " command Send the range to the standard input, and replace it by the standard output, of the command. .TP .BI * " cd " directory Change working directory. If no directory is specified, .B $home is used. .PD .PP In any of .BR < , .BR > , or .BR | , if the .I command is omitted the last .I command (of any type) is substituted. .SS Loops and Conditionals .PD0 .TP .BI x/ regexp / " command For each match of the regular expression in the range, run the command with dot set to the match. Set dot to the last match. If the regular expression and its slashes are omitted, .L /.*\en/ is assumed. Null string matches potentially occur before every character of the range and at the end of the range. .TP .BI y/ regexp / " command Like .BR x , but run the command for each substring that lies before, between, or after the matches that would be generated by .BR x . There is no default regular expression. Null substrings potentially occur before every character in the range. .TP .BI * " X/ regexp / " command For each file whose menu entry matches the regular expression, make that the current file and run the command. If the expression is omitted, the command is run in every file. .TP .BI * " Y/ regexp / " command Same as .BR X , but for files that do not match the regular expression, and the expression is required. .TP .BI g/ regexp / " command .br .ns .TP .BI v/ regexp / " command If the range contains .RB ( g ) or does not contain .RB ( v ) a match for the expression, set dot to the range and run the command. .PP These may be nested arbitrarily deeply, but only one instance of either .B X or .B Y may appear in a \%single command. An empty command in an .B x or .B y defaults to .BR p ; an empty command in .B X or .B Y defaults to .BR f . .B g and .B v do not have defaults. .PD .SS Miscellany .TF (empty) .TP .BI * " u " n Undo the last .I n (default 1) top-level commands that changed the contents or name of the current file, and any other file whose most recent change was simultaneous with the current file's change. Successive .BR u 's move further back in time. The only commands for which u is ineffective are .BR cd , .BR u , .B w and .BR D . If .I n is negative, .B u `redoes,' undoing the undo, going forwards in time again. .TP (empty) If the range is explicit, set dot to the range. If no address is specified (the command is a newline) dot is extended in either direction to line boundaries and printed. If dot is thereby unchanged, it is set to .B .+1 and printed. .PD .SS Grouping and multiple changes Commands may be grouped by enclosing them in braces .BR {} . Commands within the braces must appear on separate lines (no backslashes are required between commands). Semantically, an opening brace is like a command: it takes an (optional) address and sets dot for each sub-command. Commands within the braces are executed sequentially, but changes made by one command are not visible to other commands (see the next paragraph). Braces may be nested arbitrarily. .PP When a command makes a number of changes to a file, as in .BR x/re/c/text/ , the addresses of all changes to the file are computed in the original file. If the changes are in sequence, they are applied to the file. Successive insertions at the same address are catenated into a single insertion composed of the several insertions in the order applied. .SH FILES .TF /appl/acme/acme/*/src .TP .B $home/acme.dump default file for .B Dump and .BR Load ; also where state is written if .I acme dies unexpectedly. .TP .B /acme/*/guide template files for applications .TP .B /acme/*/readme informal documentation for applications .TP .B /appl/acme/acme/*/src source for applications .TP .B /acme/dis dis files for applications .SH SOURCE .B /appl/acme .br .B /appl/acme/acme/bin/src/win.b .SH SEE ALSO .IR acme (4) .br Rob Pike, .IR "Acme: A User Interface for Programmers" ", Volume 2" .SH BUGS With the .B -l option or .B Load command, the recreation of windows under control of external programs such as .I win is just to rerun the command; information may be lost.