source: release/1.4/source/cocoa-ide/hemlock/doc/user/lisp.mss

Last change on this file was 6, checked in by Gary Byers, 21 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 34.7 KB
Line 
1@comment{-*- Dictionary: /afs/cs/project/clisp/scribe/hem/hem; Mode: spell; Package: Hemlock -*-}
2@chap[Interacting With Lisp]
3@index[lisp, interaction with]
4
5Lisp encourages highly interactive programming environments by requiring
6decisions about object type and function definition to be postponed until run
7time. @hemlock supports interactive programming in @llisp by providing
8incremental redefinition and environment examination commands. @hemlock also
9uses Unix TCP sockets to support multiple Lisp processes, each of which may be
10on any machine.
11
12
13@section[Eval Servers]
14@label[eval-servers]
15@index[eval servers]
16
17@hemlock runs in the editor process and interacts with other Lisp processes
18called @i[eval servers]. A user's Lisp program normally runs in an eval
19server process. The separation between editor and eval server has several
20advantages:
21@begin[itemize]
22The editor is protected from any bad things which may happen while debugging a
23Lisp program.
24
25Editing may occur while running a Lisp program.
26
27The eval server may be on a different machine, removing the load from the
28editing machine.
29
30Multiple eval servers allow the use of several distinct Lisp environments.
31@end[itemize]
32Instead of providing an interface to a single Lisp environment, @hemlock
33coordinates multiple Lisp environments.
34
35
36@subsection[The Current Eval Server]
37@index[current eval server]
38Although @hemlock can be connected to several eval servers simultaneously, one
39eval server is designated as the @i[current eval server]. This is the eval
40server used to handle evaluation and compilation requests. Eval servers are
41referred to by name so that there is a convenient way to discriminate between
42servers when the editor is connected to more than one. The current eval server
43is normally globally specified, but it may also be shadowed locally in specific
44buffers.
45
46@defcom[com "Set Eval Server"]
47@defcom1[com "Set Buffer Eval Server"]
48@defcom1[com "Current Eval Server"]
49@hid[Set Eval Server] prompts for the name of an eval server and makes it the
50the current eval server. @hid[Set Buffer Eval Server] is the same except that
51is sets the eval server for the current buffer only. @hid[Current Eval Server]
52displays the name of the current eval server in the echo area, taking any
53buffer eval server into consideration. See also @comref[Set Compile Server].
54@enddefcom
55
56
57@subsection[Slaves]
58@index[slave buffers]
59@index[slaves]
60For now, all eval servers are @i[slaves]. A slave is a Lisp process that uses
61a typescript (see page @pageref[typescripts]) to run its top-level
62@f[read-eval-print] loop in a @hemlock buffer. We refer to the buffer that a
63slave uses for I/O as its @i[interactive] or @i[slave] buffer. The name of the
64interactive buffer is the same as the eval server's name.
65
66@index[background buffers]
67@hemlock creates a @i[background] buffer for each eval server. The background
68buffer's name is @w<@hid[Background ]@i{name}>, where @i[name] is the name of
69the eval server. Slaves direct compiler warning output to the background
70buffer to avoid cluttering up the interactive buffer.
71
72@hemlock locally sets @hid[Current Eval Server] in interactive and background
73buffers to their associated slave. When in a slave or background buffer, eval
74server requests will go to the associated slave, regardless of the global value
75of @hid[Current Eval Server].
76
77@defcom[com "Select Slave", bind (C-M-c)]
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 beeps.
80If there is no current eval server, then this creates a slave (see section
81@ref[slave-creation]). If a prefix argument is supplied, then this creates a
82new slave regardless of whether there is a current eval server. This command
83is the standard way to create a slave.
84
85The slave buffer is a typescript (see page @pageref[typescripts]) the slave
86uses for its top-level @f[read-eval-print] loop.
87@enddefcom
88
89@defcom[com "Select Background", bind (C-M-C)]
90This command changes the current buffer to the current eval server's background
91buffer. If there is no current eval server, then it beeps.
92@enddefcom
93
94
95@subsection[Slave Creation and Destruction]
96@label[slave-creation]
97When @hemlock first starts up, there is no current eval server. If there is no
98a current eval server, commands that need to use the current eval server will
99create a slave as the current eval server.
100
101If an eval server's Lisp process terminates, then we say the eval server is
102dead. @hemlock displays a message in the echo area, interactive, and
103background buffers whenever an eval server dies. If the user deletes an
104interactive or background buffer, the associated eval server effectively
105becomes impotent, but @hemlock does not try to kill the process. If a command
106attempts to use a dead eval server, then the command will beep and display a
107message.
108
109@defhvar[var "Confirm Slave Creation", val {t}]
110If this variable is true, then @hemlock always prompts the user for
111confirmation before creating a slave.
112@enddefhvar
113
114@defhvar[var "Ask About Old Servers", val {t}]
115If this variable is true, and some slave already exists, @hemlock prompts the
116user for the name of an existing server when there is no current server,
117instead of creating a new one.
118@enddefhvar
119
120@defcom[com "Editor Server Name"]
121This command echos the editor server's name, the machine and port of the
122editor, which is suitable for use with the Lisp processes -slave switch.
123See section @ref[slave-switch].
124@enddefcom
125
126@defcom[com "Accept Slave Connections"]
127This command cause @hemlock to accept slave connections, and it displays the
128editor server's name, which is suitable for use with the Lisp processes -slave
129switch. See section @ref[slave-switch]. Supplying an argument causes this
130command to inhibit slave connections.
131@enddefcom
132
133@defhvar[var "Slave Utility", val {"/usr/misc/.lisp/bin/lisp"}]
134@defhvar1[var "Slave Utility Switches"]
135A slave is started by running the program @hid[Slave Utility Name] with
136arguments specified by the list of strings @hid[Slave Utility Switches]. This
137is useful primarily when running customized Lisp systems. For example,
138setting @hid[Slave Utility Switches] to @f[("-core" "my.core")] will cause
139"@f[/usr/hqb/my.core]" to be used instead of the default core image.
140
141The @f[-slave] switch and the editor name are always supplied as arguments, and
142should remain unspecified in @hid[Slave Utility Switches].
143@enddefhvar
144
145@defcom[com "Kill Slave"]
146@defcom1[com "Kill Slave and Buffers"]
147@hid[Kill Slave] prompts for a slave name, aborts any operations in the slave,
148tells the slave to @f[quit], and shuts down the connection to the specified
149eval server. This makes no attempt to assure the eval server actually dies.
150
151@hid[Kill Slave and Buffers] is the same as @hid[Kill Slave], but it also
152deletes the interactive and background buffers.
153@enddefcom
154
155
156@subsection[Eval Server Operations]
157
158@label[operations]
159@index[eval server operations]@index[operations, eval server]
160@hemlock handles requests for compilation or evaluation by queuing an
161@i[operation] on the current eval server. Any number of operations may be
162queued, but each eval server can only service one operation at a time.
163Information about the progress of operations is displayed in the echo area.
164
165@defcom[com "Abort Operations", bind (C-c a)]
166This command aborts all operations on the current eval server, either queued or
167in progress. Any operations already in the @f[Aborted] state will be flushed.
168@enddefcom
169
170@defcom[com "List Operations", bind (C-c l)]
171This command lists all operations which have not yet completed. Along with a
172description of the operation, the state and eval server is displayed. The
173following states are used:
174@begin[description]
175@f[Unsent]@\The operation is in local queue in the editor, and hasn't been sent
176yet.
177
178@f[Pending]@\The operation has been sent, but has not yet started execution.
179
180@f[Running]@\The operation is currently being processed.
181
182@f[Aborted]@\The operation has been aborted, but the eval server has not yet
183indicated termination.
184@end[description]
185@enddefcom
186
187
188@section[Typescripts]
189@label[typescripts]
190@index[typescripts]
191
192Both slave buffers and background buffers are typescripts. The typescript
193protocol allows other processes to do stream-oriented interaction in a @hemlock
194buffer similar to that of a terminal. When there is a typescript in a buffer,
195the @hid[Typescript] minor mode is present. Some of the commands described in
196this section are also used by @hid[Eval] mode (page @pageref[eval-mode].)
197
198Typescripts are simple to use. @hemlock inserts output from the process into
199the buffer. To give the process input, use normal editing to insert the input
200at the end of the buffer, and then type @bf[Return] to confirm sending the
201input to the process.
202
203@defcom[com "Confirm Typescript Input",
204 stuff (bound to @bf[Return] in @hid[Typescript] mode)]
205@defhvar1[var "Unwedge Interactive Input Confirm", val {t}]
206This command sends text that has been inserted at the end of the current buffer
207to the process reading on the buffer's typescript. Before sending the text,
208@hemlock moves the point to the end of the buffer and inserts a newline.
209
210Input may be edited as much as is desired before it is confirmed; the result
211of editing input after it has been confirmed is unpredictable. For this reason,
212it is desirable to postpone confirming of input until it is actually complete.
213The @hid[Indent New Line] command is often useful for inserting newlines
214without confirming the input.
215
216If the process reading on the buffer's typescript is not waiting for input,
217then the text is queued instead of being sent immediately. Any number of
218inputs may be typed ahead in this fashion. @hemlock makes sure that the inputs
219and outputs get interleaved correctly so that when all input has been read, the
220buffer looks the same as it would have if the input had not been typed ahead.
221
222If the buffer's point is before the start of the input area, then various
223actions can occur. When set, @hid[Unwedge Interactive Input Confirm] causes
224@hemlock to ask the user if it should fix the input buffer which typically
225results in ignoring any current input and refreshing the input area at the end
226of the buffer. This also has the effect of throwing the slave Lisp to top
227level, which aborts any pending operations or queued input. This is the only
228way to be sure the user is cleanly set up again after messing up the input
229region. When this is @nil, @hemlock simply beeps and tells the user in the
230@hid[Echo Area] that the input area is invalid.
231@enddefcom
232
233@defcom[com "Kill Interactive Input",
234 stuff (bound to @bf[M-i] in @hid[Typescript] and @hid[Eval] modes)]
235This command kills any input that would have been confirmed by @bf[Return].
236@enddefcom
237
238@defcom[com "Next Interactive Input",
239 stuff (bound to @bf[M-n] in @hid[Typescript] and @hid[Eval] modes)]
240@defcom1[com "Previous Interactive Input",
241 stuff (bound to @bf[M-p] in @hid[Typescript] and @hid[Eval] modes)]
242@defcom1[com "Search Previous Interactive Input",
243 stuff (bound to @bf[M-P] in @hid[Typescript] and @hid[Eval] modes)]
244@defhvar1[var "Interactive History Length", val {10}]
245@defhvar1[var "Minimum Interactive Input Length", val {2}]
246@index[history, typescript]
247@Hemlock maintains a history of interactive inputs. @hid[Next Interactive
248Input] and @hid[Previous Interactive Input] step forward and backward in the
249history, inserting the current entry in the buffer. The prefix argument is
250used as a repeat count.
251
252@hid[Search Previous Interactive Input] searches backward through the
253interactive history using the current input as a search string. Consecutive
254invocations repeat the previous search.
255
256@hid[Interactive History Length] determines the number of entries with which
257@hemlock creates the buffer-specific histories. @Hemlock only adds an input
258region to the history if its number of characters exceeds @hid[Minimum
259Interactive Input Length].
260@enddefcom
261
262@defcom[com "Reenter Interactive Input",
263 stuff (bound to @bf[C-Return] in @hid[Typescript] and @hid[Eval] modes)]
264 This copies to the end of the buffer the form to the left of the buffer's
265point. When the current region is active, this copies it instead. This is
266sometimes easier to use to get a previous input that is either so far back that
267it has fallen off the history or is visible and more readily @i[yanked] than
268gotten with successive invocations of the history commands.
269@enddefcom
270
271@defcom[com "Interactive Beginning of Line",
272 stuff (bound to @bf[C-a] in @hid[Typescript] and @hid[Eval] modes)]
273This command is identical to @hid[Beginning of Line] unless there is no
274prefix argument and the point is on the same line as the start of the current
275input; then it moves to the beginning of the input. This is useful since it
276skips over any prompt which may be present.
277@enddefcom
278
279@defhvar[var "Input Wait Alarm", val {:loud-message}]
280@defhvar1[var "Slave GC Alarm", val {:message}]
281@hid[Input Wait Alarm] determines what action to take when a slave Lisp goes
282into an input wait on a typescript that isn't currently displayed in any
283window. @hid[Slave GC Alarm] determines what action to take when a slave
284notifies that it is GC'ing.
285
286The following are legal values:
287@begin[description]
288@kwd[loud-message]@\Beep and display a message in the echo area indicating
289which buffer is waiting for input.
290
291@kwd[message]@\Display a message, but don't beep.
292
293@nil@\Don't do anything.
294@end[description]
295@enddefhvar
296
297@defcom[com "Typescript Slave BREAK", bind (Typescript: H-b)]
298@defcom1[com "Typescript Slave to Top Level", bind (Typescript: H-g)]
299@defcom1[com "Typescript Slave Status", bind (Typescript: H-s)]
300Some typescripts have associated information which these commands access
301allowing @hemlock to control the process which uses the typescript.
302
303@hid[Typescript Slave BREAK] puts the current process in a break loop so that
304you can be debug it. This is similar in effect to an interrupt signal (@f[^C]
305or @f[^\] in the editor process).
306
307@hid[Typescript Slave to Top Level] causes the current process to throw to the
308top-level @f[read-eval-print] loop. This is similar in effect to a quit signal
309(@f[^\]).
310
311@hid[Typescript Slave Status] causes the current process to print status
312information on @var[error-output]:
313@lisp
314; Used 0:06:03, 3851 faults. In: SYSTEM:SERVE-EVENT
315@endlisp
316The message displays the process run-time, the total number of page faults and
317the name of the currently running function. This command is useful for
318determining whether the slave is in an infinite loop, waiting for input, or
319whatever.
320@enddefcom
321
322
323@section[The Current Package]
324@label[lisp-package]
325@index[package]
326The current package is the package which Lisp interaction commands use. The
327current package is specified on a per-buffer basis, and defaults to "@f[USER]".
328If the current package does not exist in the eval server, then it is created.
329If evaluation is being done in the editor process and the current package
330doesn't exist, then the value of @f[*package*] is used. The current package is
331displayed in the modeline (see section @ref[modelines].) Normally the package
332for each file is specified using the @f[Package] file option (see page
333@pageref[file-options].)
334
335When in a slave buffer, the current package is controlled by the value of
336@var[package] in that Lisp process. Modeline display of the current package
337is inhibited in this case.
338
339@defcom[com "Set Buffer Package"]
340This command prompts for the name of a package to make the local package in the
341current buffer. If the current buffer is a slave, background, or eval buffer,
342then this sets the current package in the associated eval server or editor
343Lisp. When in an interactive buffer, do not use @f[in-package]; use this
344command instead.
345@enddefcom
346
347
348@section[Compiling and Evaluating Lisp Code]
349
350@index[compilation]@index[evaluation]These commands can greatly speed up
351the edit/debug cycle since they enable incremental reevaluation or
352recompilation of changed code, avoiding the need to compile and load an
353entire file.
354
355@defcom[com "Evaluate Expression", bind (M-Escape)]
356This command prompts for an expression and prints the result of its evaluation
357in the echo area. If an error happens during evaluation, the evaluation is
358simply aborted, instead of going into the debugger. This command doesn't
359return until the evaluation is complete.
360@enddefcom
361
362@defcom[com "Evaluate Defun", bind (C-x C-e)]
363@defcom1[com "Evaluate Region"]
364@defcom1[com "Evaluate Buffer"]
365These commands evaluate text out of the current buffer, reading the current
366defun, the region and the entire buffer, respectively. The result of the
367evaluation of each form is displayed in the echo area. If the region is
368active, then @hid[Evaluate Defun] evaluates the current region, just like
369@hid[Evaluate Region].
370@enddefcom
371
372@defcom[com "Macroexpand Expression", bind (C-M)]
373This command shows the macroexpansion of the next expression in the null
374environment in a pop-up window. With an argument, it uses @f[macroexpand]
375instead of @f[macroexpand-1].
376@enddefcom
377
378@defcom[com "Re-evaluate Defvar"]
379This command is similar to @hid[Evaluate Defun]. It is used for force the
380re-evaluation of a @f[defvar] init form. If the current top-level form is a
381@f[defvar], then it does a @f[makunbound] on the variable, and evaluates the
382form.
383@enddefcom
384
385@defcom[com "Compile Defun", bind (C-x C-c)]
386@defcom1[com "Compile Region"]
387These commands compile the text in the current defun and the region,
388respectively. If the region is active, then @hid[Compile Defun] compiles the
389current region, just like @hid[Compile Region].
390@enddefcom
391
392@defcom[com "Load File"]
393@defhvar1[var "Load Pathname Defaults", val {nil}]
394This command prompts for a file and loads it into the current eval server using
395@f[load]. @hid[Load Pathname Defaults] contains the default pathname for this
396command. This variable is set to the file loaded; if it is @nil, then there is
397no default. This command also uses the @hid[Remote Compile File] variable.
398@enddefcom
399
400
401@section[Compiling Files]
402These commands are used to compile source ("@f[.lisp]") files, producing binary
403("@f[.fasl]") output files. Note that unlike the other compiling and evalating
404commands, this does not have the effect of placing the definitions in the
405environment; to do so, the binary file must be loaded.
406
407@defcom[com "Compile Buffer File", bind (C-x c)]
408@defhvar1[var "Compile Buffer File Confirm", val {t}]
409This command asks for confirmation, then saves the current buffer (when
410modified) and compiles the associated file. The confirmation prompt indicates
411intent to save and compile or just compile. If the buffer wasn't modified, and
412a comparison of the write dates for the source and corresponding binary
413("@f[.fasl]") file suggests that recompilation is unnecessary, the confirmation
414also indicates this. A prefix argument overrides this test and forces
415recompilation. Since there is a complete log of output in the background
416buffer, the creation of the normal error output ("@f[.err]") file is inhibited.
417
418Setting @hid[Compile Buffer File Confirm] to @nil inhibits confirmation, except
419when the binary is up to date and a prefix argument is not supplied.
420@enddefcom
421
422@defcom[com "Compile File"]
423This command prompts for a file and compiles that file, providing a convenient
424way to compile a file that isn't in any buffer. Unlike
425@hid[Compile Buffer File], this command doesn't do any consistency checks such
426as checking whether the source is in a modified buffer or the binary is up to
427date.
428@enddefcom
429
430@defcom[com "Compile Group"]
431@defcom1[com "List Compile Group"]
432@label[compile-group-command]@index[group, compilation]@hid[Compile Group] does
433a @hid[Save All Files] and then compiles every "@f[.lisp]" file for which the
434corresponding "@f[.fasl]" file is older or nonexistent. The files are compiled
435in the order in which they appear in the group definition. A prefix argument
436forces compilation of all "@f[.lisp]" files.
437
438@hid[List Compile Group] lists any files that would be compiled by
439@hid[Compile Group]. All Modified files are saved before checking to generate
440a consistent list.
441@enddefcom
442
443@defcom[com "Set Compile Server"]
444@defcom1[com "Set Buffer Compile Server"]
445@defcom1[com "Current Compile Server"]
446These commands are analogous to @hid[Set Eval Server], @comref[Set Buffer Eval
447Server] and @hid[Current Eval Server], but they determine the eval server used
448for file compilation requests. If the user specifies a compile server, then
449the file compilation commands send compilation requests to that server instead
450of the current eval server.
451
452Having a separate compile server makes it easy to do compilations in the
453background while continuing to interact with your eval server and editor. The
454compile server can also run on a remote machine relieving your active
455development machine of the compilation effort.
456@enddefcom
457
458@defcom[com "Next Compiler Error", bind (H-n)]
459@defcom1[com "Previous Compiler Error", bind (H-p)]
460These commands provides a convenient way to inspect compiler errors. First it
461splits the current window if there is only one window present. @hemlock
462positions the current point in the first window at the erroneous source code
463for the next (or previous) error. Then in the second window, it displays the
464error beginning at the top of the window. Given an argument, this command
465skips that many errors.
466@enddefcom
467
468@defcom[com "Flush Compiler Error Information"]
469This command relieves the current eval server of all infomation about errors
470encountered while compiling. This is convenient if you have been compiling a
471lot, but you were ignoring errors and warnings. You don't want to step through
472all the old errors, so you can use this command immediately before compiling a
473file whose errors you intend to edit.
474@enddefcom
475
476
477@defhvar[var "Remote Compile File", val {nil}]
478When true, this variable causes file compilations to be done using the RFS
479remote file system mechanism by prepending "@f[/../]@i[host]" to the file being
480compiled. This allows the compile server to be run on a different machine, but
481requires that the source be world readable. If false, commands use source
482filenames directly. Do NOT use this to compile files in AFS.
483@enddefhvar
484
485
486@section[Querying the Environment]
487@index[documentation, lisp]
488These commands are useful for obtaining various random information from the
489Lisp environment.
490
491@defcom[com "Describe Function Call", bind (C-M-A)]
492@defcom1[com "Describe Symbol", bind (C-M-S)]
493@hid[Describe Function Call] uses the current eval server to describe the
494symbol found at the head of the currently enclosing list, displaying the output
495in a pop-up window. @hid[Describe Symbol] is the same except that it describes
496the symbol at or before the point. These commands are primarily useful for
497finding the documentation for functions and variables. If there is no
498currently valid eval server, then this command uses the editor Lisp's
499environment instead of trying to spawn a slave.
500@enddefcom
501
502
503@section[Editing Definitions]
504The Lisp compiler annotates each compiled function object with the source
505file that the function was originally defined from. The definition editing
506commands use this information to locate and edit the source for functions
507defined in the environment.
508
509@defcom[com "Edit Definition"]
510@defcom1[com "Goto Definition", bind (C-M-F)]
511@defcom1[com "Edit Command Definition"]
512@hid[Edit Definition] prompts for the name of a function, and then uses the
513current eval server to find out in which file the function is defined. If
514something other than @f[defun] or @f[defmacro] defined the function, then this
515simply reads in the file, without trying to find its definition point within
516the file. If the function is uncompiled, then this looks for it in the current
517buffer. If there is no currently valid eval server, then this command uses the
518editor Lisp's environment instead of trying to spawn a slave.
519
520@hid[Goto Definition] edits the definition of the symbol at the beginning of
521the current list.
522
523@hid[Edit Command Definition] edits the definition of a @hemlock command. By
524default, this command does a keyword prompt for the command name (as in an
525extended command). If a prefix argument is specified, then instead prompt for
526a key and edit the definition of the command bound to that key.
527@enddefcom
528
529@defcom[com "Add Definition Directory Translation"]
530@defcom1[com "Delete Definition Directory Translation"]
531The defining file is recorded as an absolute pathname. The definition editing
532commands have a directory translation mechanism that allow the sources to be
533found when they are not in the location where compilation was originally done.
534@hid[Add Definition Directory Translation] prompts for two directory
535namestrings and causes the first to be mapped to the second. Longer (more
536specific) directory specifications are matched before shorter (more general)
537ones.
538
539@hid[Delete Definition Directory Translation] prompts for a directory
540namestring and deletes it from the directory translation table.
541@enddefcom
542
543@defhvar[var "Editor Definition Info", val {nil}]
544When this variable is true, the editor Lisp is used to determine definition
545editing information, otherwise the current eval server is used. This variable
546is true in @hid[Eval] and @hid[Editor] modes.
547@enddefhvar
548
549
550@section[Debugging]
551These commands manipulate the slave when it is in the debugger and provide
552source editing based on the debugger's current frame. These all affect the
553@hid[Current Eval Server].
554
555
556@subsection[Changing Frames]
557
558@defcom[com "Debug Down", bind (C-M-H-d)]
559This command moves down one debugger frame.
560@enddefcom
561
562@defcom[com "Debug Up", bind (C-M-H-u)]
563This command moves up one debugger frame.
564@enddefcom
565
566@defcom[com "Debug Top", bind (C-M-H-t)]
567This command moves to the top of the debugging stack.
568@enddefcom
569
570@defcom[com "Debug Bottom", bind (C-M-H-b)]
571This command moves to the bottom of the debugging stack.
572@enddefcom
573
574@defcom[com "Debug Frame", bind (C-M-H-f)]
575This command moves to the absolute debugger frame number indicated by the
576prefix argument.
577@enddefcom
578
579
580@subsection[Getting out of the Debugger]
581
582@defcom[com "Debug Quit", bind (C-M-H-q)]
583This command throws to top level out of the debugger in the @hid[Current Eval
584Server].
585@enddefcom
586
587@defcom[com "Debug Go", bind (C-M-H-g)]
588This command tries the @f[continue] restart in the @hid[Current Eval Server].
589@enddefcom
590
591@defcom[com "Debug Abort", bind (C-M-H-a)]
592This command executes the ABORT restart in the @hid[Current Eval Server].
593@enddefcom
594
595@defcom[com "Debug Restart", bind (C-M-H-r)]
596This command executes the restart indicated by the prefix argument in the
597@hid[Current Eval Server]. The debugger enumerates the restart cases upon
598entering it.
599@enddefcom
600
601
602@subsection[Getting Information]
603
604@defcom[com "Debug Help", bind (C-M-H-h)]
605This command in prints the debugger's help text.
606@enddefcom
607
608@defcom[com "Debug Error", bind (C-M-H-e)]
609This command prints the error condition and restart cases displayed upon
610entering the debugger.
611@enddefcom
612
613@defcom[com "Debug Backtrace", bind (C-M-H-B)]
614This command executes the debugger's @f[backtrace] command.
615@enddefcom
616
617@defcom[com "Debug Print", bind (C-M-H-p)]
618This command prints the debugger's current frame in the same fashion as the
619frame motion commands.
620@enddefcom
621
622@defcom[com "Debug Verbose Print", bind (C-M-H-P)]
623This command prints the debugger's current frame without elipsis.
624@enddefcom
625
626@defcom[com "Debug Source", bind (C-M-H-s)]
627This command prints the source form for the debugger's current frame.
628@enddefcom
629
630@defcom[com "Debug Verbose Source"]
631This command prints the source form for the debugger's current frame with
632surrounding forms for context.
633@enddefcom
634
635@defcom[com "Debug List Locals", bind (C-M-H-l)]
636This prints the local variables for the debugger's current frame.
637@enddefcom
638
639
640@subsection[Editing Sources]
641
642@defcom[com "Debug Edit Source", bind (C-M-H-S)]
643This command attempts to place you at the source location of the debugger's
644current frame. Not all debugger frames represent function's that were compiled
645with the appropriate debug-info policy. This beeps with a message if it is
646unsuccessful.
647@enddefcom
648
649
650@subsection[Miscellaneous]
651
652@defcom[com "Debug Flush Errors", bind (C-M-H-F)]
653This command toggles whether the debugger ignores errors or recursively enters
654itself.
655@enddefcom
656
657
658
659
660@section[Manipulating the Editor Process]
661When developing @hemlock customizations, it is useful to be able to manipulate
662the editor Lisp environment from @hemlock.
663
664@defcom[com "Editor Describe", bind (Home t, C-_ t)]
665This command prompts for an expression, and then evaluates and describes it
666in the editor process.
667@enddefcom
668
669@defcom[com "Room"]
670Call the @f[room] function in the editor process, displaying information
671about allocated storage in a pop-up window.
672@enddefcom
673
674@defcom[com "Editor Load File"]
675This command is analogous to @comref[Load File], but loads the file into the
676editor process.
677@enddefcom
678
679
680@subsection[Editor Mode]
681When @hid[Editor] mode is on, alternate versions of the Lisp interaction
682commands are bound in place of the eval server based commands. These commands
683manipulate the editor process instead of the current eval server. Turning on
684editor mode in a buffer allows incremental development of code within the
685running editor.
686
687@defcom[com "Editor Mode"]
688This command turns on @hid[Editor] minor mode in the current buffer. If it is
689already on, it is turned off. @hid[Editor] mode may also be turned on using
690the @f[Mode] file option (see page @pageref[file-options].)
691@enddefcom
692
693@defcom[com "Editor Compile Defun",
694 stuff (bound to @bf[C-x C-c] in @hid[Editor] mode)]
695@defcom1[com "Editor Compile Region"]
696@defcom1[com "Editor Evaluate Buffer"]
697@defcom1[com "Editor Evaluate Defun",
698 stuff (bound to @bf[C-x C-e] in @hid[Editor] mode)]
699@defcom1[com "Editor Evaluate Region"]
700@defcom1[com "Editor Macroexpand Expression", bind (Editor: C-M)]
701@defcom1[com "Editor Re-evaluate Defvar"]
702@defcom1[com "Editor Describe Function Call",
703 stuff (bound to @bf[C-M-A] in @hid[Editor] mode)]
704@defcom1[com "Editor Describe Symbol",
705 stuff (bound to @bf[C-M-S] in @hid[Editor] mode)]
706These commands are similar to the standard commands, but modify or examine the
707Lisp process that @hemlock is running in. Terminal I/O is done on the
708initial window for the editor's Lisp process. Output is directed to a pop-up
709window or the editor's window instead of to the background buffer.
710@enddefcom
711
712@defcom[com "Editor Compile Buffer File"]
713@defcom1[com "Editor Compile File"]
714@defcom1[com "Editor Compile Group"]
715In addition to compiling in the editor process, these commands differ from the
716eval server versions in that they direct output to the the
717@hid[Compiler Warnings] buffer.
718@enddefcom
719
720@defcom[com "Editor Evaluate Expression",
721 stuff (bound to @bf[M-Escape] in @hid[Editor] mode and @bf[C-M-Escape])]
722This command prompts for an expression and evaluates it in the editor process.
723The results of the evaluation are displayed in the echo area.
724@enddefcom
725
726
727@subsection[Eval Mode]
728@label[eval-mode]
729@index[modes, eval]@hid[Eval] mode is a minor mode that simulates a @f[read]
730@f[eval] @f[print] loop running within the editor process. Since Lisp
731program development is usually done in a separate eval server process (see page
732@pageref[eval-servers]), @hid[Eval] mode is used primarily for debugging code
733that must run in the editor process. @hid[Eval] mode shares some commands with
734@hid[Typescript] mode: see section @ref[typescripts].
735
736@hid[Eval] mode doesn't completely support terminal I/O: it binds
737@var[standard-output] to a stream that inserts into the buffer and
738@var[standard-input] to a stream that signals an error for all operations.
739@hemlock cannot correctly support the interactive evaluation of forms that read
740from the @hid[Eval] interactive buffer.
741
742@defcom[com "Select Eval Buffer"]
743This command changes to the @hid[Eval] buffer, creating one if it doesn't
744already exist. The @hid[Eval] buffer is created with @hid[Lisp] as the major
745mode and @hid[Eval] and @hid[Editor] as minor modes.
746@enddefcom
747
748@defcom[com "Confirm Eval Input",
749 stuff (bound to @bf[Return] in @hid[Eval] mode)]
750This command evaluates all the forms between the end of the last output and
751the end of the buffer, inserting the results of their evaluation in the buffer.
752This beeps if the form is incomplete. Use @binding[Linefeed] to insert line
753breaks in the middle of a form.
754
755This command uses @hid[Unwedge Interactive Input Confirm] in the same way
756@hid[Confirm Interactive Input] does.
757@enddefcom
758
759@defcom[com "Abort Eval Input",
760 stuff (bound to @bf[M-i] in @hid[Eval] mode)]
761This command moves the the end of the buffer and prompts, ignoring any
762input already typed in.
763@enddefcom
764
765
766@subsection[Error Handling]
767@index[error handling]
768When an error happens inside of @hemlock, @hemlock will trap the error and
769display the error message in the echo area, possibly along with the
770"@f[Internal error:]" prefix. If you want to debug the error, type @bf[?].
771This causes the prompt "@f[Debug:]" to appear in the echo area. The following
772commands are recognized:
773@begin[description]
774@bf[d]@\Enter a break-loop so that you can use the Lisp debugger.
775Proceeding with "@f[go]" will reenter @hemlock and give the "@f[Debug:]"
776prompt again.
777
778@bf[e]@\Display the original error message in a pop-up window.
779
780@bf[b]@\Show a stack backtrace in a pop-up window.
781
782@bf[q, Escape]@\Quit from this error to the nearest command loop.
783
784@bf[r]@\Display a list of the restart cases and prompt for the number of a
785@f[restart-case] with which to continue. Restarting may result in prompting in
786the window in which Lisp started.
787@end[description]
788
789Only errors within the editor process are handled in this way. Errors during
790eval server operations are handled using normal terminal I/O on a typescript in
791the eval server's slave buffer or background buffer (see page
792@pageref[operations]). Errors due to interaction in a slave buffer will cause
793the debugger to be entered in the slave buffer.
794
795
796@section[Command Line Switches]
797@label[slave-switch]
798Two command line switches control the initialization of editor and eval servers
799for a Lisp process:
800@begin[description]
801@f<-edit>@\
802@label[edit-switch]
803This switch starts up @hemlock. If there is a non-switch command line word
804immediately following the program name, then the system interprets it as a file
805to edit. For example, given
806@Begin[ProgramExample]
807lisp file.txt -edit
808@End[ProgramExample]
809Lisp will go immediately into @hemlock finding the file @f[file.txt].
810
811@f<-slave [>@i[name]@f<]>@\
812 This switch causes the Lisp process to become a slave of the editor process
813@i[name]. An editor Lisp determines @i[name] when it allows connections from
814slaves. Once the editor chooses a name, it keeps the same name until the
815editor's Lisp process terminates. Since the editor can automatically create
816slaves on its own machine, this switch is useful primarily for creating slaves
817that run on a different machine. @f[hqb]'s machine is @f[ME.CS.CMU.EDU], and
818he wants want to run a slave on @f[SLAVE.CS.CMU.EDU], then he should use the
819@hid[Accept Slave Connections] command, telnet to the machine, and invoke Lisp
820supplying @f[-slave] and the editor's name. The command displays the editor's
821name.
822@end[description]
Note: See TracBrowser for help on using the repository browser.