Changes between Initial Version and Version 1 of HemlockUser/InteractingWithLisp

11/05/07 17:58:18 (9 years ago)



  • HemlockUser/InteractingWithLisp

    v1 v1  
     3= 9 Interacting With Lisp = 
     5Lisp encourages highly interactive programming environments by 
     6requiring decisions about object type and function definition to be 
     7postponed until run time. Hemlock supports interactive programming in 
     8Lisp by providing incremental redefinition and environment examination 
     9commands. Hemlock also uses Unix TCP sockets to support multiple Lisp 
     10processes, each of which may be on any machine. 
     12== 9.1 Eval Servers == 
     14Hemlock runs in the editor process and interacts with other Lisp 
     15processes called eval servers. A user's Lisp program normally runs in 
     16an eval server process. The separation between editor and eval server 
     17has several advantages: 
     19 * The editor is protected from any bad things which may happen while 
     20   debugging a Lisp program. 
     22 * Editing may occur while running a Lisp program. 
     24 * The eval server may be on a different machine, removing the load 
     25   from the editing machine. 
     27 * Multiple eval servers allow the use of several distinct Lisp 
     28   environments. 
     30Instead of providing an interface to a single Lisp environment, 
     31Hemlock coordinates multiple Lisp environments. 
     33=== 9.1.1 The Current Eval Server === 
     35Although Hemlock can be connected to several eval servers 
     36simultaneously, one eval server is designated as the current eval 
     37server. This is the eval server used to handle evaluation and 
     38compilation requests. Eval servers are referred to by name so that 
     39there is a convenient way to discriminate between servers when the 
     40editor is connected to more than one. The current eval server is 
     41normally globally specified, but it may also be shadowed locally in 
     42specific buffers. 
     44Set Eval Server                  [Command] 
     46Set Buffer Eval Server                   [Command] 
     48Current Eval Server              [Command] 
     50Set Eval Server prompts for the name of an eval server and makes it 
     51the the current eval server. Set Buffer Eval Server is the same except 
     52that is sets the eval server for the current buffer only. Current Eval 
     53Server displays the name of the current eval server in the echo area, 
     54taking any buffer eval server into consideration. See also Set Compile 
     58=== 9.1.2 Slaves === 
     60For now, all eval servers are slaves. A slave is a Lisp process that 
     61uses a typescript (see page 9.2) to run its top-level read-eval-print 
     62loop in a Hemlock buffer. We refer to the buffer that a slave uses for 
     63I/O as its interactive or slave buffer. The name of the interactive 
     64buffer is the same as the eval server's name. 
     66Hemlock creates a background buffer for each eval server. The 
     67background buffer's name is Background name, where name is the name of 
     68the eval server. Slaves direct compiler warning output to the 
     69background buffer to avoid cluttering up the interactive buffer. 
     71Hemlock locally sets Current Eval Server in interactive and background 
     72buffers to their associated slave. When in a slave or background 
     73buffer, eval server requests will go to the associated slave, 
     74regardless of the global value of Current Eval Server. 
     76Select Slave    (bound to C-M-c)         [Command] 
     78This command changes the current buffer to the current eval server's 
     79interactive buffer. If the current eval server is not a slave, then it 
     80beeps. If there is no current eval server, then this creates a slave 
     81(see section 9.1.3). If a prefix argument is supplied, then this 
     82creates a new slave regardless of whether there is a current eval 
     83server. This command is the standard way to create a slave. 
     85The slave buffer is a typescript (see page 9.2) the slave uses for its 
     86top-level read-eval-print loop. 
     90Select Background       (bound to C-M-C)         [Command] 
     92This command changes the current buffer to the current eval server's 
     93background buffer. If there is no current eval server, then it beeps. 
     97=== 9.1.3 Slave Creation and Destruction === 
     99When Hemlock first starts up, there is no current eval server. If 
     100there is no a current eval server, commands that need to use the 
     101current eval server will create a slave as the current eval server. 
     103If an eval server's Lisp process terminates, then we say the eval 
     104server is dead. Hemlock displays a message in the echo area, 
     105interactive, and background buffers whenever an eval server dies. If 
     106the user deletes an interactive or background buffer, the associated 
     107eval server effectively becomes impotent, but Hemlock does not try to 
     108kill the process. If a command attempts to use a dead eval server, 
     109then the command will beep and display a message. 
     111Confirm Slave Creation          (initial value t)        [Variable] 
     113If this variable is true, then Hemlock always prompts the user for 
     114confirmation before creating a slave. 
     118Ask About Old Servers   (initial value t)        [Variable] 
     120If this variable is true, and some slave already exists, Hemlock 
     121prompts the user for the name of an existing server when there is no 
     122current server, instead of creating a new one. 
     126Editor Server Name               [Command] 
     128This command echos the editor server's name, the machine and port of 
     129the editor, which is suitable for use with the Lisp processes -slave 
     130switch. See section 9.10. 
     134Accept Slave Connections                 [Command] 
     136This command cause Hemlock to accept slave connections, and it 
     137displays the editor server's name, which is suitable for use with the 
     138Lisp processes -slave switch. See section 9.10. Supplying an argument 
     139causes this command to inhibit slave connections. 
     143Slave Utility   (initial value "/usr/misc/.lisp/bin/lisp")       [Variable] 
     145Slave Utility Switches          (initial value )         [Variable] 
     147A slave is started by running the program Slave Utility Name with 
     148arguments specified by the list of strings Slave Utility 
     149Switches. This is useful primarily when running customized Lisp 
     150systems. For example, setting Slave Utility Switches to ("-core" 
     151"my.core") will cause "/usr/hqb/my.core" to be used instead of the 
     152default core image. 
     154The -slave switch and the editor name are always supplied as 
     155arguments, and should remain unspecified in Slave Utility Switches. 
     159Kill Slave               [Command] 
     161Kill Slave and Buffers                   [Command] 
     163Kill Slave prompts for a slave name, aborts any operations in the 
     164slave, tells the slave to quit, and shuts down the connection to the 
     165specified eval server. This makes no attempt to assure the eval server 
     166actually dies. 
     168Kill Slave and Buffers is the same as Kill Slave, but it also deletes 
     169the interactive and background buffers. 
     173=== 9.1.4 Eval Server Operations === 
     175Hemlock handles requests for compilation or evaluation by queuing an 
     176operation on the current eval server. Any number of operations may be 
     177queued, but each eval server can only service one operation at a 
     178time. Information about the progress of operations is displayed in the 
     179echo area. 
     181Abort Operations        (bound to C-c a)         [Command] 
     183This command aborts all operations on the current eval server, either 
     184queued or in progress. Any operations already in the Aborted state 
     185will be flushed. 
     189List Operations         (bound to C-c l)         [Command] 
     191This command lists all operations which have not yet completed. Along 
     192with a description of the operation, the state and eval server is 
     193displayed. The following states are used: 
     195 Unsent:: 
     196  The operation is in local queue in the editor, and hasn't been sent yet. 
     198 Pending:: 
     199  The operation has been sent, but has not yet started execution. 
     201 Running:: 
     202  The operation is currently being processed. 
     204 Aborted:: 
     205  The operation has been aborted, but the eval server has not yet 
     206  indicated termination. 
     208== 9.2 Typescripts == 
     210Both slave buffers and background buffers are typescripts. The 
     211typescript protocol allows other processes to do stream-oriented 
     212interaction in a Hemlock buffer similar to that of a terminal. When 
     213there is a typescript in a buffer, the Typescript minor mode is 
     214present. Some of the commands described in this section are also used 
     215by Eval mode (page 9.9.2.) 
     217Typescripts are simple to use. Hemlock inserts output from the process 
     218into the buffer. To give the process input, use normal editing to 
     219insert the input at the end of the buffer, and then type Return to 
     220confirm sending the input to the process. 
     222Confirm Typescript Input                 [Command] 
     224Unwedge Interactive Input Confirm       (initial value t)        [Variable] 
     226This command sends text that has been inserted at the end of the 
     227current buffer to the process reading on the buffer's 
     228typescript. Before sending the text, Hemlock moves the point to the 
     229end of the buffer and inserts a newline. 
     231Input may be edited as much as is desired before it is confirmed; the 
     232result of editing input after it has been confirmed is 
     233unpredictable. For this reason, it is desirable to postpone confirming 
     234of input until it is actually complete. The Indent New Line command is 
     235often useful for inserting newlines without confirming the input. 
     237If the process reading on the buffer's typescript is not waiting for 
     238input, then the text is queued instead of being sent immediately. Any 
     239number of inputs may be typed ahead in this fashion. Hemlock makes 
     240sure that the inputs and outputs get interleaved correctly so that 
     241when all input has been read, the buffer looks the same as it would 
     242have if the input had not been typed ahead. 
     244If the buffer's point is before the start of the input area, then 
     245various actions can occur. When set, Unwedge Interactive Input Confirm 
     246causes Hemlock to ask the user if it should fix the input buffer which 
     247typically results in ignoring any current input and refreshing the 
     248input area at the end of the buffer. This also has the effect of 
     249throwing the slave Lisp to top level, which aborts any pending 
     250operations or queued input. This is the only way to be sure the user 
     251is cleanly set up again after messing up the input region. When this 
     252is nil, Hemlock simply beeps and tells the user in the Echo Area that 
     253the input area is invalid. 
     256Kill Interactive Input                   [Command] 
     258This command kills any input that would have been confirmed by Return. 
     262Next Interactive Input                   [Command] 
     264Previous Interactive Input               [Command] 
     266Search Previous Interactive Input                [Command] 
     268Interactive History Length      (initial value 10)       [Variable] 
     270Minimum Interactive Input Length        (initial value 2)        [Variable] 
     272Hemlock maintains a history of interactive inputs. Next Interactive 
     273Input and Previous Interactive Input step forward and backward in the 
     274history, inserting the current entry in the buffer. The prefix 
     275argument is used as a repeat count. 
     277Search Previous Interactive Input searches backward through the 
     278interactive history using the current input as a search 
     279string. Consecutive invocations repeat the previous search. 
     281Interactive History Length determines the number of entries with which 
     282Hemlock creates the buffer-specific histories. Hemlock only adds an 
     283input region to the history if its number of characters exceeds 
     284Minimum Interactive Input Length. 
     288Reenter Interactive Input                [Command] 
     290This copies to the end of the buffer the form to the left of the 
     291buffer's point. When the current region is active, this copies it 
     292instead. This is sometimes easier to use to get a previous input that 
     293is either so far back that it has fallen off the history or is visible 
     294and more readily yanked than gotten with successive invocations of the 
     295history commands. 
     299Interactive Beginning of Line            [Command] 
     301This command is identical to Beginning of Line unless there is no 
     302prefix argument and the point is on the same line as the start of the 
     303current input; then it moves to the beginning of the input. This is 
     304useful since it skips over any prompt which may be present. 
     308Input Wait Alarm        (initial value :loud-message)    [Variable] 
     310Slave GC Alarm          (initial value :message)         [Variable] 
     312Input Wait Alarm determines what action to take when a slave Lisp goes 
     313into an input wait on a typescript that isn't currently displayed in 
     314any window. Slave GC Alarm determines what action to take when a slave 
     315notifies that it is GC'ing. 
     317The following are legal values: 
     319 :loud-message:: 
     320  Beep and display a message in the echo area indicating which buffer 
     321  is waiting for input. 
     323 :message:: 
     324  Display a message, but don't beep. 
     326 nil:: 
     327  Don't do anything. 
     330Typescript Slave BREAK          (bound to Typescript: H-b)       [Command] 
     332Typescript Slave to Top Level   (bound to Typescript: H-g)       [Command] 
     334Typescript Slave Status         (bound to Typescript: H-s)       [Command] 
     336Some typescripts have associated information which these commands 
     337access allowing Hemlock to control the process which uses the 
     340Typescript Slave BREAK puts the current process in a break loop so 
     341that you can be debug it. This is similar in effect to an interrupt 
     342signal (^C or ^\ in the editor process). 
     344Typescript Slave to Top Level causes the current process to throw to 
     345the top-level read-eval-print loop. This is similar in effect to a 
     346quit signal (^\). 
     348Typescript Slave Status causes the current process to print status 
     349information on error-output: ; Used 0:06:03, 3851 faults. In: 
     350SYSTEM:SERVE-EVENT The message displays the process run-time, the 
     351total number of page faults and the name of the currently running 
     352function. This command is useful for determining whether the slave is 
     353in an infinite loop, waiting for input, or whatever. 
     355== 9.3 The Current Package == 
     357The current package is the package which Lisp interaction commands 
     358use. The current package is specified on a per-buffer basis, and 
     359defaults to "USER". If the current package does not exist in the eval 
     360server, then it is created. If evaluation is being done in the editor 
     361process and the current package doesn't exist, then the value of 
     362*package* is used. The current package is displayed in the modeline 
     363(see section 3.3.) Normally the package for each file is specified 
     364using the Package file option (see page 3.3.3.) 
     366When in a slave buffer, the current package is controlled by the value 
     367of package in that Lisp process. Modeline display of the current 
     368package is inhibited in this case. 
     370Set Buffer Package               [Command] 
     372This command prompts for the name of a package to make the local 
     373package in the current buffer. If the current buffer is a slave, 
     374background, or eval buffer, then this sets the current package in the 
     375associated eval server or editor Lisp. When in an interactive buffer, 
     376do not use in-package; use this command instead. 
     378== 9.4 Compiling and Evaluating Lisp Code == 
     380These commands can greatly speed up the edit/debug cycle since they 
     381enable incremental reevaluation or recompilation of changed code, 
     382avoiding the need to compile and load an entire file. 
     384Evaluate Expression     (bound to M-Escape)      [Command] 
     386This command prompts for an expression and prints the result of its 
     387evaluation in the echo area. If an error happens during evaluation, 
     388the evaluation is simply aborted, instead of going into the 
     389debugger. This command doesn't return until the evaluation is 
     394Evaluate Defun          (bound to C-x C-e)       [Command] 
     396Evaluate Region                  [Command] 
     398Evaluate Buffer                  [Command] 
     400These commands evaluate text out of the current buffer, reading the 
     401current defun, the region and the entire buffer, respectively. The 
     402result of the evaluation of each form is displayed in the echo 
     403area. If the region is active, then Evaluate Defun evaluates the 
     404current region, just like Evaluate Region. 
     408Macroexpand Expression          (bound to C-M)   [Command] 
     410This command shows the macroexpansion of the next expression in the 
     411null environment in a pop-up window. With an argument, it uses 
     412macroexpand instead of macroexpand-1. 
     416Re-evaluate Defvar               [Command] 
     418This command is similar to Evaluate Defun. It is used for force the re-evaluation of a defvar init form. If the current top-level form is a defvar, then it does a makunbound on the variable, and evaluates the form. 
     422Compile Defun   (bound to C-x C-c)       [Command] 
     423Compile Region                   [Command] 
     425These commands compile the text in the current defun and the region, respectively. If the region is active, then Compile Defun compiles the current region, just like Compile Region. 
     429Load File                [Command] 
     430Load Pathname Defaults          (initial value nil)      [Variable] 
     432This command prompts for a file and loads it into the current eval server using load. Load Pathname Defaults contains the default pathname for this command. This variable is set to the file loaded; if it is nil, then there is no default. This command also uses the Remote Compile File variable. 
     436== 9.5 Compiling Files == 
     438These commands are used to compile source (".lisp") files, producing 
     439binary (".fasl") output files. Note that unlike the other compiling 
     440and evalating commands, this does not have the effect of placing the 
     441definitions in the environment; to do so, the binary file must be 
     444Compile Buffer File     (bound to C-x c)         [Command] 
     446Compile Buffer File Confirm     (initial value t)        [Variable] 
     448This command asks for confirmation, then saves the current buffer 
     449(when modified) and compiles the associated file. The confirmation 
     450prompt indicates intent to save and compile or just compile. If the 
     451buffer wasn't modified, and a comparison of the write dates for the 
     452source and corresponding binary (".fasl") file suggests that 
     453recompilation is unnecessary, the confirmation also indicates this. A 
     454prefix argument overrides this test and forces recompilation. Since 
     455there is a complete log of output in the background buffer, the 
     456creation of the normal error output (".err") file is 
     459Setting Compile Buffer File Confirm to nil inhibits confirmation, 
     460except when the binary is up to date and a prefix argument is not 
     464Compile File             [Command] 
     466This command prompts for a file and compiles that file, providing a 
     467convenient way to compile a file that isn't in any buffer. Unlike 
     468Compile Buffer File, this command doesn't do any consistency checks 
     469such as checking whether the source is in a modified buffer or the 
     470binary is up to date. 
     474Compile Group            [Command] 
     476List Compile Group               [Command] 
     478Compile Group does a Save All Files and then compiles every ".lisp" 
     479file for which the corresponding ".fasl" file is older or 
     480nonexistent. The files are compiled in the order in which they appear 
     481in the group definition. A prefix argument forces compilation of all 
     482".lisp" files. 
     484List Compile Group lists any files that would be compiled by Compile 
     485Group. All Modified files are saved before checking to generate a 
     486consistent list. 
     488Set Compile Server               [Command] 
     490Set Buffer Compile Server                [Command] 
     492Current Compile Server                   [Command] 
     494These commands are analogous to Set Eval Server, Set Buffer Eval 
     495Server and Current Eval Server, but they determine the eval server 
     496used for file compilation requests. If the user specifies a compile 
     497server, then the file compilation commands send compilation requests 
     498to that server instead of the current eval server. 
     500Having a separate compile server makes it easy to do compilations in 
     501the background while continuing to interact with your eval server and 
     502editor. The compile server can also run on a remote machine relieving 
     503your active development machine of the compilation effort. 
     507Next Compiler Error     (bound to H-n)   [Command] 
     509Previous Compiler Error         (bound to H-p)   [Command] 
     511These commands provides a convenient way to inspect compiler 
     512errors. First it splits the current window if there is only one window 
     513present. Hemlock positions the current point in the first window at 
     514the erroneous source code for the next (or previous) error. Then in 
     515the second window, it displays the error beginning at the top of the 
     516window. Given an argument, this command skips that many 
     521Flush Compiler Error Information                 [Command] 
     523This command relieves the current eval server of all infomation about 
     524errors encountered while compiling. This is convenient if you have 
     525been compiling a lot, but you were ignoring errors and warnings. You 
     526don't want to step through all the old errors, so you can use this 
     527command immediately before compiling a file whose errors you intend to 
     532Remote Compile File     (initial value nil)      [Variable] 
     534When true, this variable causes file compilations to be done using the 
     535RFS remote file system mechanism by prepending "/../host" to the file 
     536being compiled. This allows the compile server to be run on a 
     537different machine, but requires that the source be world readable. If 
     538false, commands use source filenames directly. Do NOT use this to 
     539compile files in AFS. 
     541== 9.6 Querying the Environment == 
     543These commands are useful for obtaining various random information 
     544from the Lisp environment. 
     546Describe Function Call          (bound to C-M-A)         [Command] 
     548Describe Symbol         (bound to C-M-S)         [Command] 
     550Describe Function Call uses the current eval server to describe the 
     551symbol found at the head of the currently enclosing list, displaying 
     552the output in a pop-up window. Describe Symbol is the same except that 
     553it describes the symbol at or before the point. These commands are 
     554primarily useful for finding the documentation for functions and 
     555variables. If there is no currently valid eval server, then this 
     556command uses the editor Lisp's environment instead of trying to spawn 
     557a slave. 
     559== 9.7 Editing Definitions == 
     561The Lisp compiler annotates each compiled function object with the 
     562source file that the function was originally defined from. The 
     563definition editing commands use this information to locate and edit 
     564the source for functions defined in the environment. 
     566Edit Definition                  [Command] 
     568Goto Definition         (bound to C-M-F)         [Command] 
     570Edit Command Definition                  [Command] 
     572Edit Definition prompts for the name of a function, and then uses the 
     573current eval server to find out in which file the function is 
     574defined. If something other than defun or defmacro defined the 
     575function, then this simply reads in the file, without trying to find 
     576its definition point within the file. If the function is uncompiled, 
     577then this looks for it in the current buffer. If there is no currently 
     578valid eval server, then this command uses the editor Lisp's 
     579environment instead of trying to spawn a slave. 
     581Goto Definition edits the definition of the symbol at the beginning of 
     582the current list. 
     584Edit Command Definition edits the definition of a Hemlock command. By 
     585default, this command does a keyword prompt for the command name (as 
     586in an extended command). If a prefix argument is specified, then 
     587instead prompt for a key and edit the definition of the command bound 
     588to that key. 
     592Add Definition Directory Translation             [Command] 
     594Delete Definition Directory Translation                  [Command] 
     596The defining file is recorded as an absolute pathname. The definition 
     597editing commands have a directory translation mechanism that allow the 
     598sources to be found when they are not in the location where 
     599compilation was originally done. Add Definition Directory Translation 
     600prompts for two directory namestrings and causes the first to be 
     601mapped to the second. Longer (more specific) directory specifications 
     602are matched before shorter (more general) ones. 
     604Delete Definition Directory Translation prompts for a directory 
     605namestring and deletes it from the directory translation 
     610Editor Definition Info          (initial value nil)      [Variable] 
     612When this variable is true, the editor Lisp is used to determine 
     613definition editing information, otherwise the current eval server is 
     614used. This variable is true in Eval and Editor modes. 
     616== 9.8 Debugging == 
     618These commands manipulate the slave when it is in the debugger and 
     619provide source editing based on the debugger's current frame. These 
     620all affect the Current Eval Server. 
     622=== 9.8.1 Changing Frames === 
     624Debug Down      (bound to C-M-H-d)       [Command] 
     626This command moves down one debugger frame. 
     630Debug Up        (bound to C-M-H-u)       [Command] 
     632This command moves up one debugger frame. 
     636Debug Top       (bound to C-M-H-t)       [Command] 
     638This command moves to the top of the debugging stack. 
     642Debug Bottom    (bound to C-M-H-b)       [Command] 
     644This command moves to the bottom of the debugging stack. 
     648Debug Frame     (bound to C-M-H-f)       [Command] 
     650This command moves to the absolute debugger frame number indicated by 
     651the prefix argument. 
     655=== 9.8.2 Getting out of the Debugger === 
     657Debug Quit      (bound to C-M-H-q)       [Command] 
     659This command throws to top level out of the debugger in the Current 
     660Eval Server. 
     664Debug Go        (bound to C-M-H-g)       [Command] 
     666This command tries the continue restart in the Current Eval Server. 
     670Debug Abort     (bound to C-M-H-a)       [Command] 
     672This command executes the ABORT restart in the Current Eval 
     677Debug Restart   (bound to C-M-H-r)       [Command] 
     679This command executes the restart indicated by the prefix argument in 
     680the Current Eval Server. The debugger enumerates the restart cases 
     681upon entering it. 
     685=== 9.8.3 Getting Information === 
     687Debug Help      (bound to C-M-H-h)       [Command] 
     689This command in prints the debugger's help text. 
     693Debug Error     (bound to C-M-H-e)       [Command] 
     695This command prints the error condition and restart cases displayed 
     696upon entering the debugger. 
     700Debug Backtrace         (bound to C-M-H-B)       [Command] 
     702This command executes the debugger's backtrace command. 
     706Debug Print     (bound to C-M-H-p)       [Command] 
     708This command prints the debugger's current frame in the same fashion 
     709as the frame motion commands. 
     713Debug Verbose Print     (bound to C-M-H-P)       [Command] 
     715This command prints the debugger's current frame without elipsis. 
     719Debug Source    (bound to C-M-H-s)       [Command] 
     721This command prints the source form for the debugger's current frame. 
     725Debug Verbose Source             [Command] 
     727This command prints the source form for the debugger's current frame with surrounding forms for context. 
     731Debug List Locals       (bound to C-M-H-l)       [Command] 
     733This prints the local variables for the debugger's current frame. 
     737=== 9.8.4 Editing Sources === 
     739Debug Edit Source       (bound to C-M-H-S)       [Command] 
     741This command attempts to place you at the source location of the 
     742debugger's current frame. Not all debugger frames represent function's 
     743that were compiled with the appropriate debug-info policy. This beeps 
     744with a message if it is unsuccessful. 
     748=== 9.8.5 Miscellaneous === 
     750Debug Flush Errors      (bound to C-M-H-F)       [Command] 
     752This command toggles whether the debugger ignores errors or 
     753recursively enters itself. 
     757== 9.9 Manipulating the Editor Process == 
     759When developing Hemlock customizations, it is useful to be able to 
     760manipulate the editor Lisp environment from Hemlock. 
     762Editor Describe         (bound to Home t, C-_ t)         [Command] 
     764This command prompts for an expression, and then evaluates and 
     765describes it in the editor process. 
     769Room             [Command] 
     771Call the room function in the editor process, displaying information 
     772about allocated storage in a pop-up window. 
     776Editor Load File                 [Command] 
     778This command is analogous to Load File, but loads the file into the 
     779editor process. 
     783=== 9.9.1 Editor Mode === 
     785When Editor mode is on, alternate versions of the Lisp interaction 
     786commands are bound in place of the eval server based commands. These 
     787commands manipulate the editor process instead of the current eval 
     788server. Turning on editor mode in a buffer allows incremental 
     789development of code within the running editor. 
     791Editor Mode              [Command] 
     793This command turns on Editor minor mode in the current buffer. If it 
     794is already on, it is turned off. Editor mode may also be turned on 
     795using the Mode file option (see page 3.3.3.) 
     798Editor Compile Defun             [Command] 
     800Editor Compile Region            [Command] 
     802Editor Evaluate Buffer                   [Command] 
     804Editor Evaluate Defun            [Command] 
     806Editor Evaluate Region                   [Command] 
     808Editor Macroexpand Expression   (bound to Editor: C-M)   [Command] 
     810Editor Re-evaluate Defvar                [Command] 
     812Editor Describe Function Call            [Command] 
     814Editor Describe Symbol                   [Command] 
     816These commands are similar to the standard commands, but modify or 
     817examine the Lisp process that Hemlock is running in. Terminal I/O is 
     818done on the initial window for the editor's Lisp process. Output is 
     819directed to a pop-up window or the editor's window instead of to the 
     820background buffer. 
     824Editor Compile Buffer File               [Command] 
     826Editor Compile File              [Command] 
     828Editor Compile Group             [Command] 
     830In addition to compiling in the editor process, these commands differ 
     831from the eval server versions in that they direct output to the the 
     832Compiler Warnings buffer. 
     836Editor Evaluate Expression               [Command] 
     838This command prompts for an expression and evaluates it in the editor 
     839process. The results of the evaluation are displayed in the echo area. 
     843=== 9.9.2 Eval Mode === 
     845Eval mode is a minor mode that simulates a read eval print loop 
     846running within the editor process. Since Lisp program development is 
     847usually done in a separate eval server process (see page 9.1), Eval 
     848mode is used primarily for debugging code that must run in the editor 
     849process. Eval mode shares some commands with Typescript mode: see 
     850section 9.2. 
     852Eval mode doesn't completely support terminal I/O: it binds 
     853standard-output to a stream that inserts into the buffer and 
     854standard-input to a stream that signals an error for all 
     855operations. Hemlock cannot correctly support the interactive 
     856evaluation of forms that read from the Eval interactive buffer. 
     858Select Eval Buffer               [Command] 
     860This command changes to the Eval buffer, creating one if it doesn't 
     861already exist. The Eval buffer is created with Lisp as the major mode 
     862and Eval and Editor as minor modes. 
     866Confirm Eval Input               [Command] 
     868This command evaluates all the forms between the end of the last 
     869output and the end of the buffer, inserting the results of their 
     870evaluation in the buffer. This beeps if the form is incomplete. Use 
     871Linefeed to insert line breaks in the middle of a form. 
     873This command uses Unwedge Interactive Input Confirm in the same way 
     874Confirm Interactive Input does. 
     877Abort Eval Input                 [Command] 
     879This command moves the the end of the buffer and prompts, ignoring any 
     880input already typed in. 
     884=== 9.9.3 Error Handling === 
     886When an error happens inside of Hemlock, Hemlock will trap the error 
     887and display the error message in the echo area, possibly along with 
     888the "Internal error:" prefix. If you want to debug the error, type 
     889?. This causes the prompt "Debug:" to appear in the echo area. The 
     890following commands are recognized: 
     892 d:: 
     893  Enter a break-loop so that you can use the Lisp debugger. Proceeding 
     894  with "go" will reenter Hemlock and give the "Debug:" prompt again. 
     896 e:: 
     897  Display the original error message in a pop-up window. 
     899 b:: 
     900  Show a stack backtrace in a pop-up window. 
     902 q, Escape:: 
     903  Quit from this error to the nearest command loop. 
     905 r:: 
     906  Display a list of the restart cases and prompt for the number of a 
     907  restart-case with which to continue. Restarting may result in 
     908  prompting in the window in which Lisp started. 
     910Only errors within the editor process are handled in this way. Errors 
     911during eval server operations are handled using normal terminal I/O on 
     912a typescript in the eval server's slave buffer or background buffer 
     913(see page 9.1.4). Errors due to interaction in a slave buffer will 
     914cause the debugger to be entered in the slave buffer. 
     916== 9.10 Command Line Switches == 
     918Two command line switches control the initialization of editor and 
     919eval servers for a Lisp process: 
     921 -edit:: 
     922  This switch starts up Hemlock. If there is a non-switch command line 
     923  word immediately following the program name, then the system 
     924  interprets it as a file to edit. For example, given 
     925  `lisp file.txt -edit` 
     926  Lisp will go immediately into Hemlock finding the file file.txt. 
     928 -slave [name]:: 
     929  This switch causes the Lisp process to become a slave of the editor 
     930  process name. An editor Lisp determines name when it allows 
     931  connections from slaves. Once the editor chooses a name, it keeps 
     932  the same name until the editor's Lisp process terminates. Since the 
     933  editor can automatically create slaves on its own machine, this 
     934  switch is useful primarily for creating slaves that run on a 
     935  different machine. hqb's machine is ME.CS.CMU.EDU, and he wants want 
     936  to run a slave on SLAVE.CS.CMU.EDU, then he should use the Accept 
     937  Slave Connections command, telnet to the machine, and invoke Lisp 
     938  supplying -slave and the editor's name. The command displays the 
     939  editor's name.