emode.lpt 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  1. Utah Symbolic Computation Group June 1982
  2. Operating Note No. 69
  3. A Guide to EMODE A Guide to EMODE A Guide to EMODE
  4. by
  5. William F. Galway and Martin L. Griss
  6. Department of Computer Science
  7. University of Utah
  8. Salt Lake City, Utah 84112
  9. Last Revision: 31 January 1983
  10. ABSTRACT ABSTRACT ABSTRACT
  11. EMODE is a LISP-based EMACS-like editor that runs on the PSL
  12. system. This document is meant to serve as a guide to using
  13. EMODE--but will only be roughly up to date, since the system is
  14. in a state of transition.
  15. Work supported in part by the National Science Foundation under
  16. Grant No. MCS80-07034. Guide to EMODE 1
  17. 1. Introduction and Acknowledgments 1. Introduction and Acknowledgments 1. Introduction and Acknowledgments
  18. This paper describes the EMODE editor being developed for
  19. PSL [Griss 81]. EMODE is an interactive, EMACS like [Stallman
  20. 81a], screen editor. EMODE provides multiple windows, can
  21. simultaneously support different "modes" of editing in different
  22. buffers, and supports a variety of CRT terminals such as the
  23. Teleray 1061 and the DEC VT-100.
  24. Several people have made contributions to EMODE. EMODE
  25. itself is based on an earlier editor EMID [Armantrout 81],
  26. written by Robert Armantrout and Martin Griss for LISP 1.6. Tony
  27. Carter has used EMODE to develop several large packages for VLSI
  28. circuitry design [Carter 81, Carter 82]. Optimizations for the
  29. Vax version, and many useful comments, have been provided by Russ
  30. Fish. Several features have been added by Alan Snyder and Cris
  31. Perdue at Hewlett Packard Research Labs. Cris implemented the
  32. current version of "mode lists", while Alan has implemented a
  33. huge number of commands and improved the efficiency of several
  34. operations.
  35. 2. Running EMODE 2. Running EMODE 2. Running EMODE
  36. EMODE is available as a "loadable" file. It can be invoked
  37. as follows:
  38. @PSL:RLISP
  39. [1] load emode;
  40. [2] emode();
  41. Of course, you may choose to invoke RLISP (or PSL)
  42. differently, and to perform other operations before loading and
  43. running EMODE. From this point on the term "PSL" will be used to
  44. refer to this family of systems, independently of whether they
  45. use Lisp or RLISP syntax.
  46. The terminal that EMODE uses by default is determined by its
  47. LOADing the file DEFAULT-TERMINAL. At the University of Utah
  48. this is the TELERAY driver. At other sites, some other driver
  49. may be chosen as the default. To use a different terminal you
  50. must LOAD in a different "driver file" after loading EMODE. For
  51. example, to run EMODE on the Hewlett Packard 2648A terminal, you
  52. could type:
  53. @PSL:RLISP
  54. [1] load emode, hp2648a;
  55. [2] emode(); Guide to EMODE 2
  56. The following drivers are currently available:
  57. AAA For the Ann Arbor Ambassador.
  58. DM1520 For the Datamedia 1520.
  59. HP2648A For the Hewlett Packard 2648A and similar Hewlett
  60. Packard terminals.
  61. TELERAY For the Teleray 1061.
  62. VT52 For the DEC VT52.
  63. VT100 For the DEC VT100.
  64. See section 9 for information on creating new terminal drivers.
  65. EMODE is quite similar to EMACS [Stallman 81b, Stallman
  66. 81a], although it doesn't have nearly as many commands. A
  67. detailed list of commands is given in appendix I. This
  68. information can also be obtained by typing "HELP EMODE;" to
  69. RLISP, or (equivalently) by reading the file PH:EMODE.HLP.
  70. The notation used here to describe character codes is
  71. basically the same as that used for EMACS. For example: C-Z
  72. means "control-Z", the character code produced by typing Z while
  73. holding down the control key. The ascii code for a control
  74. character is the same as the 5 low order bits of the original
  75. character--the code for Z is 132 octal, while the code for C-Z is
  76. 32 octal. M-Z means "meta-Z", the character produced by typing Z
  77. while holding down the meta key. To support those terminals
  78. without a meta key, the same result can normally be achieved by
  79. typing two characters--first the ESCAPE character, then the Z
  80. character. The ascii code for a meta character is the same as
  81. the original character with the parity bit set--the code for M-Z
  82. is 332 octal. (Some terminals use the ESCAPE character for other
  83. purposes, in which case the "META prefix" will be some other
  84. character.) Rather than using the EMACS convention, we write
  85. "control-meta" characters (such as C-M-Z) as "meta-control"
  86. characters (M-C-Z), since the latter notation better reflects the
  87. internal code (232 octal for M-C-Z). The C-Z character is used
  88. as a "meta-control" prefix, so one way to type M-C-Z is to type
  89. C-Z C-Z. (Another way to type it is to hold down the meta and
  90. control keys and type "Z".)
  91. When EMODE is started up as described above, it will
  92. immediately enter "two window mode". To enter "one window mode",
  93. you can type "C-X 1" (as in EMACS). Commands can be typed into a
  94. buffer shown in the top window. The result of evaluating a
  95. command is printed into the OUT_WINDOW buffer (shown in the
  96. bottom window). To evaluate the expression starting on the
  97. current line, type M-E. M-E will (normally) automatically enter
  98. two window mode if anything is "printed" to the OUT_WINDOW
  99. buffer. If you don't want to see things being printed to the Guide to EMODE 3
  100. output window, you can set the variable !*OUTWINDOW to NIL. (Or
  101. use the RLISP command "OFF OUTWINDOW;".) This prevents EMODE
  102. from automatically going into two window mode when something is
  103. printed to OUT_WINDOW. You must still use the "C-X 1" command to
  104. enter one window mode initially.
  105. Figure 2-1 shows EMODE in two window mode. In this mode the
  106. top window includes everything above (and including) the first
  107. line of dashes. This is followed by a single line window,
  108. showing the current prompt from PSL. Beneath this is the "output
  109. window", the window which usually shows the OUT_WINDOW buffer.
  110. This is followed by another single line window, which EMODE uses
  111. to prompt the user for values (not the same as PSL's prompt).
  112. % Commands can be typed in the top window.
  113. % When they're executed the value is printed into
  114. % the OUT_WINDOW buffer.
  115. x := '(now is the time);
  116. y := cddr x;
  117. ----MAIN-----------------------------------------85%---
  118. [7]
  119. -------------------------------------------------------
  120. NIL
  121. (NOW IS THE TIME)
  122. (THE TIME)
  123. ----OUT_WINDOW-----------------------------------75%---
  124. File for photo: s:twowindow.photo
  125. Figure 2-1: Figure 2-1: Figure 2-1: Two window mode
  126. Figure 2-2 shows EMODE in one window mode. The "top window"
  127. takes up most of the screen, followed by EMODE's prompt line, and
  128. then by PSL's prompt line.
  129. The BREAK handler has been modified by EMODE to "pop up" a
  130. "break window menu". This is illustrated in figure 2-3. The
  131. commands in the menu can be executed with the M-E command, and
  132. you can also edit the BREAK buffer just like any other buffer.
  133. If you wish to move to another window, use the C-X N command. Guide to EMODE 4
  134. % Commands can be typed in the top window.
  135. % When they're executed the value is printed into
  136. % the OUT_WINDOW buffer.
  137. x := '(now is the time);
  138. y := cddr x;
  139. ----MAIN-----------------------------------------85%---
  140. File for photo: s:onewindow.photo
  141. [7]
  142. Figure 2-2: Figure 2-2: Figure 2-2: One window mode
  143. This may cause the break window to disappear as it is covered by
  144. some other window, but C-X P will find it and pop it to the "top"
  145. of the screen again.
  146. EMODE is not very robust in its handling of errors. Here's
  147. a summary of known problems and suggestions on how to deal with
  148. them:
  149. Garbage collection messages "blow up":
  150. Printing messages into EMODE buffers involves
  151. CONSing, so the system blows up if it tries to
  152. print a message from inside the garbage
  153. collector. EMODE sets GC OFF at load time.
  154. Always run EMODE with GC OFF.
  155. Terminal doesn't echo:
  156. This can be caused by abnormal exits from EMODE.
  157. If PSL is still running, you can call the routine
  158. "EchoOn" to turn echoing back on. (It's the
  159. routine "EchoOff" that turns echoing off, and
  160. starts "raw output" mode.)
  161. Otherwise, as may happen on the Vax running Unix,
  162. you will have to give shell commands to turn Guide to EMODE 5
  163. cdr 2; +------------------------------+
  164. |A ;% To abort |
  165. |Q ;% To quit |
  166. |T ;% To traceback |
  167. |I ;% Trace interpreted stuff |
  168. |R ;% Retry |
  169. |C ;% Continue, |
  170. | % using last value |
  171. ----MAIN-----------|? ;% For more help |-
  172. 4 lisp break> +----BREAK---------------11%---+
  173. ----------------------------------------------------
  174. NIL
  175. ***** An attempt was made to do CDR on `2', which is
  176. not a pair {99}
  177. Break loop
  178. ----OUT_WINDOW-----------------------------------75%---
  179. File for photo: s:breakwindow.photo
  180. Figure 2-3: Figure 2-3: Figure 2-3: A break window (doctored from the original)
  181. echoing back on. This is best done by defining
  182. the following alias in your ".login" file.
  183. alias rst 'reset; stty -litout intr ^C'
  184. (That's a "control-C", not "uparrow C".) The
  185. "rst" command must be typed as "<LF>rst<LF>"
  186. because carriage-return processing is turned off.
  187. "Garbled" printout:
  188. This is probably caused by EMODE's not running in
  189. "raw output" mode--a problem which can be caused
  190. by some other errors. A cure is to type C-Z C-Z
  191. to leave EMODE, and then to call EMODE again.
  192. This should reset the terminal mode to "raw mode"
  193. (by calling EchoOff). (The C-Z C-Z must be
  194. followed by a linefeed on the Vax, to force the
  195. C-Z C-Z to be read.)
  196. Stuck in an error:
  197. This is often caused by trying to evaluate an
  198. expression that lacks a closing parenthesis (or
  199. some other terminator)--producing a message
  200. something like: Guide to EMODE 6
  201. ***** Unexpected EOF while reading ...
  202. If it's obvious that an additional parenthesis
  203. will cure the problem, you can use C-X N to
  204. select the input window and insert it. Then
  205. position the cursor to the left of the
  206. parenthesis and use C-X N to select the break
  207. window and "Quit".
  208. Otherwise you should use the "Abort" option of
  209. the break handler. Currently this resets the
  210. terminal mode (at least on the DEC-20), so you'll
  211. have to restart EMODE as described above. The
  212. BREAK window will still be present on the screen
  213. after restarting, even though you are no longer
  214. in the break loop. You can use the C-X 2 or
  215. C-X 1 command to get rid of the break window, and
  216. then use the C-X B command to select some buffer
  217. other than the break buffer.
  218. 3. A Guide to the Sources and Rebuilding 3. A Guide to the Sources and Rebuilding 3. A Guide to the Sources and Rebuilding
  219. The "primary" sources for EMODE reside on UTAH-20:
  220. PES: Is defined locally as <GALWAY.EMODE.V2>. This
  221. directory is for the "version 2" of EMODE--being
  222. maintained now. The corresponding "logical name"
  223. on the VAX is "$pes".
  224. PE: Is defined as <PSL.EMODE>. Holds sources and
  225. documentation which may be generally useful to
  226. the public. It includes sources for the various
  227. terminal drivers available for EMODE. (Further
  228. described in section 9.) The corresponding
  229. logical name on the VAX is "$pe".
  230. The file PES:BUILD-EMODE.CTL is the command file for
  231. building EMODE on the DEC-20. Use SUBMIT or DO to run the
  232. command file, which builds EMODE in two parts on the local
  233. directory: EMODE-B-1.B and EMODE-B-2.B. PES:BUILD-EMODE.CSH (or
  234. $pes/build-emode.csh) is the build file for the VAX. It also
  235. builds the binary files on the "local directory". On both
  236. machines the ".B" files for the terminal drivers and for RAWIO.B
  237. are built separately.
  238. The PES:EMODE.TAGS file can be used with the TAGS facility
  239. provided by EMACS on the DEC-20. (Highly recommended!) Guide to EMODE 7
  240. 4. Terminology: Buffers, Views/Windows, and Virtual Screens 4. Terminology: Buffers, Views/Windows, and Virtual Screens 4. Terminology: Buffers, Views/Windows, and Virtual Screens
  241. "Buffers", "views", and "virtual screens" are the three
  242. major data structures in EMODE. Virtual screens correspond
  243. _______ fairly closely to what are often called windows in other systems.
  244. They are rectangular regions on the screen, possibly overlapping,
  245. that characters can be written to. A virtual screen provides a
  246. sort of pseudo-hardware. The operations that can be performed on
  247. a virtual screen are modeled after what can be done with a real
  248. terminal. The use of a virtual screen provides these advantages:
  249. - Operations on a virtual screen are machine independent.
  250. (To some extent, this will be less true if we try to
  251. support "fancier" graphics.)
  252. - The "bandwidth problem" of maintaining the screen image
  253. is isolated to the virtual screen package--other
  254. programs don't have to worry about the problem.
  255. - Several virtual screens can be shown on one physical
  256. screen.
  257. Virtual screens are implemented as "Structs" using the
  258. "DefStruct" facility provided by the loadable file "NSTRUCT".
  259. Buffers hold the data to be edited, possibly something other
  260. than text, depending on the buffer's "data mode". Views are data
  261. structures used to display buffers on the screen, they may be
  262. ______ made of several virtual screens. The term "window" is often used
  263. instead of "view", when you see the one term it should be
  264. possible to substitute the other.
  265. Buffers and views are implemented as "environments". An
  266. environment is an association list of (NAME . VALUE) pairs.
  267. (These association lists are sometimes referred to as
  268. "descriptors".) The usual method for working with an environment
  269. is "restoring" (or "selecting") the environment by calling the
  270. procedure "RestoreEnv". This sets each variable name in the list
  271. to its associated value. The procedure "SaveEnv" does the
  272. inverse operation of updating the values of each variable name in
  273. the association list. (This is done "destructively", using
  274. RPLACD.) The names in an environment are sometimes called
  275. "per-environment" variables. Names in "buffer environments" are
  276. called "per-buffer variables", and similarly for "per-view
  277. variables".
  278. Buffers and views are just environments that follow certain
  279. conventions. These conventions are that they always include
  280. certain (name . value) pairs--i.e. that they always include
  281. certain "per-buffer" or "per-view" variables. For example, the
  282. required per-buffer variables include: Guide to EMODE 8
  283. buffers_file The name (a string) of a file associated with the
  284. buffer, or NIL if no file is associated with the
  285. buffer.
  286. buffers_view_creator
  287. A routine that creates a "view" (or "window")
  288. looking into the buffer.
  289. In addition to the required per-buffer variables, text buffers
  290. include variables containing things like the text being edited in
  291. the buffer and the location of "point" in the buffer.
  292. The required per-view variables include:
  293. windows_refresher
  294. (Which should actually be called the
  295. "views_refresher") defines a routine to be the
  296. refresh algorithm for whatever data structure
  297. this view looks into.
  298. WindowsBufferName
  299. Is the name (an ID) of the buffer that the view
  300. looks into.
  301. Views into text buffers include additional information such as a
  302. virtual screen to display the text in, and "cache" information to
  303. make refreshing faster.
  304. The choice of whether variables should be per-buffer or
  305. per-view is sometimes unclear. For example, it would seem to
  306. make better sense to have "point" be part of a view, rather than
  307. a buffer. This would allow the user to have two windows looking
  308. into different parts of the same buffer. However, it would also
  309. require the selection of a window for the many functions that
  310. insert strings into the buffer, delete strings from the buffer,
  311. etc., since these routines all work around the current "point".
  312. ____ Somehow it seems unnatural to require the selection of a view for
  313. ______ these buffer operations. The current decision is to make point a
  314. per-buffer variable.
  315. Further details on buffers and views for different modes are
  316. given in section 6.
  317. A list of all the buffers in EMODE is stored in the variable
  318. "BufferNames" as a list of (name . environment) pairs . These
  319. pairs are created with the routine "CreateBuffer". Guide to EMODE 9
  320. A list of "active" views in EMODE is stored in the variable
  321. "WindowList". This is simply a list of "environments"
  322. (association lists as described above). Unlike buffers, views
  323. are not referred to by name. Instead, specific views can be
  324. referred to by storing their environment in a variable (such as
  325. "BreakWindow").
  326. 5. Modes and Key bindings in EMODE 5. Modes and Key bindings in EMODE 5. Modes and Key bindings in EMODE
  327. There are two aspects to "modes" in EMODE. One is the
  328. choice of the data structure to be edited within a buffer. Until
  329. recently there has only been one kind of structure: "text". As
  330. discussed in section 6 EMODE now provides tools for editing
  331. other, user defined, structures.
  332. The other aspect of "modes", discussed in this section, is
  333. the binding of "handler" routines to terminal keys (or sequences
  334. of keys for multi-key commands). A simple version of this would
  335. associate a table of handlers (indexed by character code) with
  336. each buffer (or view). The method actually used is more
  337. complicated due to a desire to divide keyboard bindings into
  338. groups that can be combined in different ways. For example, we
  339. might have a text mode and an Rlisp mode, and an optional Word
  340. Abbreviation Mode that could be combined with either of them to
  341. cause automatic expansion of abbreviations as they are typed.
  342. _______ Implementing optional keyboard bindings that can removed as
  343. _____ well as added is difficult. Consider the situation with an
  344. optional "Abbreviation Mode" and an optional "Auto Fill Mode".
  345. Turning on either mode redefines the space character to act
  346. differently. In each case, the new definition for space would be
  347. something like "do some fancy stuff for this submode, and then do
  348. whatever space used to do". Imagine the difficulties involved in
  349. turning on "Abbreviation Mode" and then "Auto Fill Mode" and then
  350. turning off "Abbreviation Mode".
  351. EMODE's solution to the problem is based on the method
  352. ______ ______ suggested in [Finseth 80]. A single, global "dispatch vector" is
  353. used, but is rebuilt when switching between buffers. The mode
  354. for each buffer is stored as a list of expressions to be
  355. evaluated. Evaluating each expression enters the bindings for an
  356. associated group of keys into the vector. Incremental modes can
  357. be added or deleted by adding or deleting expressions from the
  358. list. Although changing modes is fairly time consuming (more
  359. than a few microseconds), we assume that this is rare enough that
  360. the overhead is acceptable. NOTE that simply changing an entry
  361. in the dispatch vector will not work--since any switching between Guide to EMODE 10
  362. buffers will cause the entry to be permanently lost.
  363. The dispatch "vector" is actually implemented as a
  364. combination of a true PSL vector "MainDispatch", indexed by
  365. character code, and an association list "PrefixAssociationLists"
  366. used to implement two character commands. Currently the only two
  367. character commands start with the "prefix character" C-X,
  368. although the mechanism is more general. Prefix characters are
  369. "declared" by calling the routine "define_prefix_character"
  370. (refer to code for details). Bindings for prefix-character
  371. commands are stored in PrefixAssociationLists as an association
  372. list of association lists. The top level of the list is
  373. "indexed" by the prefix character, the next level contains
  374. (character . handler) pairs indexed by the character following
  375. the prefix character.
  376. The list of expressions for building the dispatch vector is
  377. called the "mode list", and is stored in the per-buffer variable
  378. "ModeEstablishExpressions". See the following section for more
  379. on how ModeEstablishExpressions is used in the declaration of a
  380. mode. The procedure "EstablishCurrentMode" evaluates these
  381. expressions in reverse order (the last expression in the list is
  382. evaluated first) to establish the keyboard dispatch vector used
  383. for editing the current buffer. Reverse order is used so that
  384. ____ _____ the last expression added to the front of the list will be
  385. evaluated last. EstablishCurrentMode must be called after
  386. changing the mode list for the current buffer and when switching
  387. ___ _______ ____ ___ ________ to a different buffer for editing from the keyboard. The routine
  388. SelectBuffer switches to a buffer without "establishing" the
  389. buffer's mode. This saves the cost of setting up the dispatch
  390. vector when it isn't needed (which is the case for most "internal
  391. operations" on buffers).
  392. ___ The expressions in ModeEstablishExpressions can execute any
  393. code desired. This generality is rarely needed, the usual action
  394. is to call the routine SetKeys with a list of
  395. (character . handler) pairs. For example, the mode list for text
  396. mode is defined by this Lisp code:
  397. (setf FundamentalTextMode
  398. '((SetKeys TextDispatchList)
  399. (SetKeys BasicDispatchList)
  400. (NormalSelfInserts)))
  401. The RLISP mode is built "on top of" FundamentalTextMode as
  402. follows: Guide to EMODE 11
  403. (setf RlispMode
  404. (cons
  405. '(SetKeys RlispDispatchList)
  406. FundamentalTextMode))
  407. This section taken from the code that builds
  408. BasicDispatchList shows what a "key list" for the SetKeys routine
  409. should look like:
  410. (setf BasicDispatchList
  411. (list
  412. (cons (char ESC) 'EscapeAsMeta)
  413. (cons (char (cntrl U)) '$Iterate)
  414. (cons (char (cntrl Z)) 'DoControlMeta)
  415. % "C-X O" switches to "next window" (or "other
  416. % window" if in "two window mode").
  417. (cons (CharSequence (cntrl X) O) 'next_window)
  418. (cons (CharSequence (cntrl X) (cntrl F)) 'find_file)
  419. .
  420. .
  421. .
  422. Note that the pairs in a key list can specify character sequences
  423. like "(cntrl X) O" as well as single characters.
  424. At runtime, after they're created, key lists can be most
  425. easily modified by calling the routine AddToKeyList. For example
  426. (AddToKeyList
  427. 'RlispDispatchList
  428. (char (meta (cntrl Z)))
  429. 'DeleteComment)
  430. could be executed to add a new, "delete comment" handler to RLISP
  431. mode.
  432. The routine SetTextKey is equivalent to adding to the key
  433. list TextDispatchList (see code). For example
  434. (SetTextKey (char (meta !$)) 'CheckSpelling)
  435. could be executed to add a new "spelling checker" command to text
  436. mode (and other modes such as RLISP mode that incorporate text
  437. mode). SetTextKey seems to correspond most closely to EMACS's
  438. "Set Key" command. Guide to EMODE 12
  439. The routine "SetLispKey" is also defined for adding bindings
  440. to "Lisp mode". (There is no "SetRlispKey" routine in EMODE,
  441. although it would be easy to define for yourself if desired.)
  442. 6. Creating New Modes 6. Creating New Modes 6. Creating New Modes
  443. To define a new mode you must provide a "buffer creator"
  444. routine that returns a "buffer environment" with the required
  445. per-buffer variables along with any other state information
  446. needed for the type of data being edited. You need to "declare"
  447. the mode by calling the routine "declare_data_mode". It's also
  448. possible to associate the mode with a file extension by calling
  449. the routine "declare_file_mode".
  450. For example, the current EMODE declares the modes, "text"
  451. and "rlisp", as follows:
  452. (declare_data_mode "text" 'create_text_buffer)
  453. (declare_data_mode "rlisp" 'create_rlisp_buffer)
  454. (declare_file_mode "txt" 'create_text_buffer)
  455. (declare_file_mode "red" 'create_rlisp_buffer)
  456. The second argument to both routines is the "buffer creator"
  457. routine for that mode. The first argument to declare_data_mode
  458. is a "name" for the mode. The first argument to
  459. declare_file_mode is a file extension associated with that mode.
  460. The conventions for "buffer environments" are that they
  461. always include certain (name . value) pairs--i.e. that they
  462. always include certain "per-buffer" variables. These variables
  463. are:
  464. ModeEstablishExpressions
  465. A list of expressions to evaluate for
  466. establishing the keyboard bindings for the
  467. buffer's mode.
  468. buffers_file The name (a string) of a file associated with the
  469. buffer, or NIL if no file is associated with the
  470. buffer.
  471. buffers_file_reader
  472. A routine to APPLY to one argument--a PSL
  473. io-channel. The routine should read the channel
  474. into the current buffer.
  475. buffers_file_writer Guide to EMODE 13
  476. A routine to APPLY to an io-channel. The routine
  477. writes the current buffer out to that channel.
  478. buffers_view_creator
  479. A routine to create a "view" (or "window")
  480. looking into the buffer. This is described in
  481. more detail below.
  482. For example, the buffer creator for "text mode" is:
  483. (de create_text_buffer ()
  484. (cons
  485. (cons 'ModeEstablishExpressions FundamentalTextMode)
  486. (create_raw_text_buffer)))
  487. Most of the work is done by create_raw_text_buffer, which does
  488. everything but determine the keyboard bindings for the buffer.
  489. Here's the code with comments removed:
  490. (de create_raw_text_buffer ()
  491. (list
  492. (cons 'buffers_view_creator 'create_text_view)
  493. (cons
  494. 'buffers_file_reader
  495. 'read_channel_into_text_buffer)
  496. (cons
  497. 'buffers_file_writer
  498. 'write_text_buffer_to_channel)
  499. (cons 'buffers_file NIL)
  500. (cons 'CurrentBufferText (MkVect 0))
  501. (cons 'CurrentBufferSize 1)
  502. (cons 'CurrentLine NIL)
  503. (cons 'CurrentLineIndex 0)
  504. (cons 'point 0)
  505. (cons 'MarkLineIndex 0)
  506. (cons 'MarkPoint 0)
  507. ))
  508. Other modes based on text can be similarly defined by consing an
  509. appropriate binding for ModeEstablishExpressions to the
  510. environment returned by create_raw_text_buffer.
  511. Of course we need some way of "viewing" buffers once they've
  512. been created. The per-buffer variable "buffers_view_creator" is
  513. responsible for creating a view into a buffer. The "view
  514. creator" is typically invoked by the routine
  515. "select_or_create_buffer". Guide to EMODE 14
  516. The required per-view variables are:
  517. windows_refresher
  518. Which should actually be called the
  519. "views_refresher", is a routine to APPLY to no
  520. arguments. This routine is the refresh algorithm
  521. for whatever data structure this view looks into.
  522. WindowsBufferName
  523. Is the name (an ID) of the buffer that the view
  524. looks into.
  525. views_cleanup_routine
  526. A routine that's called when a view is being
  527. deleted from the screen. Different views may
  528. require different kinds of cleaning up at this
  529. point. For example, they should "deselect" any
  530. "virtual screens" that make up the view.
  531. The view creator for text structures is "create_text_view".
  532. This routine typically modifies and returns the current view
  533. (which is almost certainly also looking into text in the current
  534. system) so that the current view looks into the new text buffer.
  535. Most of the real work of creating text views is done by the
  536. routine "FramedWindowDescriptor", which is typically invoked by
  537. the routines "OneWindow" and "TwoRFACEWindows". (So, although
  538. select_or_create_buffer is one way of creating views into a
  539. buffer, there's quite a bit of freedom in using other methods for
  540. creating views.)
  541. 7. Manipulating Text Buffers 7. Manipulating Text Buffers 7. Manipulating Text Buffers
  542. The text in "text buffers" is stored as a vector of strings
  543. in the per-buffer variable "CurrentBufferText"--with the
  544. exception of a "current line" (stored in the per-buffer variable
  545. "CurrentLine"), which is a linked list of character codes. The
  546. CurrentLine is the line indexed by "CurrentLineIndex". Refer to
  547. the routine create_text_buffer for details of the contents of a
  548. text buffer.
  549. It's an easy mistake to modify CurrentLine but to forget to
  550. update the CurrentBufferText when moving to a new line. For this
  551. reason, and because the representation used for text may change
  552. in the future, you should use the utilities provided (mostly) in
  553. PES:EMODE1.RED to manipulate text. The procedure "GetLine(x)"
  554. can be used to get line x as the current line. The procedure
  555. "PutLine()" is used to store the current line back into
  556. CurrentBufferText. The procedure "SelectLine(x)" first "puts
  557. away" the current line, and then "gets" line x. Guide to EMODE 15
  558. It would seem natural to move forward a line in the text by
  559. doing something like
  560. SelectLine(CurrentLineIndex + 1);
  561. but you should resist the temptation. For one thing, SelectLine
  562. makes little attempt to check that you stay within the limits of
  563. the buffer. Furthermore, future representations of text may not
  564. use integers to index lines. For example, some future version
  565. may use a doubly linked list of "line structures" instead of a
  566. vector of strings.
  567. So, you should use the routines "NextIndex" and
  568. "PreviousIndex" to calculate new "indices" into text, and you
  569. should also check to make sure that CurrentLineIndex is within
  570. the bounds of the buffer. You can probably just use the routines
  571. "!$ForwardLine" and "!$BackwardLine", (or "!$ForwardCharacter"
  572. and "!$BackwardCharacter"). You should also read some of the
  573. code in EMODE1.RED before attempting your own modifications.
  574. (Much of the code is rather ugly, but it does seem to work!)
  575. 8. Evaluating Expressions in EMODE Buffers 8. Evaluating Expressions in EMODE Buffers 8. Evaluating Expressions in EMODE Buffers
  576. The "M-E" command for evaluating an expression in a buffer
  577. (of the appropriate mode) depends on I/O channels that read from
  578. and write to EMODE buffers. This is implemented in a fairly
  579. straightforward manner, using the general I/O hooks provided by
  580. PSL. (See the Input/Output chapter of the PSL Manual for further
  581. details.) The code for EMODE buffer I/O resides in the file
  582. RFACE.RED.
  583. The tricky part of implementing M-E is making it fit with
  584. the READ/EVAL/PRINT loop that Lisp and other front ends use. The
  585. most obvious scheme would be to have EMODE invoke one
  586. "READ/EVAL/PRINT" for each M-E typed. However, this doesn't work
  587. well when a break loop, or a user's program, unexpectedly prompts
  588. for input.
  589. Instead, the top level read functions in PSL call the "hook"
  590. function, MakeInputAvailable(), which allows the user to edit a
  591. buffer before the reader actually takes characters from the
  592. current standard input channel. Examples of top level read
  593. functions are READ (for Lisp), and XREAD (for RLISP). If you
  594. define your own read function, for example--to use with the
  595. general TopLoop mechanism, it should also call MakeInputAvailable
  596. before trying to actually read anything. Guide to EMODE 16
  597. When EMODE dispatches on M-E, it RETURNS to the routine that
  598. called it (e.g. READ), which then reads from the selected channel
  599. (which gets characters from an EMODE buffer). After evaluating
  600. the expression, the program then PRINTs to an output channel
  601. which inserts into another EMODE buffer. EMODE is then called
  602. again by the read routine (indirectly, via MakeInputAvailable).
  603. _______ __ ___ ______ The fact that EMODE returns to the reader means that
  604. different buffers cannot use different readers. This can be a
  605. bit confusing when editing several buffers with different kinds
  606. of code. Simply switching to a buffer with Lisp code does not
  607. cause the system to return to READ instead of XREAD.
  608. Implementing this would require some sort of coroutine or process
  609. mechanism--neither of which are currently provided in PSL.
  610. (However, it may be possible to provide an acceptable
  611. approximation by having M-E normally invoke a READ/EVAL/PRINT
  612. operation, while preserving the MakeInputAvailable hook for
  613. exceptional situations.)
  614. 9. Customizing EMODE for New Terminals 9. Customizing EMODE for New Terminals 9. Customizing EMODE for New Terminals
  615. The files PE:AAA.SL, PE:DM1520.SL, PE:HP2648A.SL,
  616. PE:TELERAY.SL, PE:VT52.SL, and PE:VT100.SL define the different
  617. terminal drivers currently available. Terminal drivers define
  618. some values and functions used to emit the appropriate character
  619. strings to position the cursor, erase the screen and clear to end
  620. of line. To define a new terminal, use one of the files as a
  621. guide. A listing of TELERAY.SL follows:
  622. %
  623. % TELERAY.SL - EMODE support for Teleray terminals
  624. %
  625. % Author: William F. Galway
  626. % Symbolic Computation Group
  627. % Computer Science Dept.
  628. % University of Utah
  629. % Date: 27 June 1982
  630. % Copyright (c) 1982 University of Utah
  631. %
  632. % Screen starts at (0,0), and other corner is offset by (79,23)
  633. % (total dimensions are 80 wide by 24 down).
  634. (setf ScreenBase (Coords 0 0))
  635. (setf ScreenDelta (Coords 79 23))
  636. % Parity mask is used to clear "parity bit" for those terminals
  637. % that don't have a meta key. It should be 8#177 in that case.
  638. % Should be 8#377 for terminals with a meta key. Guide to EMODE 17
  639. (setf parity_mask 8#377)
  640. (DE EraseScreen ()
  641. (progn
  642. (PBOUT (Char ESC))
  643. (PBOUT (Char (lower J)))))
  644. (DE Ding ()
  645. (PBOUT (Char Bell)))
  646. % Clear to end of line from current position (inclusive).
  647. (DE TerminalClearEol ()
  648. (progn
  649. (PBOUT (Char ESC))
  650. (PBOUT (Char K))))
  651. % Move physical cursor to Column,Row
  652. (DE SetTerminalCursor (ColLoc RowLoc)
  653. (progn
  654. (PBOUT (char ESC))
  655. (PBOUT (char Y))
  656. (PBOUT (plus (char BLANK) RowLoc))
  657. (PBOUT (plus (char BLANK) ColLoc)))) Guide to EMODE 18
  658. 10. Bibliography 10. Bibliography 10. Bibliography
  659. [Armantrout 81]
  660. Armantrout, R.; Benson, E.; Galway, W.; and Griss,
  661. M. L.
  662. ____ _ _____ ______ ______ ______ _______ __ EMID: A Multi-Window Screen Editor Written in
  663. ________ ____ Standard LISP.
  664. Utah Symbolic Computation Group Opnote No. 54,
  665. University of Utah, Department of Computer
  666. Science, January, 1981.
  667. [Carter 81] Carter, T.; Galway, W.; Goates, G.; Griss, M. L.;
  668. and Haslam, R.
  669. _____ _ ____ _____ _____ ____ ____ ______ ___ ___ SLATE: A Lisp Based EMACS Like Text Editor for SLA
  670. ______ Design.
  671. Utah Symbolic Computation Group Opnote 55,
  672. University of Utah, Department of Computer
  673. Science, January, 1981.
  674. [Carter 82] T. M. Carter.
  675. ASSASSIN: An Assembly, Specification and Analysis
  676. System for Speed-Independent Control-Unit
  677. Design in Integrated Circuits Using PPL.
  678. Master's thesis, Department of Computer Science,
  679. University of Utah, June, 1982.
  680. [Finseth 80] Finseth, C. A.
  681. ______ ___ ________ __ ____ _______ Theory and Practice of Text Editors.
  682. MIT/LCS/TM-165, Massachusetts Institute of
  683. Technology, Laboratory for Computer Science,
  684. May, 1980.
  685. [Griss 81] Griss, M. L. and Morrison, B.
  686. ___ ________ ________ ____ _____ ______ The Portable Standard LISP Users Manual.
  687. Utah Symbolic Computation Group Technical
  688. Report TR-10, University of Utah, March, 1981.
  689. [Stallman 81a] Stallman, R. M.
  690. EMACS The Extensible, Customizable Self-
  691. Documenting Display Editor.
  692. ___________ __ ___ ___ _______ _______ In Proceedings of the ACM SIGPLAN Notices
  693. _________ __ ____ ____________ Symposium on Text Manipulation, pages 147-156.
  694. ACM, New York, New York, June, 1981.
  695. [Stallman 81b] Stallman, R. M.
  696. _____ ______ ___ ______ _____ EMACS Manual for TWENEX Users.
  697. AI Memo 555, Massachusetts Institute of
  698. Technology, Artificial Intelligence Laboratory,
  699. May, 1981. Guide to EMODE 19
  700. APPENDIX A: Default Keyboard Bindings for EMODE APPENDIX A: Default Keyboard Bindings for EMODE APPENDIX A: Default Keyboard Bindings for EMODE
  701. The following commands are notable either for their
  702. difference from EMACS, or for their importance to getting started
  703. with EMODE:
  704. - To leave EMODE type C-X C-Z to "QUIT" to the EXEC, or
  705. C-Z C-Z to return to "normal" PSL input/output.
  706. - While in EMODE, the "M-?" (meta- question mark)
  707. character asks for a command character and prints the
  708. name of the routine attached to that character.
  709. - The function "PrintAllDispatch()" will print out the
  710. current dispatch table. You must call EMODE first, to
  711. set this table up.
  712. - M-C-Y inserts into the current buffer the text printed
  713. as a result of the last M-E.
  714. - M-X prompts for a one line string and then executes it
  715. as a Lisp expression. Of course, similar results can
  716. be achieved by using M-E in a buffer.
  717. A (fairly) complete table of keyboard bindings follows:
  718. C-@ Runs the function SETMARK.
  719. C-A Runs the function !$BEGINNINGOFLINE.
  720. C-B Runs the function !$BACKWARDCHARACTER.
  721. C-D Runs the function !$DELETEFORWARDCHARACTER.
  722. C-E Runs the function !$ENDOFLINE.
  723. C-F Runs the function !$FORWARDCHARACTER.
  724. Tab In Lisp mode, runs the function LISP-TAB-COMMAND.
  725. Indents as appropriate for Lisp.
  726. Linefeed In text mode, runs the function !$CRLF and acts
  727. like a carriage return.
  728. In Lisp mode, runs the function LISP-LINEFEED-
  729. COMMAND. Inserts a newline and indents as
  730. appropriate for Lisp.
  731. C-K Runs the function KILL_LINE.
  732. C-L Runs the function FULLREFRESH.
  733. Return Runs the function $CRLF (inserts a carriage
  734. return).
  735. C-N Runs the function !$FORWARDLINE.
  736. C-O Runs the function OPENLINE.
  737. C-P Runs the function !$BACKWARDLINE.
  738. C-Q Runs the function INSERTNEXTCHARACTER. Acts like
  739. a "quote" for the next character typed.
  740. C-R Backward search for string, type a carriage
  741. return to terminate the search string. Default
  742. (for a null string) is the last string previously Guide to EMODE 20
  743. searched for.
  744. C-S Forward search for string.
  745. C-T Transpose the last two characters typed (if the
  746. last character typed was self inserting).
  747. Otherwise, transpose the characters to the left
  748. and right of point, or the two characters to the
  749. left of point if at the end of a line.
  750. C-U Repeat a command. Similar to EMACS's C-U.
  751. C-V Runs the function SCROLL-WINDOW-UP-PAGE-COMMAND.
  752. C-W Runs the function KILL_REGION.
  753. C-X As in EMACS, control-X is a prefix for "fancier"
  754. commands.
  755. C-Y Runs the function INSERT_KILL_BUFFER. Yanks back
  756. killed text.
  757. C-Z Runs the function DOCONTROLMETA. As in EMACS,
  758. acts like "Control-Meta" (or "Meta-Control").
  759. ESCAPE Runs the function ESCAPEASMETA. As in EMACS,
  760. ESCAPE acts like the "Meta" key.
  761. ) Inserts a "matching" right parenthesis. Bounces
  762. back to the corresponding left parenthesis, or
  763. beeps if no matching parenthesis is found.
  764. RUBOUT Runs the function !$DELETEBACKWARDCHARACTER.
  765. M-C-@ Runs the function MARK-SEXP-COMMAND. Sets mark
  766. at the end of the s-expression following point.
  767. M-C-A In Lisp mode, runs the function BEGINNING-OF-
  768. DEFUN-COMMAND. Moves backward to the beginning
  769. of the current or previous) DEFUN. A DEFUN is
  770. heuristically defined to be a line whose first
  771. character is a left parenthesis.
  772. M-C-B Runs the function BACKWARD_SEXPR.
  773. M-C-D Runs the function DOWN-LIST. Moves "deeper" into
  774. the next contained list.
  775. M-C-E In Lisp mode, runs the function END-OF-DEFUN-
  776. COMMAND. Moves forward to the beginning of the
  777. next line following the end of a DEFUN.
  778. M-C-F Runs the function FORWARD_SEXPR.
  779. M-Backspace In Lisp mode, runs the function MARK-DEFUN-
  780. COMMAND.
  781. M-Tab In Lisp mode, runs the function LISP-TAB-COMMAND.
  782. M-C-K Runs the function KILL_FORWARD_SEXPR.
  783. M-Return Runs the function BACK-TO-INDENTATION-COMMAND.
  784. Similar to C-A, but skips past any leading
  785. blanks.
  786. M-C-N Runs the function MOVE-PAST-NEXT-LIST. Moves to
  787. _______ the right of the current or next list.
  788. M-C-O Runs the function FORWARD-UP-LIST. Moves to the
  789. _______ right of the current list.
  790. M-C-P Runs the function MOVE-PAST-PREVIOUS-LIST. Moves
  791. to the beginning of the current or previous list.
  792. M-C-Q Runs the function LISP-INDENT-SEXPR. "Lisp
  793. indents" each line in the next s-expr.
  794. M-C-U Runs the function BACKWARD-UP-LIST. Does the Guide to EMODE 21
  795. "opposite" of FORWARD-UP-LIST.
  796. M-C-Y In Lisp and Rlisp mode runs the function
  797. INSERT_LAST_EXPRESSION. Inserts the last body of
  798. text typed as the result of a M-E.
  799. M-C-Z Runs the function OLDFACE. Leaves EMODE, goes
  800. back to "regular" PSL input/output.
  801. M-Escape In Lisp mode, runs the function BEGINNING-OF-
  802. DEFUN-COMMAND. (See M-C-A.)
  803. M-C-] In Lisp mode, runs the function END-OF-DEFUN-
  804. COMMAND. (See M-C-E.)
  805. M-C-RUBOUT Runs the function KILL_BACKWARD_SEXPR.
  806. M-% Runs the function QUERY-REPLACE-COMMAND. Similar
  807. to EMACS's query replace.
  808. M-( Runs the function INSERT-PARENS. Inserts a
  809. matching pair of parenthesis, leaving point
  810. between them.
  811. M-) Runs the function MOVE-OVER-PAREN. Moves over a
  812. ")" updating indentation (as appropriate for
  813. Lisp).
  814. M-/ Runs the function !$HELPDISPATCH, see the
  815. description of M-? below.
  816. M-; In Lisp and Rlisp mode runs the function
  817. INSERTCOMMENT.
  818. M-< Runs the function !$BEGINNINGOFBUFFER. Move to
  819. beginning of buffer.
  820. M-> Runs the function !$ENDOFBUFFER. Move to end of
  821. buffer.
  822. M-? Runs the function !$HELPDISPATCH. Asks for a
  823. character and prints the name of the routine
  824. attached to that character.
  825. M-@ Runs the function MARK-WORD-COMMAND.
  826. M-B Runs the function BACKWARD_WORD. Backs up over a
  827. word.
  828. M-D Runs the function KILL_FORWARD_WORD.
  829. M-E In Lisp and RLISP modes evaluates the expression
  830. starting at the beginning of the current line.
  831. M-F Runs the function FORWARD_WORD. Moves forward
  832. over a word.
  833. M-M Runs the function BACK-TO-INDENTATION-COMMAND.
  834. (See M-Return for more description.)
  835. M-V Runs the function SCROLL-WINDOW-DOWN-PAGE-
  836. COMMAND. Moves up a window.
  837. M-W Runs the function COPY_REGION. Like C-W only it
  838. doesn't kill the region.
  839. M-X Runs the function EXECUTE_COMMAND. Prompts for a
  840. string and then converts it to Lisp expression
  841. and evaluates it.
  842. M-Y Runs the function UNKILL_PREVIOUS. Used to cycle
  843. through the kill buffer. Deletes the last yanked
  844. back text and then proceeds to yank back the
  845. previous piece of text in the kill buffer.
  846. M-\ Runs the function DELETE-HORIZONTAL-SPACE- Guide to EMODE 22
  847. COMMAND. Deletes all blanks (and tabs) around
  848. point.
  849. M-^ Runs the function DELETE-INDENTATION-COMMAND.
  850. Deletes CRLF and indentation at front of line,
  851. leaves one space in place of them.
  852. M-RUBOUT Runs the function KILL_BACKWARD_WORD.
  853. C-X C-B Runs the function PRINTBUFFERNAMES. Prints a
  854. list of all the buffers present.
  855. C-X C-F Runs the function FIND_FILE. Asks for a filename
  856. and then selects the buffer that that file
  857. resides in, or creates a new buffer and reads the
  858. file into it.
  859. C-X C-O Runs the function DELETE-BLANK-LINES-COMMAND.
  860. Deletes blank lines around point (leaving one
  861. left).
  862. C-X C-P Runs the function WRITESCREENPHOTO. Write a
  863. "photograph" of the screen to a file.
  864. C-X C-R Runs the function CNTRLXREAD. Read a file into
  865. the buffer.
  866. C-X C-S Runs the function SAVE_FILE. Writes the buffer
  867. to the file associated with that buffer, asks for
  868. an associated file if none defined.
  869. C-X C-W Runs the function CNTRLXWRITE. Write the buffer
  870. out to a file.
  871. C-X C-X Runs the function EXCHANGEPOINTANDMARK
  872. C-X C-Z As in EMACS, exits to the EXEC.
  873. C-X 1 Goes into one window mode.
  874. C-X 2 Goes into two window mode.
  875. C-X B Runs the function CHOOSEBUFFER. EMODE asks for a
  876. buffer name, and then selects (or creates) that
  877. buffer for editing.
  878. C-X H Runs the function MARK-WHOLE-BUFFER-COMMAND.
  879. C-X N Runs the function NEXT_WINDOW. Selects the
  880. "next" window in the list of active windows.
  881. Note that some active windows may be covered by
  882. other screens, so they will be invisible until
  883. C-X N reaches them and "pops" them to the "top"
  884. of the screen.
  885. C-X O An alternate way to invoke NEXT_WINDOW.
  886. C-X P Runs the function PREVIOUS_WINDOW. Selects the
  887. "previous" window in the list of active windows. Guide to EMODE 23
  888. APPENDIX B: Some Important Fluid Variables APPENDIX B: Some Important Fluid Variables APPENDIX B: Some Important Fluid Variables
  889. Here is an incomplete list of the fluid ("global") variables
  890. in EMODE.
  891. *outwindow A flag for PSL's ON/OFF mechanism. When T, means
  892. that the "output" (or OUT_WINDOW) window should
  893. be "popped up" when output occurs.
  894. *EMODE T when EMODE is running. (Not quite the same as
  895. "runflag" described below. For example, runflag
  896. will be set NIL to cause EMODE to leave a
  897. "recursive edit", but *EMODE stays T.)
  898. *RAWIO T when "raw I/O" is in effect.
  899. BasicDispatchList
  900. The "key list" for "basic" operations.
  901. BreakWindow The view for the "popup" break window.
  902. BufferNames An association list of the
  903. (name . buffer-environment) pairs for all the
  904. buffers.
  905. CurrentBufferName
  906. The name of the currently selected buffer.
  907. CurrentBufferSize
  908. A per-buffer variable for text buffers, gives
  909. number of lines actually within buffer.
  910. CurrentBufferText
  911. A per-buffer variable for text buffers. A vector
  912. of lines making up the buffer.
  913. CurrentLine A per-buffer variable for text buffers. The
  914. contents (text) of current line--as a linked list
  915. of character codes. (Takes precedence over
  916. whatever is contained in the text vector.)
  917. CurrentLineIndex
  918. A per-buffer variable for text buffers. Index of
  919. the "current line" within buffer.
  920. CurrentVirtualScreen
  921. Per-view variable for text windows (views), holds
  922. the virtual screen used by the view.
  923. CurrentWindowDelta
  924. Per-view variable for text windows, gives window
  925. dimensions as (delta x . delta y).
  926. CurrentWindowDescriptor
  927. The currently selected window environment.
  928. declared_data_modes
  929. List of (mode-name . buffer-creator) pairs for
  930. all the declared modes.
  931. declared_file_extensions
  932. List of (file-extension . buffer-creator) pairs
  933. for all modes with declared file extensions. Guide to EMODE 24
  934. EmodeBufferChannel
  935. Channel used for EMODE I/O. Perhaps this should
  936. be expanded to allow different channels for
  937. different purposes (break loops, error messages,
  938. etc.) (Or, perhaps the whole model needs more
  939. thought! )
  940. FirstCall NIL means re-entering EMODE, T means first time.
  941. FundamentalTextMode
  942. Mode list (list of expressions) for establishing
  943. "fundamental" text mode.
  944. kill_buffer_ring
  945. Vector of vectors of strings--holds recently
  946. deleted text.
  947. kill_opers list of (names of) handler routines that kill
  948. text. NEEDS MORE DOCUMENTATION!
  949. kill_ring_index Pointer to the most recent "kill buffer".
  950. last_buffername Name (a string) of the last buffer visited.
  951. last_operation The "last" routine dispatched to (before the
  952. "current operation").
  953. last_search_string
  954. The last string searched for by a search
  955. command--used as default for next search command.
  956. last_yank_point Vector of [buffer lineindex point], giving
  957. location where last "yank" occured.
  958. LispDispatchList
  959. The "key list" for Lisp mode.
  960. LispMode The mode list for Lisp mode.
  961. MainDispatch Dispatch table (vector), an entry for each key.
  962. minor_window_list
  963. List of windows to be ignored by the
  964. "next_window" routine.
  965. ModeEstablishExpressions
  966. List of expressions to be evaluated. Each
  967. expression is expected to modify (add to?) the
  968. dispatch table.
  969. OldErrOut The error output channel in effect before EMODE
  970. was started.
  971. OldStdIn The standard input channel in effect before EMODE
  972. was started.
  973. OldStdOut The standard output channel in effect before
  974. EMODE was started.
  975. point A per-buffer variable for text buffers. Number
  976. of chars to the left of point within CurrentLine.
  977. PrefixAssociationLists
  978. Additional dispatch information for prefixed
  979. characters.
  980. PrefixCharacterList
  981. A list of the declared prefix characters. Guide to EMODE 25
  982. pushed_back_characters
  983. A list of characters pushed back for EMODE's
  984. command reader. This may be used when a command
  985. isn't recognized by one dispatcher, so it can
  986. push the characters back and pass control to
  987. another dispatcher.
  988. reading_from_output
  989. Kludge flag, T when input buffer is OUT_WINDOW
  990. buffer (for M-E).
  991. RlispDispatchList
  992. The "key list" for RLISP mode.
  993. RlispMode The mode list for RLISP mode.
  994. runflag EMODE continues its READ/DISPATCH/REDISPLAY until
  995. this flag is NIL.
  996. SelfInsertCharacter
  997. Character being dispatched upon. (Usually the
  998. last character typed.)
  999. ShiftDisplayColumn
  1000. Amount to shift things to the left by before
  1001. (re)displaying lines in a text view.
  1002. TextDispatchList
  1003. The "key list" for fundamental text mode.
  1004. Two_window_midpoint
  1005. Gives location (roughly) of dividing line for two
  1006. window mode.
  1007. WindowList List of active windows (views).
  1008. WindowsBufferName
  1009. Required per-view variable giving the name of the
  1010. buffer being viewed.
  1011. Windows_Refresher
  1012. Required per-view variable giving the refresh
  1013. algorithm to be APPLYed for this view.
  1014. Window_Image Per-view variable for text views, holding
  1015. information for speeding up refresh. Guide to EMODE i
  1016. Table of Contents Table of Contents Table of Contents
  1017. 1. Introduction and Acknowledgments 1
  1018. 2. Running EMODE 1
  1019. 3. A Guide to the Sources and Rebuilding 6
  1020. 4. Terminology: Buffers, Views/Windows, and Virtual Screens 7
  1021. 5. Modes and Key bindings in EMODE 9
  1022. 6. Creating New Modes 12
  1023. 7. Manipulating Text Buffers 14
  1024. 8. Evaluating Expressions in EMODE Buffers 15
  1025. 9. Customizing EMODE for New Terminals 16
  1026. 10. Bibliography 18
  1027. APPENDIX A: Default Keyboard Bindings for EMODE 19
  1028. APPENDIX B: Some Important Fluid Variables 23 Guide to EMODE ii
  1029. List of Figures List of Figures List of Figures
  1030. Figure 2-1: Figure 2-1: Figure 2-1: Two window mode 3
  1031. Figure 2-2: Figure 2-2: Figure 2-2: One window mode 4
  1032. Figure 2-3: Figure 2-3: Figure 2-3: A break window (doctored from the original) 5