zpedit.doc 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. THE UCI-LISP EDITOR
  2. (Translated to Standard LISP)
  3. SLISP provides an extremely powerful form-oriented editor. This
  4. facility allows the user to easily alter function definitions,
  5. variable values and property list entries. It thereby makes it
  6. entirely unnecessary for the user to employ a conventional text
  7. editor in the maintenance of programs. This document is a guide
  8. to using the editor. Certain features of the UCI-LISP editor have
  9. not been incorporated in the translated editor, and we have tried
  10. to mark all such differences.
  11. Section 1: User Entry to Editor
  12. This section describes normal user entry to the editor (EDITF,
  13. EDITP and EDITV) and the editing commands which are available.
  14. This section is by no means complete. In particular, material
  15. covering programmed calls to the editor routines is not treated.
  16. Consult the UCI LISP manual for further details.
  17. To edit a function named FOO do
  18. *(EDITF FOO)
  19. To edit the value of an atom named BAZ do
  20. *(EDITV FOO)
  21. To edit the property list of an atom named FOOBAZ do
  22. *(EDITP FOO)
  23. Warning, editing the property list of an atom may position pointers at
  24. unprintable structures. It is best to use the F (find) command before
  25. trying to print property lists. This editor capability is variable from
  26. implementation to implementatio.
  27. The Editor will prompt with
  28. -E-
  29. *
  30. You can then input any editor command. The input scanner is not very smart.
  31. It terminaes its scan and begins processing when it sees a printable character
  32. immediately followed by a carriage return. Do not use escape to terminate
  33. an editor command. If the editor seems to be repeatedly requesting input
  34. type P<ret> (print the current expression) or some other command that will
  35. ordinarily do no damage, but will terminate the input soliciitation.
  36. The following set of topics makes a good 'first glance' at the
  37. editor.
  38. Entering the editor: EDITF, EDITV.
  39. Leaving the editor: OK.
  40. Editor's attention: CURRENT-EXP.
  41. Changing attention: POS-INTEGER, NEG-INTEGER, 0, ^, NX, BK.
  42. Printing: P, PP.
  43. Modification: POS-INTEGER, NEG-INTEGER, A, B, :, N.
  44. Changing parens: BI, BO.
  45. Undoing changes: UNDO.
  46. For the more discriminating user, the next topics might be some
  47. of the following.
  48. Searches: PATTERN, F, BF.
  49. Complex commands: R, SW, XTR, MBD, MOVE.
  50. Changing parens: LI, LO, RI, RO.
  51. Undoing changes: TEST, UNBLOCK, !UNDO.
  52. Other features should be skimmed but not studied until it appears
  53. that they may be useful.
  54. SECTION 2: Editor Command Reference
  55. (A exp1 exp2 ... expn) edit cmnd
  56. This command inserts exp1 thru expn (arbitrary LISP expressions)
  57. after the current expression. This is accomplished by doing an UP
  58. and a (-2 exp1 exp2 ... expn) or an (N exp1 exp2 ... expn), as
  59. appropriate. Note the way in which the current expression is
  60. changed by the UP.
  61. (B exp1 exp2 ... expn) edit cmnd
  62. This command inserts exp1 thru expn (arbitrary LISP forms) before
  63. the current expression. This is accomplished by doing an UP
  64. followed by a (-1 exp1 exp2 ... expn). Note the way in which the
  65. current expression is changed by the UP.
  66. (BELOW com n) edit cmnd
  67. This command changes the current expression in the following manner.
  68. The edit command com is executed. If com is not a recognized
  69. command, then (_ com) is executed instead. Note that com should
  70. cause ascent in the edit chain (i.e., should be equivalent to
  71. some number of zeroes). BELOW then evaluates (note!) n and
  72. descends n links in the resulting edit chain. That is, BELOW
  73. ascends the edit chain (does repeated 0s) looking for the link
  74. specified by com and stops n links below that (backs off n 0s).
  75. If n is not given, 1 is assumed.
  76. BF pat edit cmnd
  77. (BF pat flg) edit cmnd
  78. This command performs a backwards find, searching for pat (an
  79. edit pattern). Search begins with the expression immediately
  80. before the current expression and proceeds in reverse print
  81. order. (If the current expression is the top level expression,
  82. the entire expression is searched in reverse print order.)
  83. Search begins at the end of each list, and descends into each
  84. element before attempting to match that element. If the match
  85. fails, proceed to the previous element, etc. until the front
  86. of the list is reached. At that point, BF ascends and backs
  87. up, etc.
  88. The search algorithm may be slightly modified by use of the second
  89. form of the command. Possible flgs and their meanings are as
  90. follows.
  91. T - begins search with the current expression rather than
  92. with the preceeding expression at this level.
  93. NIL or missing - same as BF pat.
  94. NOTE: if the variable UPFINDFLG is non-NIL, the editor does
  95. an UP after the expression matching pat is located. Thus,
  96. doing a BF for a function name yields a current expression
  97. which is the entire function call. If this is not desired,
  98. UPFINDFLG may be set to NIL. UPFINDFLG is initially T.
  99. BF is protected from circular searches by the variable MAXLEVEL.
  100. If the total number of CARs and CDRs descended into reaches
  101. MAXLEVEL (initially 300), search of that tail or element is
  102. abandoned exactly as though a complete search had failed.
  103. (BI n1 n2) edit cmnd
  104. This command inserts a pair of parentheses in the current
  105. expression. (Note that parentheses are ALWAYS balanced, and
  106. hence must be added or removed in pairs.) A left paren is
  107. inserted before element n1 of the current expression. A right
  108. paren is inserted after element n2 of the current expression.
  109. Both n1 and n2 are usually integers, and element n2 must be to
  110. the right of element n1.
  111. (BI n1) is equivalent to (BI n1 n1).
  112. The NTH command is used in the search, so that n1 and n2 may
  113. be any location specifications. The expressions used will
  114. be the first element of the current expression in which the
  115. specified form is found at any level.
  116. (BIND coms) edit cmnd
  117. This command provides the user with temporary variables for
  118. use during the execution of the sequence of edit commands coms.
  119. There are three variables available: #1, #2 and #3. The binding
  120. is recursive and BIND may be executed recursively if necessary.
  121. All variables are initialized to NIL. This feature is useful
  122. chiefly in defining edit macros.
  123. BK edit cmnd
  124. The current expression becomes the expression immediately preceeding
  125. the present current expression. This command generates an error
  126. if the current expression is the first expression in the list.
  127. (BO n) edit cmnd
  128. The BO command removes a pair of parentheses from the nth element
  129. of the current expression. The parameter n is usually an integer.
  130. The NTH command is used in the search, however, so that any
  131. location specification may be used. The expression referenced is
  132. the first element of the current expression in which the specified
  133. form is found at any level.
  134. (CHANGE loc TO exp1 exp2 ... expn) edit cmnd
  135. This command replaces the current expression after executing the
  136. location specification loc by exp1 ... expn.
  137. (COMS arg1 arg2 ... argn) edit cmnd
  138. This command evaluates its argi and executes them as edit commands.
  139. (COMSQ com1 com2 ... comn) edit cmnd
  140. This command executes each comi as an edit command
  141. At any given time, the attention of the editor is focused on a
  142. single expression or form. We call that form the current expression.
  143. Editor commands may be divided into two broad classes. Those
  144. commands which change the current expression are called attention-
  145. changing commands. Those commands which modify structure are
  146. called structure modification commands.
  147. DELETE edit cmnd
  148. This command deletes the current expression. If the current
  149. expression is a tail, only the first element is deleted. This
  150. command is equivalent to (:).
  151. E form edit cmnd
  152. (E form) edit cmnd
  153. (E form T) edit cmnd
  154. This command evaluates form. The first form of the command is
  155. valid only when typed in from the TTY. (E form) evaluates form
  156. and prints the value on the terminal. The form (E form T)
  157. evaluates form but does not print the result.
  158. (EDITF fn coms) fsubr
  159. This function initiates editing of the function whose name is
  160. fn. The argument coms is an optional sequence of edit
  161. commands. If coms is present, no terminal input is requested
  162. or required. The commands in coms are executed and EDITF
  163. returns fn. If coms is not present, then the editor will
  164. ask for keyboard input.
  165. (EDITFNS fn-list coms) fsubr
  166. This function applies the sequence of editor commands, coms, to each
  167. of several functions. The argument fn-list is evaluated, and should
  168. evaluate to a list of function names. Coms will be applied to each
  169. function in fn-list, in turn. Errors in editing one function will
  170. not affect editing of others. The editor call is via EDITF, so that
  171. values may also be edited in this way. The value of the function
  172. is NIL.
  173. (EDITP at coms) fsubr
  174. This function initiates editing of the property list of the
  175. atom whose name is at. The argument coms is a possibly null
  176. sequence of edit commands which will be executed before calling
  177. for input from the terminal.
  178. (EDITV at coms) fsubr
  179. This function initiates editing of the value of the atom whose
  180. name is at. The argument coms is a possibly null sequence of
  181. edit commands which will be executed before calling for input
  182. from the terminal.
  183. (EMBED loc IN arg) edit cmnd
  184. This command replaces the expression which would be current after
  185. executing the location specification loc by another expression
  186. which has that expression as a sub-expression. The manner in
  187. which the transformation is carried out depends on the form of
  188. arg. If arg is a list, then each occurrence of the atom '*' in
  189. arg is replaced by the expression which would be current after
  190. doing loc. (NOTE: a fresh copy is used for each substitution.)
  191. If arg is atomic, the result is equivalent to:
  192. (EMBED loc IN (arg *)).
  193. A call of the form (EMBED loc IN exp1 exp2 ... expn) is equivalent
  194. to:
  195. (EMBED loc IN (exp1 exp2 ... expn *)).
  196. If the expression after doing loc is a tail, EMBED behaves as
  197. though the expression were the first element of that tail.
  198. (EXTRACT loc1 FROM loc2) edit cmnd
  199. This command replaces the expression which would be current after
  200. doing the location specification loc2 by the expression which
  201. would be current after doing loc1. The expression specified
  202. by loc1 must be a sub-expression of that specified by loc2.
  203. F pat edit cmnd
  204. (F pat flg) edit cmnd
  205. This command causes the next command, pat, to be interpreted
  206. as a pattern. The current expression is searched for the
  207. next occurrence of pat. If pat is a top level element of the
  208. current expression, then pat matches that top level occurrence
  209. and a full recursive search is not attempted. Otherwise, the
  210. search proceeds in print order. Recursion is done first in
  211. the CAR and then in the CDR direction.
  212. The second form of the command, (F pat flg) may be used to
  213. modify the search algorithm according to the value of flg.
  214. Possible values and their actions are:
  215. N - suppresses the top-level check. That is, finds
  216. the next print order occurrence of pat regardless
  217. of any top level occurrences.
  218. T - like N, but may succeed without changing the
  219. current expression. That is, succeeds even
  220. when the current expression itself is the
  221. only occurrence of pat.
  222. positive integer - finds the nth place at which pat is
  223. matched. This is equivalent to (F pat T)
  224. followed by n-1 (F pat N)s. If n occurrences
  225. are not found, the current expression is unchanged.
  226. NIL or missing - Only searches top level elements of the
  227. current expression. May succeed without changing
  228. the current expression.
  229. NOTE: If the variable UPFINDFLG is non-NIL, F does an UP after
  230. locating a match. This ensures that F fn, where fn is a function
  231. name, will result in a current expression which is the entire
  232. function call. If this is undesirable, set UPFINDFLG to NIL.
  233. Its initial value is T.
  234. As protection against searching circular lists, the search will
  235. be abandoned if the total number of CAR-CDR descents exceeds
  236. the value of the variable MAXLEVEL. (The initial value is
  237. 300.) The search fails just as if the entire element had
  238. been unsuccessfully searched.
  239. (FS pat1 pat2 ... patn) edit cmnd
  240. The FS command does sequential finds. That is, it searches
  241. (in print order) first for pat1, then for pat2, etc. If any
  242. search fails, the current expression is left at that form which
  243. matched in the last successful search. This command is,
  244. therefore, equivalent to a sequence of F commands.
  245. (F= exp flg) edit cmnd
  246. This command is equivalent to (F (== exp) flg). That is, it
  247. searches, in the manner specified by flg, for a form which is EQ
  248. to exp. Note that for keyboard typeins, this will always fail
  249. unless exp is atomic.
  250. HELP edit cmnd
  251. This command provides an easy way of invoking the HELP system
  252. from the editor.
  253. (I com arg1 arg2 ... argn) edit cmnd
  254. This command evaluates the argi and executes com on the resulting
  255. values. This command is thus equivalent to:
  256. (com val1 val2 ... valn),
  257. where each vali is equal to (EVAL argi).
  258. (IF arg) edit cmnd
  259. This command, useful in edit macros, conditionally causes an
  260. editor error. If (EVAL arg) is NIL (or if evaluation of arg
  261. causes a LISP error), then IF generates an editor error.
  262. (INSERT exp1 exp2 ... expn AFTER loc) edit cmnd
  263. (INSERT exp1 exp2 ... expn BEFORE loc) edit cmnd
  264. (INSERT exp1 exp2 ... expn FOR loc) edit cmnd
  265. The INSERT command provides equivalents of the A, B and : commands
  266. incorporating a location specification, loc. This command inserts
  267. exp1 thru expn AFTER, BEFORE or FOR (in place of) the expression
  268. which is current after executing loc. Note, however, that the
  269. current expression is not changed.
  270. (LC loc) edit cmnd
  271. This command, which takes as an argument a location specification,
  272. explicitly invokes the location specification search. The current
  273. expression is changed to that which is current after executing loc.
  274. See LOC-SPEC for details on the definition of loc and the search
  275. method in question.
  276. (LCL loc) edit cmnd
  277. This command, which takes as an argument a location specification,
  278. explicitly invokes the location specification search. However,
  279. the search is limited to the current expression itself. The
  280. current expression is changed to that which is current after
  281. executing loc.
  282. (LI n) edit cmnd
  283. This command inserts a left parenthesis (and, of course, a matching
  284. right paren). The left paren is inserted before the nth element
  285. of the current expression and the right paren at the end of the
  286. current expression. Thus, this command is equivalent to
  287. (BI n -1).
  288. The NTH command is used in the search, so that n, which is usually
  289. an integer, may be any location specification. The expression
  290. referenced is the first element of the current expression which
  291. contains the form specified at any level.
  292. (LO n) edit cmnd
  293. This command removes a left parenthesis (and a matching right
  294. paren, of course) from the nth element of the current expression.
  295. All elements after the nth are deleted.
  296. The command uses the NTH command for the search. The parameter n,
  297. which is usually an integer, may be any location specification.
  298. The expression actually referenced is the first element of the
  299. current expression which contains the specified form at any depth.
  300. Many of the more complex edit commands take as an argument a
  301. location specification (abbreviated loc throughout this
  302. document). A location specification is a list of edit commands,
  303. which are, with two exceptions, executed in the normal way.
  304. Any command not recognized by the editor is treated as though
  305. it were preceeded by F. Furthermore, if one of the commands
  306. causes an error and the current expression has been changed by
  307. prior commands, the location operation continues rather than
  308. aborting. This is a sort of back-up operation. For example,
  309. suppose the location specification is (COND 2 3), and the
  310. first clause of the first COND has only 2 forms. The location
  311. operation will proceed by searching for the next COND and
  312. trying again. If a point were reached in which there were
  313. no more CONDs, the location operation would then fail.
  314. (LP coms) edit cmnd
  315. This command, useful in macros, repeatedly executes coms (a sequence
  316. of edit commands) until an editor error occurs. When LP exits,
  317. it prints the number of OCCURRENCES; that is, the number of times
  318. coms was successfully executed. After execution of the command,
  319. the current expression is left at what it was after the last complete
  320. successful execution of coms.
  321. The command terminates if the number of iterations exceeds the value
  322. of the variable MAXLOOP (initially 30).
  323. (LPQ coms) edit cmnd
  324. This command, useful in macros, repeatedly executes coms (a sequence
  325. of edit commands) until an editor error occurs. After execution
  326. of the command, the current expression is left at what it was after
  327. the last complete successful execution of coms.
  328. The command terminates if the number of iterations exceeds the
  329. value of the variable MAXLOOP (initially 30).
  330. This command is equivalent to LP, except that OCCURRENCES is not
  331. printed.
  332. (M nam coms) edit cmnd
  333. (M (nam) (arg1 arg2 ... argn) coms) edit cmnd
  334. (M (nam) arg coms) edit cmnd
  335. The editor provides the user with a macro facility. The user
  336. may define frequently used command sequences to be edit macros,
  337. which may then be invoked simply by giving the macro name as
  338. an edit command. The M command provides the user with a
  339. method of defining edit macros.
  340. The first form of the command defines an atomic command which takes
  341. no arguments. The argument nam is the atomic name of the macro.
  342. This defines nam to be an edit macro equivalent to the sequence
  343. of edit commands coms. If nam previously had definition as an
  344. edit macro, the new definition replaces the old. NOTE: edit
  345. command names take precedence over macros. It is not possible
  346. to redefine edit command names.
  347. The second form of the M command defines a list command, which
  348. takes a fixed number of arguments. In this case, nam is defined
  349. to be an edit macro equivalent to the sequence of edit commands
  350. coms. However, when (nam exp1 exp2 ... expn) is executed, the
  351. expi are substituted for the corresponding argi in coms before
  352. coms are executed.
  353. The third form of the M command defines a list command which may
  354. take an arbitrary number of arguments. Execution of the macro
  355. nam is accomplished by substituting (exp1 exp2 ... expn) (that
  356. is, the CDR of the macro call (nam exp1 exp2 ... expn)) for
  357. all occurrences of the atom arg in coms, and then executing
  358. coms.
  359. (MAKEFN (nam vars) args n1 n2) edit cmnd
  360. This command defines a portion of the current expression as a
  361. function and replaces that portion of the expression by a call
  362. to the function. The form (nam vars) is the call which replaces
  363. the n1st thru n2nd elements of the current expression. Thus,
  364. nam is the name of the function to be defined. Vars is a sequence
  365. of local variables (in the current expression), and args is a
  366. list of dummy variables. The function definition is formed by
  367. replacing each occurrence of an element in vars (the CDR of
  368. (nam vars)) by the corresponding element of args. Thus, args
  369. are the names of the formal parameters in the newly defined
  370. function.
  371. If n2 is omitted, it is assumed equal to n1.
  372. MARK edit cmnd
  373. This command saves the current position within the form in such
  374. a way that it can later be returned to. The return is accomplished
  375. via _ or __.
  376. (MBD arg) edit cmnd
  377. This command replaces the current expression by some form which
  378. has the current expression as a sub-expression. If arg is a
  379. list, MBD substitutes a fresh copy of the current expression for
  380. each occurrence of the atom '*' in arg. If arg is a sequence
  381. of expressions, as:
  382. (MBD exp1 exp2 ... expn),
  383. then the call is equivalent to one of the form:
  384. (MBD (exp1 exp2 ... expn *)).
  385. The same is true if arg is atomic:
  386. (MBD atom) = (MBD (atom *)).
  387. (MOVE loc1 TO com loc2) edit cmnd
  388. The MOVE command allows the user to move structure from one point
  389. to another. The user may specify the form to be moved (via loc1,
  390. the first location specification), the position to which it is
  391. to be moved (via loc2, the second location specification) and
  392. the action to be performed there (via com). The argument com
  393. may be BEFORE, AFTER or the name of a list command (e.g., :,
  394. N, etc.). This command performs in the following manner. Take
  395. the current expression after executing loc1 (or its first element,
  396. if it is a tail); call it expr. Execute loc2 (beginning at the
  397. current expression AS OF ENTRY TO MOVE -- NOT the expression which
  398. would be current after execution of loc1), and then execute
  399. (com expr). Now go back and delete expr from its original
  400. position. The current expression is not changed by this command.
  401. If loc1 is NIL (that is, missing), the current expression is moved.
  402. In this case, the current expression becomes the result of
  403. the execution of (com expr).
  404. If loc2 is NIL (that is missing) or HERE, then the current
  405. expression specifies the point to which the form given by
  406. loc2 is to be moved.
  407. (N exp1 exp2 ... expn) edit cmnd
  408. This command adds exp1 thru expn to the end of the current
  409. expression. This compensates for the fact that the negative
  410. integer command does not allow insertion after the last element.
  411. -n edit cmnd
  412. (-n exp1 exp2 ... expn) edit cmnd
  413. This is really two separate commands. The atomic form is an
  414. attention changing command. The current expression becomes the
  415. nth form from the end of the old current expression. That is,
  416. -1 specifies the last element, -2 the second from last, etc.
  417. The list form of the command is a structure modification command.
  418. This command inserts exp1 thru expn (at least one expi must be
  419. present) before the nth element (counting from the BEGINNING)
  420. of the current expression. That is, -1 inserts before the
  421. first element, -2 before the second, etc.
  422. (NEX com) edit cmnd
  423. NEX edit cmnd
  424. This command is equivalent to (BELOW com) followed by NX. That
  425. is, it does repeated 0s until a current expression matching
  426. com is found. It then backs off by one 0 and does a NX.
  427. The atomic form of the command is equivalent to (NEX _). This
  428. is useful if the user is doing repeated (NEX x)s. He can
  429. MARK at x and then use the atomic form.
  430. (NTH loc) edit cmnd
  431. This command effectively performs (LCL loc), (BELOW <), UP.
  432. The net effect is to search the current expression only for the
  433. form specified by the location specification loc. From there,
  434. return to the initial level and set the current expression to
  435. be the tail whose first element contains the form specified by
  436. loc at any level.
  437. NX edit cmnd
  438. (NX n) edit cmnd
  439. The atomic form of this command makes the current expression the
  440. expression following the present current expression (at the
  441. same level).
  442. The list form of the command is equivalent to n (an integer number)
  443. repetitions of NX. If an error occurs (e.g., if there are not
  444. n expressions following the current expression), the current
  445. expression is unchanged.
  446. OK edit cmnd
  447. This command causes normal exit from the editor.
  448. The state of the edit will be saved on property LASTVALUE of the
  449. atom EDIT. If the next form edited is the same, the edit will
  450. be restored. That is, it will be (with the exception of a
  451. BLOCK on the undo-list) as though the editor had never been
  452. exited.
  453. It is possible to save edit states for more than one form by
  454. exiting from the editor via the SAVE command.
  455. (ORF pat1 pat2 ... patn) edit cmnd
  456. This command searches the current expression, in print order,
  457. for the first occurrence of any form which matches one of the
  458. pati. When found, an UP is executed, and the current expression
  459. becomes the expression so specified. This command is equivalent
  460. to (F (*ANY* pat1 pat2 ... patn) N). Note that the top level
  461. check is not performed.
  462. (ORR coms1 coms2 ... comsn) edit cmnd
  463. This command operates in the following manner. Each comsi is a
  464. list of edit commands. ORR first executes coms1. If no error
  465. occurs, ORR terminates, leaving the current expression as it
  466. was at the end of executing coms1. Otherwise, it restores the
  467. current expression to what it was on entry and repeats this
  468. operation on coms2, etc. If no comsi is successfully executed
  469. without error, ORR generates an error and the current expression
  470. is unchanged.
  471. P edit cmnd
  472. (P n1) edit cmnd
  473. (P n1 n2) edit cmnd
  474. This command prints the current expression. The atomic form of
  475. the command prints the current expression to a depth of 2.
  476. More deeply nested forms are printed as &.
  477. The second form of the command, (P n1) prints the n1st element of
  478. the current expression to a depth of 2. The argument, n1, need
  479. not be an integer. It may be a general location specification.
  480. The NTH command is used in the search, so that the expression
  481. printed will be the first element of the current expression
  482. which contains the desired form at any level.
  483. The third form of the command prints the n1st element of the
  484. current expression to a depth of n2. Again, n1 may be a general
  485. location specification.
  486. If n1 is 0, the current expression is printed.
  487. Many of the editor commands, particularly those which search,
  488. take as an argument a pattern (abbreviated pat). A pattern
  489. may be any combination of literal list structure and special
  490. pattern elements.
  491. The special elements are as follows.
  492. & - this matches any single element.
  493. *ANY* - if (CAR pat) is the atom *ANY*, then (CDR pat)
  494. must be a list of patterns. Pat matches any
  495. form which matches any of the patterns in (CDR pat).
  496. @ - if an element of pat is a literal atom whose last
  497. character is @, then that element matches any
  498. literal atom whose initial characters match the
  499. initial characters of the element. That is,
  500. VER@ matches VERYLONGATOM.
  501. -- - this matches any tail of a list or any interior
  502. segment of a list.
  503. == - if (CAR pat) is ==, then pat matches X iff (CDR pat)
  504. is EQ to X.
  505. ::: - if pat begins with :::, the CDR of pat is matched
  506. against tails of the expression.
  507. n edit cmnd
  508. (n exp1 exp2 ... expn) edit cmnd
  509. This command, a strictly positive integer n, is really two
  510. commands. The atomic form of the command is an attention-
  511. changing command. The current expression becomes the nth
  512. element of the current expression.
  513. The list form of the command is a structure modification command.
  514. It replaces the nth element of the current expression by the
  515. forms exp1 thru expn. If no forms are given, then the nth element
  516. of the current expression is deleted.
  517. PP edit cmnd
  518. This command pretty-prints the current expression.
  519. (R exp1 exp2) edit cmnd
  520. This command replaces all occurrences of exp1 by exp2 in the
  521. current expression.
  522. Note that exp1 may be either the literal s-expression to be
  523. replaced, or it may be an edit pattern. If a pattern is given,
  524. the form which first matches that pattern will be replaced
  525. throughout. All forms which match the pattern will NOT be
  526. replaced.
  527. REPACK edit cmnd
  528. (REPACK loc) edit cmnd
  529. This command allows the editing of long strings (or atom names)
  530. one character at a time. REPACK calls the editor recursively
  531. on UNPACK of the specified atom. (In the atomic form of the
  532. command, the current expression is used unless it is a list;
  533. then, the first element is used. In the list form of the
  534. command, the form specified by the location specification is
  535. treated in the same way.) If the lower editor is exited via
  536. OK, the result is repacked and replaces the original atom.
  537. If STOP is used, no replacement is done. The new atom is
  538. always printed.
  539. (RI n1 n2) edit cmnd
  540. This command moves a right parenthesis. The paren is moved from
  541. the end of the the n1st element of the current expression to after
  542. the n2nd element of the n1st element. Remaining elements of the
  543. n1st element are raised to the top level of the current expression.
  544. The arguments, n1 and n2, are normally integers. However, because
  545. the NTH command is used in the search, they may be any location
  546. specifications. The expressions referenced will be the first
  547. element of the current expression in which the specified form
  548. is found at any level, and the first element of that expression
  549. in which the form specified by n2 is found at any level.
  550. (RO n) edit cmnd
  551. This command moves the right parenthesis from the end of the nth
  552. element of the current expression to the end of the current
  553. expression. All elements following the nth are moved inside
  554. the nth element.
  555. Because the NTH command is used for the search, the argument n,
  556. which is normally an integer, may be any location specification.
  557. The expression referenced is the first element of the current
  558. expression in which the specified form is found at any depth.
  559. (S var loc) edit cmnd
  560. This command sets (via SETQ) the variable whose name is var to
  561. the current expression after executing the location specification
  562. loc. The current expression is not changed.
  563. SAVE edit cmnd
  564. This command exits normally from the editor. The state of the
  565. edit is saved on the property EDIT-SAVE of the atom being edited.
  566. When the same atom is next edited, the state of the edit will
  567. be restored and (with the exception of a BLOCK on the undo-list)
  568. it will be as if the editor had never been exited. It is not
  569. necessary to use the SAVE command if only a single atom is being
  570. edited. See the OK command.
  571. (SECOND loc) edit cmnd
  572. This command changes the current expression to what it would be
  573. after the location specification loc is executed twice. The
  574. current expression is unchanged if either execution of loc fails.
  575. STOP edit cmnd
  576. This command exits abnormally from the editor. This command is
  577. useful mainly in conjunction with TTY: commands which the user
  578. wishes to abort. For example, if the user is executing
  579. (MOVE 3 TO AFTER COND TTY:),
  580. and he exits from the lower editor via OK, the MOVE command
  581. will complete its operation. If, on the other hand, the user
  582. exits via STOP, TTY: will produce an error and MOVE will abort.
  583. (SW n1 n2) edit cmnd
  584. This command swaps the n1st and n2nd elements of the current
  585. expression. The arguments are normally but not necessarily
  586. integers. SW uses NTH to perform the search, so that any
  587. location specifiations may be used. In each case, the first element
  588. of the current expression which contains the specified form at any
  589. depth will be used.
  590. TEST edit cmnd
  591. This command adds an undo-block to the undo-list. This block
  592. limits the scope of UNDO and !UNDO commands to changes made
  593. after the block was inserted. The block may be removed via
  594. UNBLOCK.
  595. (THIRD loc) edit cmnd
  596. This command executes the location specification loc three times.
  597. It is equivalent to three repetitions of (LC loc). Note, however,
  598. that if any of the executions causes an editor error, the current
  599. expression remains unchanged.
  600. (loc1 THRU loc2) edit cmnd
  601. This command makes the current expression the segment from the
  602. form specified by loc1 thru (including) the form specified by
  603. loc2. It is equivalent to (LC loc1), UP, (BI 1 loc2), 1.
  604. Thus, it makes a single element of the specified elements and
  605. makes that the current expression.
  606. This command is meant for use in the location specifications
  607. given to the DELETE, EMBED, EXTRACT and REPLACE commands, and
  608. is not particularly useful by itself. Use of THRU with these
  609. commands sets a special flag so that the editor removes the
  610. extra set of parens added by THRU.
  611. (loc1 TO loc2) edit cmnd
  612. This command makes the current expression the segment from the
  613. form specified by loc1 up to (but not including) the form specified
  614. by loc2. It is equivalent to (LC loc1), UP, (BI 1 loc), (RI 1 -2),
  615. 1. Thus, it makes a single element of the specified elements and
  616. makes that the current expression.
  617. This command is meant for use in the location specifications
  618. given to the DELETE, EMBED, EXTRACT and REPLACE commands, and is
  619. not particularly useful by itself. Use of TO with these commands
  620. sets a special flag so that the editor removes the extra set of
  621. parens added by TO.
  622. TTY: edit cmnd
  623. This command calls the editor recursively, invoking a 'lower editor.'
  624. The user may execute any and all edit commands in this lower editor.
  625. The TTY: command terminates when the lower editor is exited via
  626. OK or STOP.
  627. The form being edited in the lower editor is the same as that being
  628. edited in the upper editor. Upon entry, the current expression in
  629. the lower is the same as that in the upper editor.
  630. UNBLOCK edit cmnd
  631. This command removes an undo-block from the undo-list, allowing
  632. UNDO and !UNDO to operate on changes which were made before the
  633. block was inserted.
  634. Blocks may be inserted by exiting from the editor and by the TEST
  635. command.
  636. UNDO edit cmnd
  637. UNDO com edit cmnd
  638. This command udoes editing changes. All editing changes are
  639. undoable, provided that the information is available to the
  640. editor. (The necessary information is always available, unless
  641. several forms are being edited and the SAVE command is not
  642. used.) Changes made in the current editing session are ALWAYS
  643. undoable.
  644. The first form of the command undoes the most recent change.
  645. Note, however, that UNDO and !UNDO changes are skipped, even
  646. though they are themselves undoable.
  647. The second form of the command allows the user to undo an
  648. arbitrary command, not necessarily the most recent. UNDO
  649. and !UNDO may also be undone in this manner.
  650. UP edit cmnd
  651. If the current expression is a tail of the next higher expression,
  652. UP has no effect. Otherwise, the current expression becomes the
  653. form whose first element is the old current expression.
  654. (XTR loc) edit cmnd
  655. This command replaces the current expression by one of its
  656. subexpressions. The location specification, loc, gives the
  657. form to be used. Note that only the current expression is
  658. searched. If the current expression is a tail, the command
  659. operates on the first element of the tail.
  660. 0 edit cmnd
  661. This command makes the current expression the next higher
  662. expression. This usually, but not always, corresponds to
  663. returning to the next higher left parenthesis. This command
  664. is, in some sense, the inverse of the POS-INTEGER and NEG-
  665. INTEGER atomic commands.
  666. (## com1 com2 ... comn) fsubr
  667. The value of this fsubr, useful mainly in macros, is the
  668. expression which would be current after executing all of
  669. the comi in sequence. The current expression is not changed.
  670. Commands in which this fsubr might be used (e.g., CHANGE,
  671. INSERT and REPLACE) make special checks and use a copy
  672. of the expression returned.
  673. ^ edit cmnd
  674. This command makes the top level expression the current expression.
  675. ? edit cmnd
  676. This command prints the current expression to a level of 100.
  677. It is equivalent to (P 0 100).
  678. ?? edit cmnd
  679. This command displays the entries on the undo-list.
  680. _ edit cmnd
  681. This command returns to the position indicated by the most
  682. recent MARK command. The MARK is not removed.
  683. (_ pat) edit cmnd
  684. This command ascends (does repeated 0s), testing the current
  685. expression at each ascent for a match with pat. The current
  686. expression becomes the first form to match. If pattern is
  687. atomic, it is matched with the first element of each expression;
  688. otherwise, it is matched against the entire form.
  689. __ edit cmnd
  690. This command returns to the position indicated by the most
  691. recent MARK command and removes the MARK.
  692. (: exp1 exp2 ... expn) edit cmnd
  693. (:) edit cmnd
  694. This command replaces the current expression by the forms exp1
  695. thru expn. If no forms are given (as in the second form of the
  696. command), the current expression is deleted.
  697. (pat :: loc) edit cmnd
  698. This command sets the current expression to the first form
  699. (in print order) which matches pat and contains the form
  700. specified by the location specification loc at any level.
  701. The command is equivalent to (F pat N), (LCL loc), (_ pat).
  702. \ edit cmnd
  703. This command returns to the expression which was current before
  704. the last 'big jump.' Big jumps are caused by these commands:
  705. ^, _, __, !NX, all commands which perform a search or use a
  706. location specification, \ itself, and \P. NOTE: \ is shift-L
  707. on a teletype.
  708. \P edit cmnd
  709. This command returns to the expression which was current before
  710. the last print operation (P, PP or ?). Only the two most recent
  711. locations are saved. NOTE: \ is shift-L on a teletype.
  712. !NX edit cmnd
  713. This command makes the next expression at a higher level the
  714. current expression. That is, it goes thru any number of right
  715. parentheses to get to the next expression.
  716. !UNDO edit cmnd
  717. This command undoes all changes made in the current editing session
  718. (back to the most recent block). All changes are undoable.
  719. Blocks may be inserted by exiting the editor or by the TEST
  720. command. They may be removed with the UNBLOCK command.
  721. !0 edit cmnd
  722. This command does repeated 0s until it reaches an expression which
  723. is not a tail of the next higher expression. That expression becomes
  724. the new current expression. That is, this command returns to
  725. the next higher left parenthesis, regardless of intervening tails."