1
0

acme.html 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  3. "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv=Content-Type content="text/html; charset=utf8">
  7. <title>Acme: A User Interface for Programmers</title>
  8. </meta>
  9. </head>
  10. <body>
  11. <p style="margin-top: 0; margin-bottom: 0.50in"></p>
  12. <p style="margin-top: 0; margin-bottom: 0.21in"></p>
  13. <p style="line-height: 1.4em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: center;">
  14. <span style="font-size: 12pt"><b>Acme: A User Interface for Programmers</b></span></p>
  15. <p style="margin-top: 0; margin-bottom: 0.21in"></p>
  16. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  17. <p style="line-height: 1.4em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: center;">
  18. <span style="font-size: 10pt"><i></i></span><span style="font-size: 10pt"><i>Rob Pike</i></span><span style="font-size: 10pt"><i></i></span></p>
  19. <p style="line-height: 1.4em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: center;">
  20. <span style="font-size: 10pt"><i></i></span><span style="font-size: 10pt"><i>rob@plan9.bell-labs.com</i></span><span style="font-size: 10pt"><i></i></span></p>
  21. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  22. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  23. <p style="margin-top: 0; margin-bottom: 0.33in"></p>
  24. <p style="line-height: 1.4em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: center;">
  25. <span style="font-size: 10pt"><i>ABSTRACT</i></span></p>
  26. <p style="margin-top: 0; margin-bottom: 0.19in"></p>
  27. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  28. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  29. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  30. <p style="line-height: 1.2em; margin-left: 1.50in; text-indent: 0.00in; margin-right: 1.50in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  31. <span style="font-size: 10pt">A hybrid of window system, shell, and editor, Acme gives text-oriented
  32. applications a clean, expressive, and consistent style of interaction.
  33. Traditional window systems support interactive client programs and offer libraries of
  34. pre-defined operations such as pop-up menus
  35. and buttons to promote a consistent
  36. user interface among the clients.
  37. Acme instead provides its clients with a fixed user interface and
  38. simple conventions to encourage its uniform use.
  39. Clients access the facilities of Acme through a file system interface;
  40. Acme is in part a file server that exports device-like files that may be
  41. manipulated to access and control the contents of its windows.
  42. Written in a concurrent programming language,
  43. Acme is structured as a set of communicating processes that neatly subdivide
  44. the various aspects of its tasks: display management, input, file server, and so on.
  45. </span><span style="font-size: 10pt"></span><span style="font-size: 10pt"></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  46. <p style="line-height: 1.2em; margin-left: 1.50in; text-indent: 0.35in; margin-right: 1.50in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  47. <span style="font-size: 10pt">Acme attaches distinct functions to the three mouse buttons:
  48. the left selects text;
  49. the middle executes textual commands;
  50. and the right combines context search and file opening
  51. functions to integrate the various applications and files in
  52. the system.
  53. </span><span style="font-size: 10pt"></span><span style="font-size: 10pt"></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  54. <p style="line-height: 1.2em; margin-left: 1.50in; text-indent: 0.35in; margin-right: 1.50in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  55. <span style="font-size: 10pt">Acme works well enough to have developed
  56. a community that uses it exclusively.
  57. Although Acme discourages the traditional style of interaction
  58. based on typescript windows&mdash;teletypes&mdash;its
  59. users find Acme&rsquo;s other services render
  60. typescripts obsolete.
  61. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  62. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  63. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  64. <p style="margin-top: 0; margin-bottom: 0.50in"></p>
  65. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  66. <span style="font-size: 10pt"><b>History and motivation
  67. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  68. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  69. <span style="font-size: 10pt">The usual typescript style of interaction with
  70. Unix and its relatives is an old one.
  71. The typescript&mdash;an intermingling of textual commands and their
  72. output&mdash;originates with the scrolls of paper on teletypes.
  73. The advent of windowed terminals has given each user what
  74. amounts to an array of teletypes, a limited and unimaginative
  75. use of the powers of bitmap displays and mice.
  76. Systems like the Macintosh
  77. that do involve the mouse as an integral part of the interaction
  78. are geared towards general users, not experts, and certainly
  79. not programmers.
  80. Software developers, at least on time-sharing systems, have been left behind.
  81. </span></p><center><table width=60% cellspacing=0 cellpadding=0 border=0><tr height=1> <td width=1 bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td width=1 bgcolor=#000000 /></tr><tr height=10> <td width=1 bgcolor=#000000 /> <td width=10 /> <td /> <td width=10 /> <td width=1 bgcolor=#000000 /></tr>
  82. <tr>
  83. <td width=1 bgcolor=#000000 /><td width=10 /><td>
  84. <center><a href="acme.fig1.gif"><img src="acme.fig1.gif" /></a></center>
  85. <p style="line-height: 1.2em; text-indent: 0.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  86. <span style="font-size: 10pt">Figure 1. A small Acme screen&mdash;normally it runs on a larger display&mdash;demonstrating
  87. some of the details discussed in the text.
  88. The right column contains some guide files,
  89. a mailbox presented by Acme&rsquo;s mail program,
  90. the columnated display of files in Acme&rsquo;s own source directory,
  91. a couple of windows from the OED browser,
  92. a debugger window,
  93. and an error window showing diagnostics from a compilation.
  94. The left column holds a couple of source files
  95. (</span><span style="font-size: 10pt"><tt>dat.h</tt></span><span style="font-size: 10pt">
  96. and
  97. </span><span style="font-size: 10pt"><tt>acme.l</tt></span><span style="font-size: 10pt">),
  98. another debugger window displaying a stack trace,
  99. and a third source file
  100. (</span><span style="font-size: 10pt"><tt>time.l</tt></span><span style="font-size: 10pt">).
  101. </span><span style="font-size: 10pt"><tt>Time.l</tt></span><span style="font-size: 10pt">
  102. was opened from the debugger by clicking the right mouse button
  103. on a line in the stack window;
  104. the mouse cursor landed on the offending line of
  105. </span><span style="font-size: 10pt"><tt>acme.l</tt></span><span style="font-size: 10pt">
  106. after a click on the compiler message.
  107. </span></p></td>
  108. <td width=10 /><td width=1 bgcolor=#000000 />
  109. </tr>
  110. <tr height=10><td width=1 bgcolor=#000000 /> <td width=10 /><td /><td width=10 /> <td width=1 bgcolor=#000000 /></tr><tr height=1> <td width=1 bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td width=1 bgcolor=#000000 /></tr>
  111. </table></center>
  112. <p style="margin-top: 0; margin-bottom: 0.05in"></p>
  113. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  114. <span style="font-size: 10pt">Some programs have mouse-based editing of
  115. text files and typescripts;
  116. ones I have built include
  117. the window systems
  118. </span><span style="font-size: 10pt"><tt>mux</tt></span><span style="font-size: 10pt">
  119. [Pike88]
  120. and
  121. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">
  122. [Pike91]
  123. and the text editor
  124. Sam [Pike87].
  125. These have put the programmer&rsquo;s mouse to some productive work,
  126. but not wholeheartedly. Even experienced users of these programs
  127. often retype text that could be grabbed with the mouse,
  128. partly because the menu-driven interface is imperfect
  129. and partly because the various pieces are not well enough integrated.
  130. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  131. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  132. <span style="font-size: 10pt">Other programs&mdash;EMACS [Stal93] is the prime example&mdash;offer a high
  133. degree of integration but with a user interface built around the
  134. ideas of cursor-addressed terminals that date from the 1970&rsquo;s.
  135. They are still keyboard-intensive and
  136. dauntingly complex.
  137. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  138. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  139. <span style="font-size: 10pt">The most ambitious attempt to face these issues was the Cedar
  140. system, developed at Xerox [Swei86].
  141. It combined a new programming language, compilers,
  142. window system, even microcode&mdash;a complete system&mdash;to
  143. construct a productive, highly
  144. integrated and interactive environment
  145. for experienced users of compiled languages.
  146. Although successful internally, the system was so large
  147. and so tied to specific hardware that it never fledged.
  148. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  149. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  150. <span style="font-size: 10pt">Cedar was, however, the major inspiration for Oberon [Wirt89],
  151. a system of similar scope but much smaller scale.
  152. Through careful selection of Cedar&rsquo;s ideas, Oberon shows
  153. that its lessons can be applied to a small, coherent system
  154. that can run efficiently on modest hardware.
  155. In fact, Oberon probably
  156. errs too far towards simplicity: a single-process system
  157. with weak networking, it seems an architectural throwback.
  158. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  159. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  160. <span style="font-size: 10pt">Acme is a new program,
  161. a combined window system, editor, and shell,
  162. that applies
  163. some of the ideas distilled by Oberon.
  164. Where Oberon uses objects and modules within a programming language (also called Oberon),
  165. Acme uses files and commands within an existing operating system (Plan 9).
  166. Unlike Oberon, Acme does not yet have support for graphical output, just text.
  167. At least for now, the work on Acme has concentrated on
  168. producing the smoothest user interface possible for a programmer
  169. at work.
  170. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  171. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  172. <span style="font-size: 10pt">The rest of this paper describes Acme&rsquo;s interface,
  173. explains how programs can access it,
  174. compares it to existing systems,
  175. and finally presents some unusual aspects of its implementation.
  176. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  177. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  178. <span style="font-size: 10pt"><b>User interface
  179. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  180. <center><table width=60% cellspacing=0 cellpadding=0 border=0><tr height=1> <td width=1 bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td width=1 bgcolor=#000000 /></tr><tr height=10> <td width=1 bgcolor=#000000 /> <td width=10 /> <td /> <td width=10 /> <td width=1 bgcolor=#000000 /></tr>
  181. <tr>
  182. <td width=1 bgcolor=#000000 /><td width=10 /><td>
  183. <center><a href="acme.fig2.gif"><img src="acme.fig2.gif" /></a></center>
  184. <p style="line-height: 1.2em; text-indent: 0.35in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  185. <span style="font-size: 10pt">Figure 2. An Acme window showing a section of code.
  186. The upper line of text is the tag containing the file name,
  187. relevant commands, and a scratch area (right of the vertical bar);
  188. the lower portion of the window is the
  189. body, or contents, of the file.
  190. Here the scratch area contains a command for the middle button
  191. (</span><span style="font-size: 10pt"><tt>mk</tt></span><span style="font-size: 10pt">)
  192. and a word to search for with the right button
  193. (</span><span style="font-size: 10pt"><tt>cxfidalloc</tt></span><span style="font-size: 10pt">).
  194. The user has just
  195. clicked the right button on
  196. </span><span style="font-size: 10pt"><tt>cxfidalloc</tt></span><span style="font-size: 10pt">
  197. and Acme has searched for the word, highlighted it,
  198. and moved the mouse cursor there. The file has been modified:
  199. the center of the layout box is black and the command
  200. </span><span style="font-size: 10pt"><tt>Put</tt></span><span style="font-size: 10pt">
  201. appears in the tag.
  202. </span></p></td>
  203. <td width=10 /><td width=1 bgcolor=#000000 />
  204. </tr>
  205. <tr height=10><td width=1 bgcolor=#000000 /> <td width=10 /><td /><td width=10 /> <td width=1 bgcolor=#000000 /></tr><tr height=1> <td width=1 bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td bgcolor=#000000 /> <td width=10 bgcolor=#000000 /> <td width=1 bgcolor=#000000 /></tr>
  206. </table></center>
  207. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  208. <span style="font-size: 10pt">Acme windows are arrayed in columns (Figure 1) and are used more
  209. dynamically than in an environment like X Windows or
  210. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">
  211. [Sche86, Pike91].
  212. The system frequently creates them automatically and the user
  213. can order a new one with a single mouse button click.
  214. The initial placement of a new window is determined
  215. automatically, but the user may move an existing window anywhere
  216. by clicking or dragging a
  217. </span><span style="font-size: 10pt"><i>layout box</i></span><span style="font-size: 10pt">
  218. in the upper left corner of
  219. the window.
  220. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  221. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  222. <span style="font-size: 10pt">Acme windows have two parts: a
  223. </span><span style="font-size: 10pt"><i>tag</i></span><span style="font-size: 10pt">
  224. holding a single line of text,
  225. above a
  226. </span><span style="font-size: 10pt"><i>body</i></span><span style="font-size: 10pt">
  227. holding zero or more lines (Figure 2).
  228. The body typically contains an image of a file being edited
  229. or the editable output of a
  230. program, analogous to an
  231. EMACS shell
  232. window. The tag contains
  233. the name of the window
  234. (usually the name of the associated
  235. file or directory), some built-in commands, and a scratch area to hold arbitrary text.
  236. If a window represents a directory, the name in the tag ends with
  237. a slash and the body contains a list of the names of the files
  238. in the directory.
  239. Finally, each non-empty body holds a scroll bar at the left of the text.
  240. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  241. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  242. <span style="font-size: 10pt">Each column of windows also has a layout box and a tag.
  243. The tag has no special meaning, although Acme pre-loads it with a few
  244. built-in commands.
  245. There is also a tag across the whole display, also loaded with
  246. helpful commands and a list of active processes started
  247. by Acme.
  248. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  249. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  250. <span style="font-size: 10pt">Typing with the keyboard and selecting with the left button are as in
  251. many other systems, including the Macintosh,
  252. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">,
  253. and Sam.
  254. The middle and right buttons are used, somewhat like the left button,
  255. to &lsquo;sweep&rsquo; text, but the indicated text is treated in a way
  256. that depends on the text&rsquo;s location&mdash;</span><span style="font-size: 10pt"><i>context</i></span><span style="font-size: 10pt">&mdash;as well as its content.
  257. This context, based on the directory of the file containing the text,
  258. is a central component of Acme&rsquo;s style of interaction.
  259. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  260. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  261. <span style="font-size: 10pt">Acme has no single notion of &lsquo;current directory&rsquo;.
  262. Instead, every command, file name,
  263. action, and so on is interpreted or executed in the directory named by the
  264. tag of the window containing the command. For example, the string
  265. </span><span style="font-size: 10pt"><tt>mammals</tt></span><span style="font-size: 10pt">
  266. in a window labeled
  267. </span><span style="font-size: 10pt"><tt>/lib/</tt></span><span style="font-size: 10pt">
  268. or
  269. </span><span style="font-size: 10pt"><tt>/lib/insects</tt></span><span style="font-size: 10pt">
  270. will be interpreted as the file name
  271. </span><span style="font-size: 10pt"><tt>/lib/mammals</tt></span><span style="font-size: 10pt">
  272. if such a file exists.
  273. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  274. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  275. <span style="font-size: 10pt">Throughout Acme, the middle mouse button is used to execute commands
  276. and the right mouse button is used to locate and select files and text.
  277. Even when there are no true files on which to operate&mdash;for example
  278. when editing mail messages&mdash;Acme and its applications use
  279. consistent extensions of these basic functions.
  280. This idea is as vital to Acme as icons are to the Macintosh.
  281. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  282. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  283. <span style="font-size: 10pt">The middle button executes commands: text swept with the button
  284. pressed is underlined; when the button is released, the underline is
  285. removed and the indicated text is executed.
  286. A modest number of commands are recognized as built-ins: words like
  287. </span><span style="font-size: 10pt"><tt>Cut</tt></span><span style="font-size: 10pt">,
  288. </span><span style="font-size: 10pt"><tt>Paste</tt></span><span style="font-size: 10pt">,
  289. and
  290. </span><span style="font-size: 10pt"><tt>New</tt></span><span style="font-size: 10pt">
  291. name
  292. functions performed directly by Acme.
  293. These words often appear in tags to make them always available,
  294. but the tags are not menus: any text anywhere in Acme may be a command.
  295. For example, in the tag or body of any window one may type
  296. </span><span style="font-size: 10pt"><tt>Cut</tt></span><span style="font-size: 10pt">,
  297. select it with the left button, use the middle button to execute it,
  298. and watch it disappear again.
  299. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  300. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  301. <span style="font-size: 10pt">If the middle button indicates a command that is not recognized as a built-in,
  302. it is executed in the directory
  303. named by the tag of the window holding the text.
  304. Also, the file to be executed is searched for first in that directory.
  305. Standard input is connected to
  306. </span><span style="font-size: 10pt"><tt>/dev/null</tt></span><span style="font-size: 10pt">,
  307. but standard and error outputs are connected to an Acme window,
  308. created if needed, called
  309. </span><span style="font-size: 10pt"><i>dir</i></span><span style="font-size: 10pt"><tt>/+Errors</tt></span><span style="font-size: 10pt"> where
  310. </span><span style="font-size: 10pt"><i>dir</i></span><span style="font-size: 10pt">
  311. is the directory of the window.
  312. (Programs that need interactive input use a different interface, described below.)
  313. A typical use of this is to type
  314. </span><span style="font-size: 10pt"><tt>mk</tt></span><span style="font-size: 10pt">
  315. (Plan 9&rsquo;s
  316. </span><span style="font-size: 10pt"><tt>make</tt></span><span style="font-size: 10pt">)
  317. in the scratch area in the tag of a C source window, say
  318. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/sam/regexp.c</tt></span><span style="font-size: 10pt">,
  319. and execute it.
  320. Output, including compiler errors, appears in the window labeled
  321. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/sam/+Errors</tt></span><span style="font-size: 10pt">,
  322. so file names in the output are associated with the windows and directory
  323. holding the source.
  324. The
  325. </span><span style="font-size: 10pt"><tt>mk</tt></span><span style="font-size: 10pt">
  326. command remains in the tag, serving as a sort of menu item for the associated
  327. window.
  328. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  329. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  330. <span style="font-size: 10pt">Like the middle button, the right button is used to indicate text by sweeping it out.
  331. The indicated text is not a command, however, but the argument of a generalized
  332. search operator.
  333. If the text, perhaps after appending it to the directory of the window containing it,
  334. is the name of an existing file, Acme creates a new window to hold the file
  335. and reads it in. It then moves the mouse cursor to that window. If the file is
  336. already loaded into Acme, the mouse motion happens but no new window is made.
  337. For example, indicating the string
  338. </span><span style="font-size: 10pt"><tt>sam.h</tt></span><span style="font-size: 10pt">
  339. in
  340. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  341. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  342. <span style="font-size: 9pt"><tt>#include "sam.h"</tt></span></p>
  343. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  344. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  345. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  346. <span style="font-size: 10pt">in a window on the file
  347. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/sam/regexp.c</tt></span><span style="font-size: 10pt">
  348. will open the file
  349. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/sam/sam.h</tt></span><span style="font-size: 10pt">.
  350. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  351. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  352. <span style="font-size: 10pt">If the file name is followed immediately by a colon and a legal address in
  353. Sam notation (for example a line number or a regular expression delimited in
  354. slashes or a comma-separated compound of such addresses), Acme highlights
  355. the target of that address in the file and places the mouse there. One may jump to
  356. line 27 of
  357. </span><span style="font-size: 10pt"><tt>dat.h</tt></span><span style="font-size: 10pt">
  358. by indicating with the right button the text
  359. </span><span style="font-size: 10pt"><tt>dat.h:27</tt></span><span style="font-size: 10pt">.
  360. If the file is not already open, Acme loads it.
  361. If the file name is null, for example if the indicated string is
  362. </span><span style="font-size: 10pt"><tt>:/^main/</tt></span><span style="font-size: 10pt">,
  363. the file is assumed to be that of the window containing the string.
  364. Such strings, when typed and evaluated in the tag of a window, amount to
  365. context searches.
  366. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  367. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  368. <span style="font-size: 10pt">If the indicated text is not the name of an existing file, it is taken to be literal
  369. text and is searched for in the body of the window containing the text, highlighting
  370. the result as if it were the result of a context search.
  371. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  372. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  373. <span style="font-size: 10pt">For the rare occasion when a file name
  374. </span><span style="font-size: 10pt"><i>is</i></span><span style="font-size: 10pt">
  375. just text to search for, it can be selected with the left button and used as the
  376. argument to a built-in
  377. </span><span style="font-size: 10pt"><tt>Look</tt></span><span style="font-size: 10pt">
  378. command that always searches for literal text.
  379. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  380. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  381. <span style="font-size: 10pt"><b>Nuances and heuristics
  382. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  383. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  384. <span style="font-size: 10pt">A user interface should not only provide the necessary functions, it should also
  385. </span><span style="font-size: 10pt"><i>feel</i></span><span style="font-size: 10pt">
  386. right.
  387. In fact, it should almost not be felt at all; when one notices a
  388. user interface, one is distracted from the job at hand [Pike88].
  389. To approach this invisibility, some of Acme&rsquo;s properties and features
  390. are there just to make the others easy to use.
  391. Many are based on a fundamental principle of good design:
  392. let the machine do the work.
  393. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  394. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  395. <span style="font-size: 10pt">Acme tries to avoid needless clicking and typing.
  396. There is no &lsquo;click-to-type&rsquo;, eliminating a button click.
  397. There are no pop-up or pull-down menus, eliminating the mouse action needed to
  398. make a menu appear.
  399. The overall design is intended to make text on the screen useful without
  400. copying or retyping; the ways in which this happens involve
  401. the combination of many aspects of the interface.
  402. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  403. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  404. <span style="font-size: 10pt">Acme tiles its windows and places them automatically
  405. to avoid asking the user to place and arrange them.
  406. For this policy to succeed, the automatic placement must behave well enough
  407. that the user is usually content with the location of a new window.
  408. The system will never get it right all the time, but in practice most
  409. windows are used at least for a while where Acme first places them.
  410. There have been several complete rewrites of the
  411. heuristics for placing a new window,
  412. and with each rewrite the system became
  413. noticeably more comfortable. The rules are as follows, although
  414. they are still subject to improvement.
  415. The window appears in the &lsquo;active&rsquo; column, that most recently used for typing or
  416. selecting.
  417. Executing and searching do not affect the choice of active column,
  418. so windows of commands and such do not draw new windows towards them,
  419. but rather let them form near the targets of their actions.
  420. Output (error) windows always appear towards the right, away from
  421. edited text, which is typically kept towards the left.
  422. Within the column, several competing desires are balanced to decide where
  423. and how large the window should be:
  424. large blank spaces should be consumed;
  425. existing text should remain visible;
  426. existing large windows should be divided before small ones;
  427. and the window should appear near the one containing the action that caused
  428. its creation.
  429. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  430. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  431. <span style="font-size: 10pt">Acme binds some actions to chords of mouse buttons.
  432. These include
  433. </span><span style="font-size: 10pt"><tt>Cut</tt></span><span style="font-size: 10pt">
  434. and
  435. </span><span style="font-size: 10pt"><tt>Paste</tt></span><span style="font-size: 10pt">
  436. so these common operations can be done without
  437. moving the mouse.
  438. Another is a way to apply a command in one window to text (often a file name)
  439. in another, avoiding the actions needed to assemble the command textually.
  440. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  441. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  442. <span style="font-size: 10pt">Another way Acme avoids the need to move the mouse is instead to move the cursor
  443. to where it is likely to be used next. When a new window is made, Acme
  444. moves the cursor to the new window; in fact, to the selected text in that window.
  445. When the user deletes a newly made window, the cursor is
  446. returned to the point it was before the window was made,
  447. reducing the irritation of windows that pop up to report annoying errors.
  448. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  449. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  450. <span style="font-size: 10pt">When a window is moved, Acme moves the cursor to the layout box in
  451. its new place, to permit further adjustment without moving the mouse.
  452. For example, when a click of the left mouse button on the layout box grows
  453. the window, the cursor moves to the new location of the box so repeated clicks,
  454. without moving the mouse, continue to grow it.
  455. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  456. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  457. <span style="font-size: 10pt">Another form of assistance the system can offer is to supply precision in
  458. pointing the mouse. The best-known form of this is &lsquo;double-clicking&rsquo; to
  459. select a word rather than carefully sweeping out the entire word.
  460. Acme provides this feature, using context to decide whether to select
  461. a word, line, quoted string, parenthesized expression, and so on.
  462. But Acme takes the idea much further by applying it to execution
  463. and searching.
  464. A
  465. </span><span style="font-size: 10pt"><i>single</i></span><span style="font-size: 10pt">
  466. click, that is, a null selection, with either the middle or right buttons,
  467. is expanded automatically to indicate the appropriate text containing
  468. the click. What is appropriate depends on the context.
  469. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  470. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  471. <span style="font-size: 10pt">For example, to execute a single-word command
  472. such as
  473. </span><span style="font-size: 10pt"><tt>Cut</tt></span><span style="font-size: 10pt">,
  474. it is not necessary to sweep the entire word; just clicking the button once with
  475. the mouse pointing at the word is sufficient. &lsquo;Word&rsquo;
  476. means the largest string of likely file name characters surrounding the location
  477. of the click: click on a file name, run that program.
  478. On the right button, the rules are more complicated because
  479. the target of the click might be a file name, file name with address,
  480. or just plain text. Acme examines the text near the click to find
  481. a likely file name;
  482. if it finds one, it checks that it names an existing file (in the directory named in the tag, if the name is relative)
  483. and if so, takes that as the result, after extending it with any address
  484. that may be present. If there is no file with that name, Acme
  485. just takes the largest alphanumeric string under the click.
  486. The effect is a natural overloading of the button to refer to plain text as
  487. well as file names.
  488. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  489. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  490. <span style="font-size: 10pt">First, though, if the click occurs over the left-button-selected text in the window,
  491. that text is taken to be what is selected.
  492. This makes it easy to skip through the occurrences of a string in a file: just click
  493. the right button
  494. on some occurrence of the text in the window (perhaps after typing it in the tag)
  495. and click once for each subsequent occurrence. It isn&rsquo;t even necessary to move
  496. the mouse between clicks; Acme does that.
  497. To turn a complicated command into a sort of menu item, select it:
  498. thereafter, clicking the middle button on it will execute the full command.
  499. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  500. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  501. <span style="font-size: 10pt">As an extra feature, Acme recognizes file names in angle brackets
  502. </span><span style="font-size: 10pt"><tt>&lt;&gt;</tt></span><span style="font-size: 10pt">
  503. as names of files in standard directories of include files,
  504. making it possible for instance to look at
  505. </span><span style="font-size: 10pt"><tt>&lt;stdio.h&gt;</tt></span><span style="font-size: 10pt">
  506. with a single click.
  507. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  508. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  509. <span style="font-size: 10pt">Here&rsquo;s an example to demonstrate how the actions and defaults work together.
  510. Assume
  511. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/sam/regexp.c</tt></span><span style="font-size: 10pt">
  512. is
  513. open and has been edited. We write it (execute
  514. </span><span style="font-size: 10pt"><tt>Put</tt></span><span style="font-size: 10pt">
  515. in the tag; once the file is written, Acme removes the word from the tag)
  516. and type
  517. </span><span style="font-size: 10pt"><tt>mk</tt></span><span style="font-size: 10pt">
  518. in the tag. We execute
  519. </span><span style="font-size: 10pt"><tt>mk</tt></span><span style="font-size: 10pt">
  520. and get some errors, which appear in a new window labeled
  521. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/sam/+Errors</tt></span><span style="font-size: 10pt">.
  522. The cursor moves automatically to that window.
  523. Say the error is
  524. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  525. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  526. <span style="font-size: 9pt"><tt>main.c:112: incompatible types on assignment to &lsquo;pattern&rsquo;</tt></span></p>
  527. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  528. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  529. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  530. <span style="font-size: 10pt">We move the mouse slightly and click the right button
  531. at the left of the error message; Acme
  532. makes a new window, reads
  533. </span><span style="font-size: 10pt"><tt>/sys/src/cmd/main.c</tt></span><span style="font-size: 10pt">
  534. into it, selects line 112
  535. and places the mouse there, right on the offending line.
  536. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  537. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  538. <span style="font-size: 10pt"><b>Coupling to existing programs
  539. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  540. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  541. <span style="font-size: 10pt">Acme&rsquo;s syntax for file names and addresses makes it easy for other programs
  542. to connect automatically to Acme&rsquo;s capabilities. For example, the output of
  543. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  544. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  545. <span style="font-size: 9pt"><tt>grep -n variable *.[ch]</tt></span></p>
  546. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  547. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  548. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  549. <span style="font-size: 10pt">can be used to help Acme step through the occurrences of a variable in a program;
  550. every line of output is potentially a command to open a file.
  551. The file names need not be absolute, either: the output
  552. appears in a window labeled with the directory in which
  553. </span><span style="font-size: 10pt"><tt>grep</tt></span><span style="font-size: 10pt">
  554. was run, from which Acme can derive the full path names.
  555. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  556. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  557. <span style="font-size: 10pt">When necessary, we have changed the output of some programs,
  558. such as compiler error messages, to match
  559. Acme&rsquo;s syntax.
  560. Some might argue that it shouldn&rsquo;t be necessary to change old programs,
  561. but sometimes programs need to be updated when systems change,
  562. and consistent output benefits people as well as programs.
  563. A historical example is the retrofitting of standard error output to the
  564. early Unix programs when pipes were invented.
  565. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  566. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  567. <span style="font-size: 10pt">Another change was to record full path names in
  568. the symbol table of executables, so line numbers reported by the debugger
  569. are absolute names that may be used directly by Acme; it&rsquo;s not necessary
  570. to run the debugger in the source directory. (This aids debugging
  571. even without Acme.)
  572. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  573. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  574. <span style="font-size: 10pt">A related change was to add lines of the form
  575. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  576. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  577. <span style="font-size: 9pt"><tt>#pragma src "/sys/src/libregexp"</tt></span></p>
  578. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  579. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  580. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  581. <span style="font-size: 10pt">to header files; coupled with Acme&rsquo;s ability to locate a header file,
  582. this provides a fast, keyboardless way to get the source associated with a library.
  583. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  584. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  585. <span style="font-size: 10pt">Finally, Acme directs the standard output of programs it runs to
  586. windows labeled by the directory in which the program is run.
  587. Acme&rsquo;s splitting of the
  588. output into directory-labeled windows is a small feature that has a major effect:
  589. local file names printed by programs can be interpreted directly by Acme.
  590. By indirectly coupling the output of programs to the input,
  591. it also simplifies the management of software that occupies multiple
  592. directories.
  593. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  594. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  595. <span style="font-size: 10pt"><b>Coupling to new programs
  596. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  597. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  598. <span style="font-size: 10pt">Like many Plan 9 programs,
  599. Acme offers a programmable interface to
  600. other programs by acting as a file server.
  601. The best example of such a file server is the window system
  602. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">
  603. [Pike91],
  604. which exports files with names such as
  605. </span><span style="font-size: 10pt"><tt>screen</tt></span><span style="font-size: 10pt">,
  606. </span><span style="font-size: 10pt"><tt>cons</tt></span><span style="font-size: 10pt">,
  607. and
  608. </span><span style="font-size: 10pt"><tt>mouse</tt></span><span style="font-size: 10pt">
  609. through which applications may access the I/O capabilities of the windows.
  610. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">
  611. provides a
  612. </span><span style="font-size: 10pt"><i>distinct</i></span><span style="font-size: 10pt">
  613. set of files for each window and builds a private file name space
  614. for the clients running &lsquo;in&rsquo; each window;
  615. clients in separate windows see distinct files with the same names
  616. (for example
  617. </span><span style="font-size: 10pt"><tt>/dev/mouse</tt></span><span style="font-size: 10pt">).
  618. Acme, like the process file system [PPTTW93], instead associates each
  619. window with a directory of files; the files of each window are visible
  620. to any application.
  621. This difference reflects a difference in how the systems are used:
  622. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">
  623. tells a client what keyboard and mouse activity has happened in its window;
  624. Acme tells a client what changes that activity wrought on any window it asks about.
  625. Putting it another way,
  626. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">
  627. enables the construction of interactive applications;
  628. Acme provides the interaction for applications.
  629. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  630. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  631. <span style="font-size: 10pt">The root of
  632. Acme&rsquo;s file system is mounted using Plan 9 operations on the directory
  633. </span><span style="font-size: 10pt"><tt>/mnt/acme</tt></span><span style="font-size: 10pt">.
  634. In
  635. that root directory appears a directory for each window, numbered with the window&rsquo;s identifier,
  636. analogous to a process identifier, for example
  637. </span><span style="font-size: 10pt"><tt>/mnt/acme/27</tt></span><span style="font-size: 10pt">.
  638. The window&rsquo;s directory
  639. contains 6 files:
  640. </span><span style="font-size: 10pt"><tt>/mnt/acme/27/addr</tt></span><span style="font-size: 10pt">,
  641. </span><span style="font-size: 10pt"><tt>body</tt></span><span style="font-size: 10pt">,
  642. </span><span style="font-size: 10pt"><tt>ctl</tt></span><span style="font-size: 10pt">,
  643. </span><span style="font-size: 10pt"><tt>data</tt></span><span style="font-size: 10pt">,
  644. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">,
  645. and
  646. </span><span style="font-size: 10pt"><tt>tag</tt></span><span style="font-size: 10pt">.
  647. The
  648. </span><span style="font-size: 10pt"><tt>body</tt></span><span style="font-size: 10pt">
  649. and
  650. </span><span style="font-size: 10pt"><tt>tag</tt></span><span style="font-size: 10pt">
  651. files contain the text of the respective parts of the window; they may be
  652. read to recover the contents. Data written to these files is appended to the text;
  653. </span><span style="font-size: 10pt"><tt>seeks</tt></span><span style="font-size: 10pt">
  654. are ignored.
  655. The
  656. </span><span style="font-size: 10pt"><tt>addr</tt></span><span style="font-size: 10pt">
  657. and
  658. </span><span style="font-size: 10pt"><tt>data</tt></span><span style="font-size: 10pt">
  659. files provide random access to the contents of the body.
  660. The
  661. </span><span style="font-size: 10pt"><tt>addr</tt></span><span style="font-size: 10pt">
  662. file is written to set a character position within the body; the
  663. </span><span style="font-size: 10pt"><tt>data</tt></span><span style="font-size: 10pt">
  664. file may then be read to recover the contents at that position,
  665. or written to change them.
  666. (The tag is assumed
  667. small and special-purpose enough not to need special treatment.
  668. Also,
  669. </span><span style="font-size: 10pt"><tt>addr</tt></span><span style="font-size: 10pt">
  670. indexes by character position, which is not the same as byte offset
  671. in Plan 9&rsquo;s multi-byte character set [Pike93]).
  672. The format accepted by the
  673. </span><span style="font-size: 10pt"><tt>addr</tt></span><span style="font-size: 10pt">
  674. file is exactly the syntax of addresses within the user interface,
  675. permitting regular expressions, line numbers, and compound addresses
  676. to be specified. For example, to replace the contents of lines 3 through 7,
  677. write the text
  678. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  679. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  680. <span style="font-size: 9pt"><tt>3,7</tt></span></p>
  681. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  682. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  683. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  684. <span style="font-size: 10pt">to the
  685. </span><span style="font-size: 10pt"><tt>addr</tt></span><span style="font-size: 10pt">
  686. file, then write the replacement text to the
  687. </span><span style="font-size: 10pt"><tt>data</tt></span><span style="font-size: 10pt">
  688. file. A zero-length write deletes the addressed text; further writes extend the replacement.
  689. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  690. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  691. <span style="font-size: 10pt">The control file,
  692. </span><span style="font-size: 10pt"><tt>ctl</tt></span><span style="font-size: 10pt">,
  693. may be written with commands to effect actions on the window; for example
  694. the command
  695. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  696. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  697. <span style="font-size: 9pt"><tt>name /adm/users</tt></span></p>
  698. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  699. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  700. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  701. <span style="font-size: 10pt">sets the name in the tag of the window to
  702. </span><span style="font-size: 10pt"><tt>/adm/users</tt></span><span style="font-size: 10pt">.
  703. Other commands allow deleting the window, writing it to a file, and so on.
  704. Reading the
  705. </span><span style="font-size: 10pt"><tt>ctl</tt></span><span style="font-size: 10pt">
  706. file recovers a fixed-format string containing 5 textual numbers&mdash;the window
  707. identifier, the number of characters in the tag, the number in the body,
  708. and some status information&mdash;followed by the text of the tag, up to a newline.
  709. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  710. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  711. <span style="font-size: 10pt">The last file,
  712. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">,
  713. is the most unusual.
  714. A program reading a window&rsquo;s
  715. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">
  716. file is notified of all changes to the text of the window, and
  717. is asked to interpret all middle- and right-button actions.
  718. The data passed to the program is fixed-format and reports
  719. the source of the action (keyboard, mouse, external program, etc.),
  720. its location (what was pointed at or modified), and its nature (change,
  721. search, execution, etc.).
  722. This message, for example,
  723. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  724. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  725. <span style="font-size: 9pt"><tt>MI15 19 0 4 time</tt></span></p>
  726. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  727. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  728. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  729. <span style="font-size: 10pt">reports that actions of the mouse
  730. (</span><span style="font-size: 10pt"><tt>M</tt></span><span style="font-size: 10pt">)
  731. inserted in the body (capital
  732. </span><span style="font-size: 10pt"><tt>I</tt></span><span style="font-size: 10pt">)
  733. the 4 characters of
  734. </span><span style="font-size: 10pt"><tt>time</tt></span><span style="font-size: 10pt">
  735. at character positions 15 through 19; the zero is a flag word.
  736. Programs may apply their own interpretations of searching and
  737. execution, or may simply reflect the events back to Acme,
  738. by writing them back to the
  739. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">
  740. file, to have the default interpretation applied.
  741. Some examples of these ideas in action are presented below.
  742. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  743. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  744. <span style="font-size: 10pt">Notice that changes to the window are reported
  745. after the fact; the program is told about them but is not required to act
  746. on them. Compare this to a more traditional interface in which a program
  747. is told, for example, that a character has been typed on the keyboard and
  748. must then display and interpret it.
  749. Acme&rsquo;s style stems from the basic model of the system, in which any
  750. number of agents&mdash;the keyboard, mouse, external programs
  751. writing to
  752. </span><span style="font-size: 10pt"><tt>data</tt></span><span style="font-size: 10pt">
  753. or
  754. </span><span style="font-size: 10pt"><tt>body</tt></span><span style="font-size: 10pt">,
  755. and so on&mdash;may
  756. change the contents of a window.
  757. The style is efficient: many programs are content
  758. to have Acme do most of the work and act only when the editing is completed.
  759. An example is the Acme mail program, which can ignore the changes
  760. made to a message being composed
  761. and just read its body when asked to send it.
  762. A disadvantage is that some traditional ways of working are impossible.
  763. For example, there is no way &lsquo;to turn off echo&rsquo;: characters appear on the
  764. screen and are read from there; no agent or buffer stands between
  765. the keyboard and the display.
  766. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  767. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  768. <span style="font-size: 10pt">There are a couple of other files made available by Acme in its root directory
  769. rather than in the directory of each window.
  770. The text file
  771. </span><span style="font-size: 10pt"><tt>/mnt/acme/index</tt></span><span style="font-size: 10pt">
  772. holds a list of all window names and numerical identifiers,
  773. somewhat analogous to the output of the
  774. </span><span style="font-size: 10pt"><tt>ps</tt></span><span style="font-size: 10pt">
  775. command for processes.
  776. The most important, though, is
  777. </span><span style="font-size: 10pt"><tt>/mnt/acme/new</tt></span><span style="font-size: 10pt">,
  778. a directory that makes new windows, similar to the
  779. </span><span style="font-size: 10pt"><tt>clone</tt></span><span style="font-size: 10pt">
  780. directory in the Plan 9 network devices [Pres93].
  781. The act of opening any file in
  782. </span><span style="font-size: 10pt"><tt>new</tt></span><span style="font-size: 10pt">
  783. creates a new Acme window; thus the shell command
  784. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  785. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  786. <span style="font-size: 9pt"><tt>grep -n var *.c &gt; /mnt/acme/new/body</tt></span></p>
  787. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  788. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  789. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  790. <span style="font-size: 10pt">places its output in the body of a fresh window.
  791. More sophisticated applications may open
  792. </span><span style="font-size: 10pt"><tt>new/ctl</tt></span><span style="font-size: 10pt">,
  793. read it to discover the new window&rsquo;s identifier, and then
  794. open the window&rsquo;s other files in the numbered directory.
  795. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  796. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  797. <span style="font-size: 10pt"><b>Acme-specific programs
  798. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  799. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  800. <span style="font-size: 10pt">Although Acme is in part an attempt to move beyond typescripts,
  801. they will probably always have utility.
  802. The first program written for Acme was therefore one
  803. to run a shell or other traditional interactive application
  804. in a window, the Acme analog of
  805. </span><span style="font-size: 10pt"><tt>xterm</tt></span><span style="font-size: 10pt">.
  806. This program,
  807. </span><span style="font-size: 10pt"><tt>win</tt></span><span style="font-size: 10pt">,
  808. has a simple structure:
  809. it acts as a two-way intermediary between Acme and the shell,
  810. cross-connecting the standard input and output of the shell to the
  811. text of the window.
  812. The style of interaction is modeled after
  813. </span><span style="font-size: 10pt"><tt>mux</tt></span><span style="font-size: 10pt">
  814. [Pike88]: standard output is added to the window at the
  815. </span><span style="font-size: 10pt"><i>output point;</i></span><span style="font-size: 10pt">
  816. text typed after the output point
  817. is made available on standard input when a newline is typed.
  818. After either of these actions, the output point is advanced.
  819. This is different from the working of a regular terminal,
  820. permitting cut-and-paste editing of an input line until the newline is typed.
  821. Arbitrary editing may be done to any text in the window.
  822. The implementation of
  823. </span><span style="font-size: 10pt"><tt>win</tt></span><span style="font-size: 10pt">,
  824. using the
  825. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">,
  826. </span><span style="font-size: 10pt"><tt>addr</tt></span><span style="font-size: 10pt">,
  827. and
  828. </span><span style="font-size: 10pt"><tt>data</tt></span><span style="font-size: 10pt">
  829. files, is straightforward.
  830. </span><span style="font-size: 10pt"><tt>Win</tt></span><span style="font-size: 10pt">
  831. needs no code for handling the keyboard and mouse; it just monitors the
  832. contents of the window. Nonetheless, it allows Acme&rsquo;s full editing to be
  833. applied to shell commands.
  834. The division of labor between
  835. </span><span style="font-size: 10pt"><tt>win</tt></span><span style="font-size: 10pt">
  836. and
  837. </span><span style="font-size: 10pt"><tt>Acme</tt></span><span style="font-size: 10pt">
  838. contrasted with
  839. </span><span style="font-size: 10pt"><tt>xterm</tt></span><span style="font-size: 10pt">
  840. and the X server demonstrates how much work Acme handles automatically.
  841. </span><span style="font-size: 10pt"><tt>Win</tt></span><span style="font-size: 10pt">
  842. is implemented by a single source file 560 lines long and has no graphics code.
  843. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  844. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  845. <span style="font-size: 10pt"></span><span style="font-size: 10pt"><tt>Win</tt></span><span style="font-size: 10pt">
  846. uses the middle and right buttons to connect itself in a consistent way
  847. with the rest of Acme.
  848. The middle button still executes commands, but in a style more suited
  849. to typescripts. Text selected with the middle button is treated as if
  850. it had been typed after the output point, much as a similar feature in
  851. </span><span style="font-size: 10pt"><tt>xterm</tt></span><span style="font-size: 10pt">
  852. or
  853. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">,
  854. and therefore causes it to be &lsquo;executed&rsquo; by the application running in the window.
  855. Right button actions are reflected back to Acme but refer to the appropriate
  856. files because
  857. </span><span style="font-size: 10pt"><tt>win</tt></span><span style="font-size: 10pt">
  858. places the name of the current directory in the tag of the window.
  859. If the shell is running, a simple shell function replacing the
  860. </span><span style="font-size: 10pt"><tt>cd</tt></span><span style="font-size: 10pt">
  861. command can maintain the tag as the shell navigates the file system.
  862. This means, for example, that a right button click on a file mentioned in an
  863. </span><span style="font-size: 10pt"><tt>ls</tt></span><span style="font-size: 10pt">
  864. listing opens the file within Acme.
  865. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  866. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  867. <span style="font-size: 10pt">Another Acme-specific program is a mail reader that begins by presenting,
  868. in a window, a listing of the messages in the user&rsquo;s mailbox, one per line.
  869. Here the middle and right button actions are modified to refer to
  870. mail commands
  871. and messages, but the change feels natural.
  872. Clicking the right button on a line creates a new window and displays the
  873. message there, or, if it&rsquo;s already displayed, moves the mouse to that window.
  874. The metaphor is that the mailbox is a directory whose constituent files are messages.
  875. The mail program also places some relevant commands in the tag lines of
  876. the windows; for example, executing the word
  877. </span><span style="font-size: 10pt"><tt>Reply</tt></span><span style="font-size: 10pt">
  878. in a message&rsquo;s tag creates a new window
  879. in which to compose a message to the sender of the original;
  880. </span><span style="font-size: 10pt"><tt>Post</tt></span><span style="font-size: 10pt">
  881. then dispatches it.
  882. In such windows, the addressee is just a list of names
  883. on the first line of the body, which may be edited to add or change recipients.
  884. The program also monitors the mailbox, updating the &lsquo;directory&rsquo; as new messages
  885. arrive.
  886. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  887. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  888. <span style="font-size: 10pt">The mail program is as simple as it sounds; all the work of interaction,
  889. editing, and management of the display is done by Acme.
  890. The only
  891. difficult sections of the 1200
  892. lines of code concern honoring the external protocols for managing
  893. the mailbox and connecting to
  894. </span><span style="font-size: 10pt"><tt>sendmail</tt></span><span style="font-size: 10pt">.
  895. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  896. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  897. <span style="font-size: 10pt">One of the things Acme does not provide directly is a facility like
  898. Sam&rsquo;s command language to enable actions such as global substitution;
  899. within Acme, all editing is done manually.
  900. It is easy, though, to write external programs for such tasks.
  901. In this, Acme comes closer to the original intent of Oberon:
  902. a directory,
  903. </span><span style="font-size: 10pt"><tt>/acme/edit</tt></span><span style="font-size: 10pt">,
  904. contains a set of tools for repetitive editing and a template
  905. or &lsquo;guide&rsquo; file that gives examples
  906. of its use.
  907. Acme&rsquo;s editing guide,
  908. </span><span style="font-size: 10pt"><tt>/acme/edit/guide</tt></span><span style="font-size: 10pt">,
  909. looks like this:
  910. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  911. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  912. <span style="font-size: 9pt"><tt>e file | x &rsquo;/regexp/&rsquo; | c &rsquo;replacement&rsquo;</tt></span></p>
  913. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  914. <span style="font-size: 9pt"><tt>e file:&rsquo;0,$&rsquo; | x &rsquo;/.*word.*\n/&rsquo; | p -n</tt></span></p>
  915. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  916. <span style="font-size: 9pt"><tt>e file | pipe command args ...</tt></span></p>
  917. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  918. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  919. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  920. <span style="font-size: 10pt">The syntax is reminiscent of Sam&rsquo;s command language, but here the individual
  921. one-letter commands are all stand-alone programs connected by pipes.
  922. Passed along the pipes are addresses, analogous to structural expressions
  923. in Sam terminology.
  924. The
  925. </span><span style="font-size: 10pt"><tt>e</tt></span><span style="font-size: 10pt">
  926. command, unlike that of Sam, starts the process by generating the address
  927. (default dot, the highlighted selection) in the named files.
  928. The other commands are as in Sam:
  929. </span><span style="font-size: 10pt"><tt>p</tt></span><span style="font-size: 10pt">
  930. prints the addressed text on standard output (the
  931. </span><span style="font-size: 10pt"><tt>-n</tt></span><span style="font-size: 10pt">
  932. option is analogous to that of
  933. </span><span style="font-size: 10pt"><tt>grep</tt></span><span style="font-size: 10pt">,
  934. useful in combination with the right mouse button);
  935. </span><span style="font-size: 10pt"><tt>x</tt></span><span style="font-size: 10pt">
  936. matches a regular expression to the addressed (incoming) text,
  937. subdividing the text;
  938. </span><span style="font-size: 10pt"><tt>c</tt></span><span style="font-size: 10pt">
  939. replaces the text; and so on. Thus, global substitution throughout a file,
  940. which would be expressed in Sam as
  941. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  942. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  943. <span style="font-size: 9pt"><tt>0,$ x/regexp/ c/replacement/</tt></span></p>
  944. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  945. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  946. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  947. <span style="font-size: 10pt">in Acme&rsquo;s editor becomes
  948. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  949. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  950. <span style="font-size: 9pt"><tt>e &rsquo;file:0,$&rsquo; | x &rsquo;/regexp/&rsquo; | c &rsquo;replacement&rsquo;</tt></span></p>
  951. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  952. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  953. <p style="margin-top: 0; margin-bottom: 0.05in"></p>
  954. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  955. <span style="font-size: 10pt">To use the Acme editing commands, open
  956. </span><span style="font-size: 10pt"><tt>/acme/edit/guide</tt></span><span style="font-size: 10pt">,
  957. use the mouse and keyboard to edit one of the commands to the right form,
  958. and execute it with the middle button.
  959. Acme&rsquo;s context rules find the appropriate binaries in
  960. </span><span style="font-size: 10pt"><tt>/acme/edit</tt></span><span style="font-size: 10pt">
  961. rather than
  962. </span><span style="font-size: 10pt"><tt>/bin</tt></span><span style="font-size: 10pt">;
  963. the effect is to turn
  964. </span><span style="font-size: 10pt"><tt>/acme/edit</tt></span><span style="font-size: 10pt">
  965. into a toolbox containing tools and instructions (the guide file) for their use.
  966. In fact, the source for these tools is also there, in the directory
  967. </span><span style="font-size: 10pt"><tt>/acme/edit/src</tt></span><span style="font-size: 10pt">.
  968. This setup allows some control of the file name space for binary programs;
  969. not only does it group related programs, it permits the use of common
  970. names for uncommon jobs. For example, the single-letter names would
  971. be unwise in a directory in everyone&rsquo;s search path; here they are only
  972. visible when running editing commands.
  973. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  974. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  975. <span style="font-size: 10pt">In Oberon,
  976. such a collection would be called a
  977. </span><span style="font-size: 10pt"><i>tool</i></span><span style="font-size: 10pt">
  978. and would consist
  979. of a set of entry points in a module and a menu-like piece of text containing
  980. representative commands that may be edited to suit and executed.
  981. There is, in fact, a tool called
  982. </span><span style="font-size: 10pt"><tt>Edit</tt></span><span style="font-size: 10pt">
  983. in Oberon.
  984. To provide related functionality,
  985. Acme exploits the directory and file structure of the underlying
  986. system, rather than the module structure of the language;
  987. this fits well with Plan 9&rsquo;s
  988. file-oriented philosophy.
  989. Such tools are central to the working of Oberon but they are
  990. less used in Acme, at least so far.
  991. The main reason is probably that Acme&rsquo;s program interface permits
  992. an external program to remain executing in the background, providing
  993. its own commands as needed (for example, the
  994. </span><span style="font-size: 10pt"><tt>Reply</tt></span><span style="font-size: 10pt">
  995. command in the mail program); Oberon uses tools to
  996. implement such services because its must invoke
  997. a fresh program for each command.
  998. Also,
  999. Acme&rsquo;s better integration allows more
  1000. basic functions to be handled internally; the right mouse button
  1001. covers a lot of the basic utility of the editing tools in Oberon.
  1002. Nonetheless, as more applications are written for Acme,
  1003. many are sure to take this Oberon tool-like form.
  1004. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1005. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1006. <span style="font-size: 10pt"><b>Comparison with other systems
  1007. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1008. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1009. <span style="font-size: 10pt">Acme&rsquo;s immediate ancestor is Help [Pike92], an experimental system written
  1010. a few years ago as a first try at exploring some of Oberon&rsquo;s ideas
  1011. in an existing operating system.
  1012. Besides much better engineering, Acme&rsquo;s advances over Help
  1013. include the actions of the right button (Help had nothing comparable),
  1014. the ability to connect long-running programs to the user interface
  1015. (Help had no analog of the
  1016. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">
  1017. file),
  1018. and the small but important change to split command output into
  1019. windows labeled with the directory in which the commands run.
  1020. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1021. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1022. <span style="font-size: 10pt">Most of Acme&rsquo;s style, however, derives from the user interface and window
  1023. system of Oberon [Wirt89, Reis91].
  1024. Oberon includes a programming language and operating system,
  1025. which Acme instead borrows from an existing system, Plan 9.
  1026. When I first saw Oberon, in 1988, I was struck by the
  1027. simplicity of its user interface, particularly its lack of menus
  1028. and its elegant use of multiple mouse buttons.
  1029. The system seemed restrictive, though&mdash;single process,
  1030. single language, no networking, event-driven programming&mdash;and
  1031. failed to follow through on some of its own ideas.
  1032. For example, the middle mouse button had to be pointed accurately and
  1033. the right button was essentially unused.
  1034. Acme does follow through:
  1035. to the basic idea planted by Oberon, it adds
  1036. the ability to run on different operating systems and hardware,
  1037. connection to existing applications including
  1038. interactive ones such as shells and debuggers,
  1039. support for multiple processes,
  1040. the right mouse button&rsquo;s features,
  1041. the default actions and context-dependent properties
  1042. of execution and searching,
  1043. and a host of little touches such as moving the mouse cursor that make the system
  1044. more pleasant.
  1045. At the moment, though, Oberon does have one distinct advantage: it incorporates
  1046. graphical programs well into its model, an issue Acme has not yet faced.
  1047. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1048. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1049. <span style="font-size: 10pt">Acme shares with the Macintosh a desire to use the mouse well and it is
  1050. worth comparing the results.
  1051. The mouse on the Macintosh has a single button, so menus are essential
  1052. and the mouse must frequently move a long way
  1053. to reach the appropriate function.
  1054. An indication that this style has trouble is that applications provide
  1055. keyboard sequences to invoke menu selections and users often prefer them.
  1056. A deeper comparison is that the Macintosh uses pictures where Acme uses text.
  1057. In contrast to pictures, text can be edited quickly, created on demand,
  1058. and fine-tuned to the job at hand; consider adding an option to a command.
  1059. It is also self-referential; Acme doesn&rsquo;t need menus because any text can be
  1060. in effect a menu item.
  1061. The result is that, although a Macintosh screen is certainly prettier and probably
  1062. more attractive, especially to beginners, an Acme screen is more dynamic
  1063. and expressive, at least for programmers and experienced users.
  1064. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1065. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1066. <span style="font-size: 10pt">For its role in the overall system,
  1067. Acme most resembles EMACS [Stal93].
  1068. It is tricky to compare Acme to EMACS, though, because there are
  1069. many versions of EMACS and, since it is fully programmable, EMACS
  1070. can in principle do anything Acme does.
  1071. Also, Acme is much younger and therefore has not
  1072. had the time to acquire as many features.
  1073. The issue therefore is less what the systems can be programmed to do than
  1074. how they are used.
  1075. The EMACS versions that come closest to Acme&rsquo;s style are those that
  1076. have been extended to provide a programming environment, usually
  1077. for a language such as LISP [Alle92, Lucid92].
  1078. For richness of the existing interface, these EMACS versions are certainly superior to Acme.
  1079. On the other hand, Acme&rsquo;s interface works equally well already for a variety
  1080. of languages; for example, one of its most enthusiastic users works almost
  1081. exclusively in Standard ML, a language nothing like C.
  1082. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1083. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1084. <span style="font-size: 10pt">Where Acme excels is in the smoothness of its interface.
  1085. Until recently, EMACS did not support the mouse especially well,
  1086. and even with the latest version providing features such as &lsquo;extents&rsquo;
  1087. that can be programmed to behave much like Acme commands,
  1088. many users don&rsquo;t bother to upgrade.
  1089. Moreover, in the versions that provide extents,
  1090. most EMACS packages don&rsquo;t take advantage of them.
  1091. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1092. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1093. <span style="font-size: 10pt">The most important distinction is just that
  1094. EMACS is fundamentally keyboard-based, while
  1095. Acme is mouse-based.
  1096. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1097. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1098. <span style="font-size: 10pt">People who try Acme find it hard to go back to their previous environment.
  1099. Acme automates so much that to return to a traditional interface
  1100. is to draw attention to the extra work it requires.
  1101. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1102. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1103. <span style="font-size: 10pt"><b>Concurrency in the implementation
  1104. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1105. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1106. <span style="font-size: 10pt">Acme is about 8,000 lines of code in Alef, a concurrent object-oriented language syntactically similar to C [Alef].
  1107. Acme&rsquo;s structure is a set of communicating
  1108. processes in a single address space.
  1109. One subset of the processes drives the display and user interface,
  1110. maintaining the windows; other processes forward mouse and keyboard
  1111. activity and implement the file server interface for external programs.
  1112. The language and design worked out well;
  1113. as explained elsewhere [Pike89, Gans93, Reppy93],
  1114. user interfaces built with concurrent systems
  1115. can avoid the clumsy
  1116. top-level event loop typical of traditional interactive systems.
  1117. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1118. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1119. <span style="font-size: 10pt">An example of the benefits of the multi-process style
  1120. is the management of the state of open
  1121. files held by clients of the file system interface.
  1122. The problem is that some I/O requests,
  1123. such as reading the
  1124. </span><span style="font-size: 10pt"><tt>event</tt></span><span style="font-size: 10pt">
  1125. file, may block if no data is available, and the server must
  1126. maintain the state of (possibly many) requests until data appears.
  1127. For example,
  1128. in
  1129. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">,
  1130. a single-process window system written in C, pending requests were queued in
  1131. a data structure associated with each window.
  1132. After activity in the window that might complete pending I/O,
  1133. the data structure was scanned for requests that could now finish.
  1134. This structure did not fit well with the rest of the program and, worse,
  1135. required meticulous effort
  1136. to guarantee correct behavior under all conditions
  1137. (consider raw mode, reads of partial lines, deleting a window,
  1138. multibyte characters, etc.).
  1139. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1140. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1141. <span style="font-size: 10pt">Acme instead creates a new dedicated process
  1142. for each I/O request.
  1143. This process coordinates with the rest of the system
  1144. using Alef&rsquo;s synchronous communication;
  1145. its state implicitly encodes the state of
  1146. the I/O request and obviates the need for queuing.
  1147. The passage of the request through Acme proceeds as follows.
  1148. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1149. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1150. <span style="font-size: 10pt">Acme contains a file server process, F, that executes a
  1151. </span><span style="font-size: 10pt"><tt>read</tt></span><span style="font-size: 10pt">
  1152. system call to receive a Plan 9 file protocol (9P) message from the client [AT&amp;T92].
  1153. The client blocks until Acme answers the request.
  1154. F communicates with an allocation process, M,
  1155. to acquire an object of type
  1156. </span><span style="font-size: 10pt"><tt>Xfid</tt></span><span style="font-size: 10pt">
  1157. (&lsquo;executing fid&rsquo;; fid is a 9P term)
  1158. to hold the request.
  1159. M sits in a loop (reproduced in Figure 2) waiting for either a request for
  1160. a new
  1161. </span><span style="font-size: 10pt"><tt>Xfid</tt></span><span style="font-size: 10pt">
  1162. or notification that an existing one has finished its task.
  1163. When an
  1164. </span><span style="font-size: 10pt"><tt>Xfid</tt></span><span style="font-size: 10pt">
  1165. is created, an associated process, X,
  1166. is also made.
  1167. M queues idle
  1168. </span><span style="font-size: 10pt"><tt>Xfids</tt></span><span style="font-size: 10pt">,
  1169. allocating new ones only when the list is empty.
  1170. Thus, there is always a pool of
  1171. </span><span style="font-size: 10pt"><tt>Xfids</tt></span><span style="font-size: 10pt">,
  1172. some executing, some idle.
  1173. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1174. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1175. <span style="font-size: 10pt">The
  1176. </span><span style="font-size: 10pt"><tt>Xfid</tt></span><span style="font-size: 10pt">
  1177. object contains a channel,
  1178. </span><span style="font-size: 10pt"><tt>Xfid.c</tt></span><span style="font-size: 10pt">,
  1179. for communication with its process;
  1180. the unpacked message; and some associated functions,
  1181. mostly corresponding to 9P messages such as
  1182. </span><span style="font-size: 10pt"><tt>Xfid.write</tt></span><span style="font-size: 10pt">
  1183. to handle a 9P write request.
  1184. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1185. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1186. <span style="font-size: 10pt">The file server process F parses the message to see its nature&mdash;open,
  1187. close, read, write, etc. Many messages, such as directory
  1188. lookups, can be handled immediately; these are responded to directly
  1189. and efficiently
  1190. by F without invoking the
  1191. </span><span style="font-size: 10pt"><tt>Xfid</tt></span><span style="font-size: 10pt">,
  1192. which is therefore maintained until the next message.
  1193. When a message, such as a write to the display, requires the attention
  1194. of the main display process and interlocked access to its data structures,
  1195. F enables X
  1196. by sending a function pointer on
  1197. </span><span style="font-size: 10pt"><tt>Xfid.c</tt></span><span style="font-size: 10pt">.
  1198. For example, if the message is a write, F executes
  1199. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  1200. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1201. <span style="font-size: 9pt"><tt>x-&gt;c &lt;-= Xfid.write;</tt></span></p>
  1202. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1203. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  1204. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1205. <span style="font-size: 10pt">which sends
  1206. the address of
  1207. </span><span style="font-size: 10pt"><tt>Xfid.write</tt></span><span style="font-size: 10pt">
  1208. on
  1209. </span><span style="font-size: 10pt"><tt>Xfid.c</tt></span><span style="font-size: 10pt">,
  1210. waking up X.
  1211. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1212. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1213. <span style="font-size: 10pt">The
  1214. </span><span style="font-size: 10pt"><tt>Xfid</tt></span><span style="font-size: 10pt">
  1215. process, X, executes a simple loop:
  1216. </span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
  1217. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1218. <span style="font-size: 9pt"><tt>void</tt></span></p>
  1219. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1220. <span style="font-size: 9pt"><tt>Xfid.ctl(Xfid *x)</tt></span></p>
  1221. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1222. <span style="font-size: 9pt"><tt>{</tt></span></p>
  1223. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1224. <span style="font-size: 9pt"><tt>    for(;;){</tt></span></p>
  1225. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1226. <span style="font-size: 9pt"><tt>        (*&lt;-x-&gt;c)(x);      /* receive and execute message */</tt></span></p>
  1227. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1228. <span style="font-size: 9pt"><tt>        bflush();          /* synchronize bitmap display */</tt></span></p>
  1229. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1230. <span style="font-size: 9pt"><tt>        cxfidfree &lt;-= x;   /* return to free list */</tt></span></p>
  1231. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1232. <span style="font-size: 9pt"><tt>    }</tt></span></p>
  1233. <p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1234. <span style="font-size: 9pt"><tt>}</tt></span></p>
  1235. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1236. <p style="margin-top: 0; margin-bottom: 0.08in"></p>
  1237. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1238. <span style="font-size: 10pt">Thus X
  1239. will wake up with the address of a function to call (here
  1240. </span><span style="font-size: 10pt"><tt>Xfid.write</tt></span><span style="font-size: 10pt">)
  1241. and execute it; once that completes, it returns itself to the pool of
  1242. free processes by sending its address back to the allocator.
  1243. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1244. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1245. <span style="font-size: 10pt">Although this sequence may seem complicated, it is just a few lines
  1246. of code and is in fact far simpler
  1247. than the management of the I/O queues in
  1248. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">.
  1249. The hard work of synchronization is done by the Alef run time system.
  1250. Moreover, the code worked the first time, which cannot be said for the code in
  1251. </span><span style="font-size: 10pt"><tt>8&frac12;</tt></span><span style="font-size: 10pt">.
  1252. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1253. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1254. <span style="font-size: 10pt"><b>Undo
  1255. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1256. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1257. <span style="font-size: 10pt">Acme provides a general undo facility like that of Sam, permitting
  1258. textual changes to be unwound arbitrarily.
  1259. The implementation is superior to Sam&rsquo;s, though,
  1260. with much higher performance and the ability to &lsquo;redo&rsquo; changes.
  1261. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1262. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1263. <span style="font-size: 10pt">Sam uses
  1264. a multi-pass algorithm that builds
  1265. a transcript of changes to be made simultaneously
  1266. and then executes them atomically.
  1267. This was thought necessary because the elements of a repetitive
  1268. command such as a global substitution should all be applied to the same
  1269. initial file and implemented simultaneously; forming the complete
  1270. transcript before executing any of the changes avoids the
  1271. cumbersome management of addresses in a changing file.
  1272. Acme, however, doesn&rsquo;t have this problem; global substitution
  1273. is controlled externally and may be made incrementally by exploiting
  1274. an observation: if the changes are sorted in address order and
  1275. executed in reverse, changes will not invalidate the addresses of
  1276. pending changes.
  1277. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1278. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1279. <span style="font-size: 10pt">Acme therefore avoids the initial transcript. Instead, changes are applied
  1280. directly to the file, with an undo transcript recorded in a separate list.
  1281. For example, when text is added to a window, it is added directly and a record
  1282. of what to delete to restore the state is appended to the undo list.
  1283. Each undo action and the file are marked with a sequence number;
  1284. actions with the same sequence number are considered a unit
  1285. to be undone together.
  1286. The invariant state of the structure
  1287. is that the last action in the undo list applies to the current state of the file,
  1288. even if that action is one of a related set from, for example, a global substitute.
  1289. (In Sam, a related set of actions needed to be undone simultaneously.)
  1290. To undo an action, pop the last item on the undo list, apply it to the file,
  1291. revert it, and append it to a second, redo list.
  1292. To redo an action, do the identical operation with the lists interchanged.
  1293. The expensive operations occur
  1294. only when actually undoing; in normal editing the overhead is minor.
  1295. For example, Acme reads files about seven times faster than Sam, partly
  1296. because of this improvement and partly because of a cleaner implementation.
  1297. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1298. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1299. <span style="font-size: 10pt">Acme uses a temporary file to hold the text, keeping in memory only the
  1300. visible portion, and therefore can edit large files comfortably
  1301. even on small-memory machines such as laptops.
  1302. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1303. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1304. <span style="font-size: 10pt"><b>Future
  1305. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1306. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1307. <span style="font-size: 10pt">Acme is still under development.
  1308. Some things are simply missing.
  1309. For example, Acme should support non-textual graphics, but this is being
  1310. deferred until it can be done using a new graphics model being developed
  1311. for Plan 9. Also, it is undecided how Acme&rsquo;s style of interaction should best be
  1312. extended to graphical applications.
  1313. On a smaller scale, although the system feels smooth and comfortable,
  1314. work continues to tune the heuristics and
  1315. try new ideas for the user interface.
  1316. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1317. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1318. <span style="font-size: 10pt">There need to be more programs that use Acme. Browsers for
  1319. Usenet and AP News articles, the Oxford English Dictionary, and other
  1320. such text sources exist, but more imaginative applications will
  1321. be necessary to prove that Acme&rsquo;s approach is viable.
  1322. One that has recently been started is an interface to the debugger Acid [Wint94],
  1323. although it is still
  1324. unclear what form it will ultimately take.
  1325. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1326. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1327. <span style="font-size: 10pt">Acme shows that it is possible to make a user interface a stand-alone component
  1328. of an interactive environment. By absorbing more of the interactive
  1329. functionality than a simple window system, Acme off-loads much of the
  1330. computation from its applications, which helps keep them small and
  1331. consistent in their interface. Acme can afford to dedicate
  1332. considerable effort to making that interface as good as possible; the result
  1333. will benefit the entire system.
  1334. </span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1335. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1336. <span style="font-size: 10pt">Acme is complete and useful enough to attract users.
  1337. Its comfortable user interface,
  1338. the ease with which it handles multiple tasks and
  1339. programs in multiple directories,
  1340. and its high level of integration
  1341. make it addictive.
  1342. Perhaps most telling,
  1343. Acme shows that typescripts may not be the most
  1344. productive interface to a time-sharing system.
  1345. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1346. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1347. <span style="font-size: 10pt"><b>Acknowledgements
  1348. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1349. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1350. <span style="font-size: 10pt">Howard Trickey, Acme&rsquo;s first user, suffered buggy versions gracefully and made
  1351. many helpful suggestions. Chris Fraser provided the necessary insight for the Acme editing
  1352. commands.
  1353. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1354. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1355. <span style="font-size: 10pt"><b>References
  1356. </b></span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
  1357. <p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1358. <span style="font-size: 10pt">[Alef] P. Winterbottom,
  1359. &lsquo;&lsquo;Alef Language Reference Manual&rsquo;&rsquo;,
  1360. </span><span style="font-size: 10pt"><i>Plan 9 Programmer&rsquo;s Manual,
  1361. </i></span><span style="font-size: 10pt">AT&amp;T Bell Laboratories,
  1362. Murray Hill, NJ,
  1363. 1992;
  1364. revised in this volume.
  1365. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1366. <span style="font-size: 10pt">[Alle92]
  1367. </span><span style="font-size: 10pt"><i>Allegro Common Lisp user Guide, Vol 2,
  1368. </i></span><span style="font-size: 10pt">Chapter 14, "The Emacs-Lisp Interface".
  1369. March 1992.
  1370. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1371. <span style="font-size: 10pt">[AT&amp;T92] Plan 9 Programmer&rsquo;s manual, Murray Hill, New Jersey, 1992.
  1372. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1373. <span style="font-size: 10pt">[Far89] Far too many people, XTERM(1), Massachusetts Institute of Technology, 1989.
  1374. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1375. <span style="font-size: 10pt">[Gans93] Emden R. Gansner and John H. Reppy, &lsquo;&lsquo;A Multi-threaded Higher-order User Interface Toolkit&rsquo;&rsquo;, in
  1376. </span><span style="font-size: 10pt"><i>Software Trends, Volume 1,
  1377. User Interface Software,
  1378. </i></span><span style="font-size: 10pt">Bass and Dewan (Eds.),
  1379. John Wiley &amp; Sons 1993,
  1380. pp. 61-80.
  1381. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1382. <span style="font-size: 10pt">[Lucid92] Richard Stallman and Lucid, Inc.,
  1383. </span><span style="font-size: 10pt"><i>Lucid GNU EMACS Manual,
  1384. </i></span><span style="font-size: 10pt">March 1992.
  1385. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1386. <span style="font-size: 10pt">[Pike87] Rob Pike, &lsquo;&lsquo;The Text Editor </span><span style="font-size: 10pt"><tt>sam</tt></span><span style="font-size: 10pt">&rsquo;&rsquo;, Softw. - Pract. and Exp., Nov 1987, Vol 17 #11, pp. 813-845; reprinted in this volume.
  1387. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1388. <span style="font-size: 10pt">[Pike88] Rob Pike, &lsquo;&lsquo;Window Systems Should Be Transparent&rsquo;&rsquo;, Comp. Sys., Summer 1988, Vol 1 #3, pp. 279-296.
  1389. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1390. <span style="font-size: 10pt">[Pike89] Rob Pike, &lsquo;&lsquo;A Concurrent Window System&rsquo;&rsquo;, Comp. Sys., Spring 1989, Vol 2 #2, pp. 133-153.
  1391. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1392. <span style="font-size: 10pt">[PPTTW93] Rob Pike, Dave Presotto, Ken Thompson, Howard Trickey, and Phil Winterbottom, &lsquo;&lsquo;The Use of Name Spaces in Plan 9&rsquo;&rsquo;,
  1393. Op. Sys. Rev., Vol. 27, No. 2, April 1993, pp. 72-76,
  1394. reprinted in this volume.
  1395. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1396. <span style="font-size: 10pt">[Pike91] Rob Pike, &lsquo;&lsquo;8&frac12;, the Plan 9 Window System&rsquo;&rsquo;, USENIX Summer Conf. Proc., Nashville, June, 1991, pp. 257-265,
  1397. reprinted in this volume.
  1398. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1399. <span style="font-size: 10pt">[Pike92] Rob Pike, &lsquo;&lsquo;A Minimalist Global User Interface&rsquo;&rsquo;, Graphics Interface &rsquo;92 Proc., Vancouver, 1992, pp. 282-293. An earlier version appeared under the same title in USENIX Summer Conf. Proc., Nashville, June, 1991, pp. 267-279.
  1400. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1401. <span style="font-size: 10pt">[Pike93] Rob Pike and Ken Thompson, &lsquo;&lsquo;Hello World or &Kappa;&alpha;&lambda;&eta;&mu;&#941;&rho;&alpha; &kappa;&#972;&sigma;&mu;&epsilon; or
  1402. </span><span style="font-size: 10pt">&#12371;&#12435;&#12395;&#12385;&#12399; &#19990;&#30028;</span><span style="font-size: 10pt">&rsquo;&rsquo;, USENIX Winter Conf. Proc., San Diego, 1993, pp. 43-50,
  1403. reprinted in this volume.
  1404. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1405. <span style="font-size: 10pt">[Pres93] Dave Presotto and Phil Winterbottom, &lsquo;&lsquo;The Organization of Networks in Plan 9&rsquo;&rsquo;, Proc. Usenix Winter 1993, pp. 271-287, San Diego, CA,
  1406. reprinted in this volume.
  1407. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1408. <span style="font-size: 10pt">[Reis91] Martin Reiser, </span><span style="font-size: 10pt"><i>The Oberon System,</i></span><span style="font-size: 10pt"> Addison Wesley, New York, 1991.
  1409. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1410. <span style="font-size: 10pt">[Reppy93] John H. Reppy,
  1411. &lsquo;&lsquo;CML: A higher-order concurrent language&rsquo;&rsquo;, Proc. SIGPLAN&rsquo;91 Conf. on Programming, Lang. Design and Impl., June, 1991, pp. 293-305.
  1412. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1413. <span style="font-size: 10pt">[Sche86] Robert W. Scheifler and Jim Gettys,
  1414. &lsquo;&lsquo;The X Window System&rsquo;&rsquo;,
  1415. ACM Trans. on Graph., Vol 5 #2, pp. 79-109.
  1416. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1417. <span style="font-size: 10pt">[Stal93] Richard Stallman,
  1418. </span><span style="font-size: 10pt"><i>Gnu Emacs Manual, 9th edition, Emacs version 19.19,
  1419. </i></span><span style="font-size: 10pt">MIT.
  1420. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1421. <span style="font-size: 10pt">[Swei86] Daniel Sweinhart, Polle Zellweger, Richard Beach, and Robert Hagmann,
  1422. &lsquo;&lsquo;A Structural View of the Cedar Programming Environment&rsquo;&rsquo;,
  1423. ACM Trans. Prog. Lang. and Sys., Vol. 8, No. 4, pp. 419-490, Oct. 1986.
  1424. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1425. <span style="font-size: 10pt">[Wint94], Philip Winterbottom, &lsquo;&lsquo;Acid: A Debugger based on a Language&rsquo;&rsquo;, USENIX Winter Conf. Proc., San Francisco, CA, 1993,
  1426. reprinted in this volume.
  1427. </span></p><p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1428. <span style="font-size: 10pt">[Wirt89] N. Wirth and J. Gutknecht, &lsquo;&lsquo;The Oberon System&rsquo;&rsquo;, Softw. - Prac. and Exp., Sep 1989, Vol 19 #9, pp 857-894.
  1429. </span></p><p style="margin-top: 0; margin-bottom: 0.50in"></p>
  1430. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1431. <p style="line-height: 1.2em; margin-left: 1.50in; text-indent: 0.35in; margin-right: 1.50in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1432. <span style="font-size: 10pt"></span><span style="font-size: 10pt"><b>Notes</b></span><span style="font-size: 10pt">
  1433. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1434. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1435. <p style="line-height: 1.2em; margin-left: 1.50in; text-indent: 0.00in; margin-right: 1.50in; margin-top: 0; margin-bottom: 0; text-align: justify;">
  1436. <span style="font-size: 10pt">Originally appeared in
  1437. </span><span style="font-size: 10pt"><i>Proc. of the Winter 1994 USENIX Conf.,
  1438. </i></span><span style="font-size: 10pt">pp. 223-234,
  1439. San Francisco, CA
  1440. </span></p><p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1441. <p style="margin-top: 0; margin-bottom: 0.17in"></p>
  1442. </body>
  1443. </html>