source: release/1.8/source/cocoa-ide/hemlock/doc/user/intro.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: 48.7 KB
Line 
1@comment{-*- Dictionary: target:scribe/hem/hem; Mode: spell; Package: Hemlock -*-}
2@chap[Introduction]
3
4@hemlock is a text editor which follows in the tradition of @emacs
5and the Lisp Machine editor ZWEI. In its basic form, @hemlock has almost
6the same command set as ITS/TOPS-20 @emacs@foot[In this document, "Emacs"
7refers to this, the original version, rather than to any of the large
8numbers of text editors inspired by it which may go by the same name.],
9and similar features such as multiple windows and extended commands, as
10well as built in documentation features. The reader should bear in mind
11that whenever some powerful feature of @hemlock is described, it has
12probably been directly inspired by @emacs.
13
14This manual describes @hemlock@comment{}'s commands and other user visible
15features and then goes on to tell how to make simple customizations. For
16complete documentation of the @hemlock primitives with which commands are
17written, the @i[Hemlock Command Implementor's Manual] is also available.
18
19
20
21@section[The Point and The Cursor]
22
23@index[point]
24@index[cursor]
25The @i[point] is the current focus of editing activity. Text typed in by the
26user is inserted at the point. Nearly all commands use the point as a
27indication of what text to examine or modify. Textual positions in @hemlock
28are between characters. This may seem a bit curious at first, but it is
29necessary since text must be inserted between characters. Although the point
30points between characters, it is sometimes said to point @i[at] a character, in
31which case the character after the point is referred to.
32
33The @i[cursor] is the visible indication of the current focus of attention: a
34rectangular blotch under @windows, or the hardware cursor on a terminal. The
35cursor is usually displayed on the character which is immediately after the
36point, but it may be displayed in other places. Wherever the cursor is
37displayed it indicates the current focus of attention. When input is being
38prompted for in the echo area, the cursor is displayed where the input is to
39go. Under @windows the cursor is only displayed when @hemlock is waiting
40for input.
41
42
43@section[Notation]
44
45There are a number of notational conventions used in this manual which need
46some explanation.
47
48
49@subsection[Key-events]
50
51@label[key-events]
52@index[key-events, notation]
53@index[bits, key-event]
54@index[modifiers, key-event]
55The canonical representation of editor input is a @i[key-event]. When you type
56on the keyboard, @hemlock receives key-events. Key-events have names for their
57basic form, and we refer to this name as a @i[keysym]. This manual displays
58keysyms in a @bf[Bold] font. For example, @bf[a] and @bf[b] are the keys that
59normally cause the editor to insert the characters @i[a] and @i[b].
60
61Key-events have @i[modifiers] or @i[bits] indicating a special interpretation
62of the root key-event. Although the keyboard places limitations on what
63key-events you can actually type, @hemlock understands arbitrary combinations
64of the following modifiers: @i[Control], @i[Meta], @i[Super], @i[Hyper],
65@i[Shift], and @i[Lock]. This manual represents the bits in a key-event by
66prefixing the keysym with combinations of @bf[C-], @bf[M-], @bf[S-], @bf[H-],
67@bf[Shift-], and @bf[Lock]. For example, @bf[a] with both the control and meta
68bits set appears as @bf[C-M-a]. In general, ignore the shift and lock
69modifiers since this manual never talks about keysyms that explicitly have
70these bits set; that is, it may talk about the key-event @bf[A], but it would
71never mention @bf[Shift-a]. These are actually distinct key-events, but
72typical input coercion turns presents @hemlock with the former, not the latter.
73
74Key-event modifiers are totally independent of the keysym. This may be new to
75you if you are used to thinking in terms of ASCII character codes. For
76example, with key-events you can distinctly identify both uppercase and
77lowercase keysyms with the control bit set; therefore, @bf[C-a] and @bf[C-A]
78may have different meanings to @hemlock.
79
80Some keysyms' names consist of more than a single character, and these usually
81correspond to the legend on the keyboard. For example, some keyboards let you
82enter @bf[Home], @bf[Return], @bf[F9], etc.
83
84In addition to a keyboard, you may have a mouse or pointer device. Key-events
85also represent this kind of input. For example, the down and up transitions of
86the @i[left button] correspond to the @bf[Leftdown] and @bf[Leftup] keysyms.
87
88See sections @ref[key-bindings], @ref[using-x], @ref[using-terminals]
89
90
91@subsection[Commands]
92
93@index[commands]@label[commands]Nearly everything that can be done in
94@hemlock is done using a command. Since there are many things worth
95doing, @hemlock provides many commands, currently nearly two hundred.
96Most of this manual is a description of what commands exist, how they are
97invoked, and what they do. This is the format of a command's
98documentation:
99
100@defcom[com "Sample Command", bind (C-M-q, C-`)]
101@begin[quotation, facecode i, leftmargin 8ems, rightmargin 3.5ems,
102below 0.8 lines]
103This command's name is @hid[Sample Command], and it is bound to
104@w(@bf(C-M-q)) and @bf[C-`], meaning that typing either of these will
105invoke it. After this header comes a description of what the command does:
106@end[quotation]
107
108This command replaces all occurrences following the point of the string
109"@f[Pascal]" with the string "@f[Lisp]". If a prefix argument is supplied,
110then it is interpreted as the maximum number of occurrences to replace. If
111the prefix argument is negative then the replacements are done backwards
112from the point.
113@comment<
114@begin[quotation, facecode i, leftmargin 8ems, rightmargin 3.5ems,
115above 0.8 lines, below 0.8 lines]
116Toward the end of the description there may be information primarily of
117interest to customizers and command implementors. If you don't understand
118this information, don't worry, the writer probably forgot to speak English.
119@end[quotation]
120
121@b[Arguments:]
122@begin[description]
123@i[target]@\The string to replace with "@f[Lisp]".
124
125@i[buffer]@\The buffer to do the replacement in. If this is @f[:all] then
126the replacement is done in all buffers.
127@end[description]>
128@enddefcom
129
130
131@subsection[Hemlock Variables]
132
133@index[variables, hemlock]@hemlock variables supply a simple
134customization mechanism by permitting commands to be parameterized. For
135details see page @pageref[vars].
136
137@defhvar[var "Sample Variable", val {36}]
138@begin[quotation, facecode i, leftmargin 8ems, below 0.8 lines]
139The name of this variable is @hid[Sample Variable] and its initial value is
14036.
141@end[quotation]
142this variable sets a lower limit on the number of replacements that be done
143by @hid[Sample Command]. If the prefix argument is supplied, and smaller
144in absolute value than @hid[Sample Variable], then the user is prompted as
145to whether that small a number of occurrences should be replaced, so as to
146avoid a possibly disastrous error.
147@enddefhvar
148
149
150@section[Invoking Commands]
151@index[invocation, command]
152In order to get a command to do its thing, it must be invoked. The user can do
153this two ways, by typing the @i[key] to which the command is @i[bound] or by
154using an @i[extended command]. Commonly used commands are invoked via their
155key bindings since they are faster to type, while less used commands are
156invoked as extended commands since they are easier to remember.
157
158
159@subsection[Key Bindings]
160@index[bindings, key]
161@index[key bindings]
162@label[key-bindings]
163A key is a sequence of key-events (see section @ref[key-events]) typed on the
164keyboard, usually only one or two in length. Sections @ref[using-x] and
165@ref[using-terminals] contain information on particular input devices.
166
167When a command is bound to a key, typing the key causes @hemlock to invoke the
168command. When the command completes its job, @hemlock returns to reading
169another key, and this continually repeats.
170
171Some commands read key-events interpreting them however each command desires.
172When commands do this, key bindings have no effect, but you can usually abort
173@hemlock whenever it is waiting for input by typing @binding[C-g] (see section
174@ref[aborting]). You can usually find out what options are available by typing
175@binding[C-_] or @binding[Home] (see section @ref[help]).
176
177The user can easily rebind keys to different commands, bind new keys to
178commands, or establish bindings for commands never bound before (see section
179@ref[binding-keys]).
180
181In addition to the key bindings explicitly listed with each command, there are
182some implicit bindings created by using key translations@foot[Key translations
183are documented in the @i[Hemlock Command Implementor's Manual].]. These
184bindings are not displayed by documentation commands such as @hid[Where Is].
185By default, there are only a few key translations. The modifier-prefix
186characters @bf[C-^], @bf[Escape], @bf[C-z], or @bf[C-c] may be used when typing
187keys to convert the following key-event to a control, meta, control-meta, or
188hyper key-event. For example, @bf[C-x Escape b] invokes the same commands as
189@bf[C-x M-b], and @bf[C-z u] is the same as @bf[C-M-u]. This allows user to
190type more interesting keys on limited keyboards that lack control, meta, and
191hyper keys.
192@index[bit-prefix key-events]
193
194
195@defhvar[var "Key Echo Delay", val {1.0}]
196A key binding may be composed of several key-events, especially when you enter
197it using modifier-prefix key-events. @hemlock provides feedback for partially
198entered keys by displaying the typed key-events in the echo area. In order to
199avoid excessive output and clearing of the echo area, this display is delayed
200by @hid[Key Echo Delay] seconds. If this variable is set to @nil, then
201@hemlock foregoes displaying initial subsequences of keys.
202@enddefhvar
203
204
205@subsection[Extended Commands]
206
207@index[commands, extended]A command is invoked as an extended command by
208typing its name to the @hid[Extended Command] command, which is invoked
209using its key binding, @binding[M-x].
210
211@defcom[com "Extended Command", bind {M-x}]
212This command prompts in the echo area for the name of a command, and then
213invokes that command. The prefix argument is passed through to the command
214invoked. The command name need not be typed out in full, as long as enough
215of its name is supplied to uniquely identify it. Completion is available
216using @binding[Escape] and @binding[Space], and a list of possible completions
217is given by @binding[Home] or @binding[C-_].
218@enddefcom
219
220
221@section[The Prefix Argument]
222
223@index[prefix argument]The prefix argument is an integer argument which
224may be supplied to a command. It is known as the prefix argument because
225it is specified by invoking some prefix argument setting command
226immediately before the command to be given the argument. The following
227statements about the interpretation of the prefix argument are true:
228@begin[itemize]
229When it is meaningful, most commands interpret the prefix argument as a
230repeat count, causing the same effect as invoking the command that many
231times.
232
233When it is meaningful, most commands that use the prefix argument interpret
234a negative prefix argument as meaning the same thing as a positive
235argument, but the action is done in the opposite direction.
236
237Most commands treat the absence of a prefix argument as meaning the same
238thing as a prefix argument of one.
239
240Many commands ignore the prefix argument entirely.
241
242Some commands do none of the above.
243@end[itemize]
244The following commands are used to set the prefix argument:
245
246@defcom[com "Argument Digit", stuff (bound to all control or meta digits)]
247Typing a number using this command sets the prefix argument to that number,
248for example, typing @binding[M-1 M-2] sets the prefix argument to twelve.
249@enddefcom
250
251@defcom[com "Negative Argument", bind {M--}]
252This command negates the prefix argument, or if there is none, sets it to
253negative one. For example, typing @binding[M-- M-7] sets the prefix
254argument to negative seven.
255@enddefcom
256
257@defcom[com "Universal Argument", bind {C-u}]
258@defhvar1[var "Universal Argument Default", val {4}]
259This command sets the prefix argument or multiplies it by four. If digits
260are typed immediately afterward, they are echoed in the echo area, and the
261prefix argument is set to the specified number. If no digits are typed
262then the prefix argument is multiplied by four. @binding[C-u - 7] sets the
263prefix argument to negative seven. @binding[C-u C-u] sets the prefix
264argument to sixteen. @binding[M-4 M-2 C-u] sets the prefix argument to one
265hundred and sixty-eight. @binding[C-u M-0] sets the prefix argument to
266forty.
267
268@hid[Universal Argument Default] determines the default value and multiplier
269for the @hid[Universal Argument] command.
270@enddefcom
271
272
273@section[Modes]
274
275@label[modes]@index[modes]A mode provides a way to change @hemlock@comment{}'s
276behavior by specifying a modification to current key bindings, values of
277variables, and other things. Modes are typically used to adjust @hemlock
278to suit a particular editing task, e.g. @hid[Lisp] mode is used for editing
279@llisp code.
280
281Modes in @hemlock are not like modes in most text editors; @hemlock is really a
282"modeless" editor. There are two ways that the @hemlock mode concept differs
283from the conventional one:
284@begin[enumerate]
285Modes do not usually alter the environment in a very big way, i.e. replace
286the set of commands bound with another totally disjoint one. When a mode
287redefines what a key does, it is usually redefined to have a slightly
288different meaning, rather than a totally different one. For this reason,
289typing a given key does pretty much the same thing no matter what modes are
290in effect. This property is the distinguishing characteristic of a
291modeless editor.
292
293Once the modes appropriate for editing a given file have been chosen, they
294are seldom, if ever, changed. One of the advantages of modeless editors is
295that time is not wasted changing modes.
296@end[enumerate]
297
298@index[major mode]A @i[major mode] is used to make some big change in the
299editing environment. Language modes such as @hid[Pascal] mode are major
300modes. A major mode is usually turned on by invoking the command
301@i{mode-name}@hid[ Mode] as an extended command. There is only one major
302mode present at a time. Turning on a major mode turns off the one that is
303currently in effect.
304
305@index[minor mode]A @i[minor mode] is used to make a small change in the
306environment, such as automatically breaking lines if they get too long.
307Unlike major modes, any number of minor modes may be present at once.
308Ideally minor modes should do the "right thing" no matter what major and
309minor modes are in effect, but this is may not be the case when key
310bindings conflict.
311
312Modes can be envisioned as switches, the major mode corresponding to one big
313switch which is thrown into the correct position for the type of editing being
314done, and each minor mode corresponding to an on-off switch which controls
315whether a certain characteristic is present.
316
317@defcom[com "Fundamental Mode"]
318This command puts the current buffer into @hid[Fundamental] mode.
319@hid[Fundamental] mode is the most basic major mode: it's the next best thing
320to no mode at all.
321@enddefcom
322
323
324@section[Display Conventions]
325@index[display conventions]
326There are two ways that @hemlock displays information on the screen; one is
327normal @i[buffer display], in which the text being edited is shown on the
328screen, and the other is a @i[pop-up window].
329
330
331@subsection[Pop-Up Windows]
332@index[pop-up windows]
333@index[random typeout]
334@label[pop-up]
335Some commands print out information that is of little permanent value, and
336these commands use a @i[pop-up] window to display the information. It is known
337as a @i[pop-up] window because it temporarily appears on the screen overlaying
338text already displayed. Most commands of this nature can generate their output
339quickly, but in case there is a lot of output, or the user wants to repeatedly
340refer to the same output while editing, @hemlock saves the output in a buffer.
341Different commands may use different buffers to save their output, and we refer
342to these as @i[random typeout] buffers.
343
344If the amount of output exceeds the size of the pop-up window, @Hemlock
345displays the message @w<"@f[--More--]"> after each window full. The following
346are valid responses to this prompt:
347@Begin[Description]
348@bf[Space], @bf[y]@\
349 Display the next window full of text.
350
351@bf[Delete], @bf[Backspace], @bf[n]@\
352 Abort any further output.
353
354@bf[Escape], @bf[!]@\
355 Remove the window and continue saving any further output in the buffer.
356
357@bf[k]@\
358 This is the same as @bf[!] or @bf[escape], but @hemlock makes a normal window
359over the pop-up window. This only works on bitmap devices.
360@End[Description]
361Any other input causes the system to abort using the key-event to determine
362the next command to execute.
363
364When the output is complete, @hemlock displays the string @w<"@f[--Flush--]">
365in the pop-up window's modeline, indicating that the user may flush the
366temporary display. Typing any of the key-events described above removes the
367pop-up window, but typing @bf[k] still produces a window suitable for normal
368editing. Any other input also flushes the display, but @hemlock uses the
369key-event to determine the next command to invoke.
370
371@defcom[com "Select Random Typeout Buffer", bind {H-t}]
372This command makes the most recently used random typeout buffer the current
373buffer in the current window.
374@enddefcom
375
376Random typeout buffers are always in @hid[Fundamental] mode.
377
378
379@subsection[Buffer Display]
380@index[buffer, display]
381@index[display, buffer]
382
383If a line of text is too long to fit within the screen width it is @i[wrapped],
384with @hemlock displaying consecutive pieces of the text line on as many screen
385lines as needed to hold the text. @hemlock indicates a wrapped line by placing
386a line-wrap character in the last column of each screen line. Currently, the
387line-wrap character is an exclamation point (@f[!]). It is possible for a line
388to wrap off the bottom of the screen or on to the top.
389
390@hemlock wraps screen lines when the line is completely full regardless of the
391line-wrap character. Most editors insert the line-wrap character and wrap a
392single character when a screen line would be full if the editor had avoided
393wrapping the line. In this situation, @hemlock would leave the screen line
394full. This means there are always at least two characters on the next screen
395line if @hemlock wraps a line of display. When the cursor is at the end of a
396line which is the full width of the screen, it is displayed in the last column,
397since it cannot be displayed off the edge.
398
399@hemlock displays most characters as themselves, but it treats some
400specially:
401@begin[itemize]
402Tabs are treated as tabs, with eight character tab-stops.
403
404Characters corresponding to ASCII control characters are printed as
405@f[^]@i[char]; for example, a formfeed is @f[^L].
406
407Characters with the most-significant bit on are displayed as
408@f[<]@i[hex-code]@f[>]; for example, @f[<E2>].
409@end[itemize]
410Since a character may be displayed using more than one printing character,
411there are some positions on the screen which are in the middle of a character.
412When the cursor is on a character with a multiple-character representation,
413@hemlock always displays the cursor on the first character.
414
415
416@subsection[Recentering Windows]
417@index[recentering windows]
418@index[windows, recentering]
419
420When redisplaying the current window, @hemlock makes sure the current point is
421visible. This is the behavior you see when you are entering text near the
422bottom of the window, and suddenly redisplay shifts your position to the
423window's center.
424
425Some buffers receive input from streams and other processes, and you might have
426windows displaying these. However, if those windows are not the current
427window, the output will run off the bottom of the windows, and you won't be
428able to see the output as it appears in the buffers. You can change to a
429window in which you want to track output and invoke the following command to
430remedy this situation.
431
432@defcom[com "Track Buffer Point"]
433This command makes the current window track the buffer's point. This means
434that each time Hemlock redisplays, it will make sure the buffer's point is
435visible in the window. This is useful for windows that are not current and
436that display buffer's that receive output from streams coming from other
437processes.
438@enddefcom
439
440
441@subsection[Modelines]
442@label[modelines]
443@index[modeline]
444A modeline is the line displayed at the bottom of each window where @hemlock
445shows information about the buffer displayed in that window. Here is a typical
446modeline:
447@begin[programexample]
448Hemlock USER: (Fundamental Fill) /usr/slisp/hemlock/user.mss
449@end[programexample]
450This tells us that the file associated with this buffer is
451"@f[/usr/slisp/hemlock/user.mss]", and the @hid[Current Package] for Lisp
452interaction commands is the @f["USER"] package. The modes currently present
453are @hid[Fundamental] and @hid[Fill]; the major mode is always displayed first,
454followed by any minor modes. If the buffer has no associated file, then the
455buffer name will be present instead:
456@begin[programexample]
457Hemlock PLAY: (Lisp) Silly:
458@end[programexample]
459In this case, the buffer is named @hid[Silly] and is in @hid[Lisp] mode. The
460user has set @hid[Current Package] for this buffer to @f["PLAY"].
461
462@defhvar[var "Maximum Modeline Pathname Length", val {nil}]
463This variable controls how much of a pathname @hemlock displays in a modeline.
464Some distributed file systems can have very long pathnames which leads to the
465more particular information in a pathname running off the end of a modeline.
466When set, the system chops off leading directories until the name is less than
467the integer value of this variable. Three dots, @f[...], indicate a truncated
468name. The user can establish this variable buffer locally with the
469@hid[Defhvar] command.
470@enddefhvar
471
472If the user has modified the buffer since the last time it was read from or
473save to a file, then the modeline contains an asterisk (@f[*]) between the
474modes list and the file or buffer name:
475@begin[programexample]
476Hemlock USER: (Fundamental Fill) * /usr/slisp/hemlock/user.mss
477@end[programexample]
478This serves as a reminder that the buffer should be saved eventually.
479
480@index[status line]
481There is a special modeline known as the @i[status line] which appears as the
482@hid[Echo Area]'s modeline. @Hemlock and user code use this area to display
483general information not particular to a buffer @dash recursive edits, whether
484you just received mail, etc.
485
486
487@section[Use with X Windows]
488@label[using-x]
489@index[X windows, use with]
490You should use @hemlock on a workstation with a bitmap display and a windowing
491system since @hemlock makes good use of a non-ASCII device, mouse, and the
492extra modifier keys typically associated with workstations. This section
493discusses using @hemlock under X windows, the only supported windowing system.
494
495
496@subsection[Window Groups]
497@index[window management]
498@label[groups]
499@hemlock manages windows under X in groups. This allows @hemlock to be more
500sophisticated in its window management without being rude in the X paradigm of
501screen usage. With window groups, @hemlock can ignore where the groups are,
502but within a group, it can maintain the window creation and deletion behavior
503users expect in editors without any interference from window managers.
504
505Initially there are two groups, a main window and the @hid[Echo Area]. If you
506keep a pop-up display, see section @ref[pop-up], @hemlock puts the window it
507creates in its own group. There are commands for creating new groups.
508
509@hemlock only links windows within a group for purposes of the @hid[Next
510Window], @hid[Previous Window], and @hid[Delete Next Window] commands. To move
511between groups, you must use the @hid[Point to Here] command bound to the
512mouse.
513
514Window manager commands can reshape and move groups on the screen.
515
516
517@subsection[Event Translation]
518@index[keyboard use under X]
519@index[translation of keys under X]
520Each X key event is translated into a canonical input representation, a
521key-event. The X key event consists of a scan-code and modifier bits, and
522these translate to an X keysym. This keysym and the modifier bits map to a
523key-event.
524
525If you type a key with a shift key held down, this typically maps to a distinct
526X keysym. For example, the shift of @bf[3] is @bf[#], and these have different
527X keysyms. Some keys map to the same X keysym regardless of the shift bit,
528such as @bf[Tab], @bf[Space], @bf[Return], etc. When the X lock bit is on, the
529system treats this as a caps-lock, only mapping keysyms for lowercase letters
530to shifted keysyms.
531
532The key-event has a keysym and a field of bits. The X keysyms map directly to
533the key-event keysyms. There is a distinct mapping for each CLX modifier bit
534to a key-event bit. This tends to eliminate shift and lock modifiers, so
535key-events usually only have control, meta, hyper, and super bits on. Hyper
536and super usually get turned on with prefix key-events that set them on the
537following key-event, but you can turn certain keys on the keyboard into hyper
538and super keys. See the X manuals and the @i[Hemlock Command Implementor's
539Manual] for details.
540
541The system also maps mouse input to key-events. Each mouse button has distinct
542key-event keysyms for whether the user pressed or released it. For
543convenience, @hemlock makes use of an odd property of converting mouse events
544to key-events. If you enter a mouse event with the shift key held down,
545@hemlock sees the key-event keysym for the mouse event, but the key-event has
546the super bit turned on. For example, if you press the left button with the
547shift key pressed, @hemlock sees @bf[S-Leftdown].
548
549Note that with the two button mouse on the IBM RT PC, the only way to to send
550@bf[Middledown] is to press both the left and right buttons simultaneously.
551This is awkward, and it often confuses the X server. For this reason, the
552commands bound to the middle button are also bound to the shifted left button,
553@bf[S-Leftdown], which is much easier to type.
554
555
556@subsection[Cut Buffer Commands]
557@index[cutting]@index[pasting] These commands allow the X cut buffer to be
558used from @hemlock . Although @hemlock can cut arbitrarily large regions,
559a bug in the standard version 10 xterm prevents large regions from being
560pasted into an xterm window.
561
562@defcom[com "Region to Cut Buffer", bind {M-Insert}]
563@defcom1[com "Insert Cut Buffer", bind {Insert}]
564These commands manipulate the X cut buffer. @hid[Region to Cut Buffer] puts
565the text in the region into the cut buffer. @hid[Insert Cut Buffer] inserts
566the contents of the cut buffer at the point.
567@enddefcom
568
569@subsection[Redisplay and Screen Management]
570
571These variables control a number of the characteristics of @hemlock bitmap
572screen management.
573
574@defhvar[var "Bell Style", val {:border-flash}]
575@defhvar1[var "Beep Border Width", val {20}]
576@hid[Bell Style] determines what beeps do in @hemlock. Acceptable values are
577@kwd[border-flash], @kwd[feep], @kwd[border-flash-and-feep], @kwd[flash],
578@kwd[flash-and-feep], and @nil (do nothing).
579
580@hid[Beep Border Width] is the width in pixels of the border flashed by border
581flash beep styles.
582@enddefhvar
583
584@defhvar[var "Reverse Video", val {nil}]
585If this variable is true, then @hemlock paints white on black in window
586bodies, black on white in modelines.
587@enddefhvar
588
589@defhvar[var "Thumb Bar Meter", val {t}]
590If this variable is true, then windows will be created to be displayed with a
591ruler in the bottom border of the window.
592@enddefhvar
593
594@defhvar[var "Set Window Autoraise", val {:echo-only}]
595When true, changing the current window will automatically raise the new current
596window. If the value is @kwd[echo-only], then only the echo area window will
597be raised automatically upon becoming current.
598@enddefhvar
599
600@defhvar[var "Default Initial Window Width", val {80}]
601@defhvar1[var "Default Initial Window Height", val {24}]
602@defhvar1[var "Default Initial Window X"]
603@defhvar1[var "Default Initial Window Y"]
604@defhvar1[var "Default Window Height", val {24}]
605@defhvar1[var "Default Window Width", val {80}]
606@index[window placement]
607@Hemlock uses the variables with "@hid[Initial]" in their names when it first
608starts up to make its first window. The width and height are specified in
609character units, but the x and y are specified in pixels. The other variables
610determine the width and height for interactive window creation, such as making
611a window with @comref[New Window].
612@enddefhvar
613
614@defhvar[var "Cursor Bitmap File", val {"library:hemlock.cursor"}]
615This variable determines where the mouse cursor bitmap is read from when
616@hemlock starts up. The mask is found by merging this name with "@f[.mask]".
617This has to be a full pathname for the C routine.
618@enddefhvar
619
620
621@defhvar[var "Default Font"]
622This variable holds the string name of the font to be used for normal text
623display: buffer text, modelines, random typeout, etc. The font is loaded at
624initialization time, so this variable must be set before entering @hemlock.
625When @nil, the display type is used to choose a font.
626@enddefhvar
627
628
629@section[Use With Terminals]
630@label[using-terminals]@index[terminals, use with] @hemlock can also be used
631with ASCII terminals and terminal emulators. Capabilities that depend on
632@windows (such as mouse commands) are not available, but nearly everything else
633can be done.
634
635@subsection[Terminal Initialization]
636
637@index[terminal speed]
638@index[speed, terminal]
639@index[slow terminals]
640@index[incremental redisplay]
641For best redisplay performance, it is very important to set the terminal speed:
642@lisp
643stty 2400
644@endlisp
645Often when running @hemlock using TTY redisplay, Hemlock will actually be
646talking to a PTY whose speed is initialized to infinity. In reality, the
647terminal will be much slower, resulting in @hemlock@comment{}'s output getting way ahead
648of the terminal. This prevents @hemlock from briefly stopping redisplay to
649allow the terminal to catch up. See also @hvarref<Scroll Redraw Ratio>.
650
651The terminal control sequences are obtained from the termcap database using the
652normal Unix conventions. The @f["TERM"] environment variable holds the
653terminal type. The @f["TERMCAP"] environment variable can be used to override
654the default termcap database (in @f["/etc/termcap"]). The size of the terminal
655can be altered from the termcap default through the use of:
656@lisp
657stty rows @i{height} columns @i{width}
658@endlisp
659
660@subsection[Terminal Input]
661@index[ASCII keyboard translation]
662@index[bit-prefix key-events]
663@index[prefix key-events]
664@index[key-event, prefix]
665The most important limitation of a terminal is its input capabilities. On a
666workstation with function keys and independent control, meta, and shift
667modifiers, it is possible to type 800 or so distinct single keystrokes.
668Although by default, @hemlock uses only a fraction of these combinations, there
669are many more than the 128 key-events available in ASCII.
670
671On a terminal, @hemlock attempts to translate ASCII control characters into the
672most useful key-event:
673@begin[itemize]
674On a terminal, control does not compose with shift. If the control key is down
675when you type a letter keys, the terminal always sends one code regardless of
676whether the shift key is held. Since @hemlock primarily binds commands to
677key-events with keysyms representing lowercase letters regardless of what bits
678are set in the key-event, the system translates the ASCII control codes to a
679keysym representing the appropriate lowercase characters. This keysym then
680forms a key-event with the control bit set. Users can type @bf[C-c] followed
681by an uppercase character to form a key-event with a keysym representing an
682uppercase character and bits with the control bit set.
683
684On a terminal, some of the named keys generate an ASCII control code. For
685example, @f[Return] usually sends a @f[C-m]. The system translates these ASCII
686codes to a key-event with an appropriate keysym instead of the keysym named by
687the character which names the ASCII code. In the above example, typing the
688@f[Return] key would generate a key-event with the @bf[Return] keysym and no
689bits. It would NOT translate to a key-event with the @bf[m] keysym and the
690control bit.
691@end[itemize]
692
693Since terminals have no meta key, you must use the @bf[Escape] and @bf[C-Z]
694modifier-prefix key-events to invoke commands bound to key-events with the meta
695bit or meta and control bits set. ASCII terminals cannot generate all
696key-events which have the control bit on, so you can use the @bf[C-^]
697modifier-prefix. The @bf[C-c] prefix sets the hyper bit on the next key-event
698typed.
699
700When running @hemlock from a terminal @f[^\] is the interrupt key-event.
701Typing this will place you in the Lisp debugger.
702
703When using a terminal, pop-up output windows cannot be retained after the
704completion of the command.
705
706
707@subsection[Terminal Redisplay]
708
709Redisplay is substantially different on a terminal. @Hemlock uses different
710algorithms, and different parameters control redisplay and screen management.
711
712Terminal redisplay uses the Unix termcap database to find out how to use a
713terminal. @hemlock is useful with terminals that lack capabilities for
714inserting and deleting lines and characters, and some terminal emulators
715implement these operations very inefficiently (such as xterm).
716If you realize poor performance when scrolling, create a termcap entry that
717excludes these capabilities.
718
719@defhvar[var "Scroll Redraw Ratio", val {nil}]
720This is a ratio of "inserted" lines to the size of a window. When this ratio
721is exceeded, insert/delete line terminal optimization is aborted, and every
722altered line is simply redrawn as efficiently as possible. For example,
723setting this to 1/4 will cause scrolling commands to redraw the entire window
724instead of moving the bottom two lines of the window to the top (typically 3/4
725of the window is being deleted upward and inserted downward, hence a redraw);
726however, commands like @hid[New Line] and @hid[Open Line] will still work
727efficiently, inserting a line and moving the rest of the window's text
728downward.
729@enddefhvar
730
731
732@section[The Echo Area]
733
734@index[echo area]
735@index[prompting]
736The echo area is the region which occupies the bottom few lines on the screen.
737It is used for two purposes: displaying brief messages to the user and
738prompting.
739
740When a command needs some information from the user, it requests it by
741displaying a @i[prompt] in the echo area. The following is a typical prompt:
742@begin[programexample]
743Select Buffer: [hemlock-init.lisp /usr/foo/]
744@end[programexample]
745The general format of a prompt is a one or two word description of the input
746requested, possibly followed by a @i[default] in brackets. The default is a
747standard response to the prompt that @hemlock uses if you type @bf[Return]
748without giving any other input.
749
750There are four general kinds of prompts: @comment<Key prompts?>
751@begin[description]
752@i[key-event]@\
753 The response is a single key-event and no confirming @binding[Return] is
754needed.
755
756@i[keyword]@\
757 The response is a selection from one of a limited number of choices.
758Completion is available using @binding[Space] and @binding[Escape], and you
759only need to supply enough of the keyword to distinguish it from any other
760choice. In some cases a keyword prompt accepts unknown input, indicating the
761prompter should create a new entry. If this is the case, then you must enter
762the keyword fully specified or completed using @binding[Escape]; this
763distinguishes entering an old keyword from making a new keyword which is a
764prefix of an old one since the system completes partial input automatically.
765
766@i[file]@\
767 The response is the name of a file, which may have to exist. Unlike other
768prompts, the default has some effect even after the user supplies some input:
769the system @i[merges] the default with the input filename. See page
770@pageref(merging) for a description of filename merging. @bf[Escape] and
771@bf[Space] complete the input for a file parse.
772
773@i[string]@\
774 The response is a string which must satisfy some property, such as being the
775name of an existing file.
776@end[description]
777
778@index[history, echo area]
779These key-events have special meanings when prompting:
780@begin[description]
781@binding[Return]@\
782 Confirm the current parse. If no input has been entered, then use the
783default. If for some reason the input is unacceptable, @hemlock does two
784things:
785@Begin[enumerate]
786beeps, if the variable @hid[Beep on Ambiguity] set, and
787
788moves the point to the end of the first word requiring disambiguation.
789@End[enumerate]
790This allows you to add to the input before confirming the it again.
791
792@binding[Home, C-_]@\
793 Print some sort of help message. If the parse is a keyword parse, then print
794all the possible completions of the current input in a pop-up window.
795
796@binding[Escape]@\
797 Attempt to complete the input to a keyword or file parse as far as possible,
798beeping if the result is ambiguous. When the result is ambiguous, @hemlock
799moves the point to the first ambiguous field, which may be the end of the
800completed input.
801
802@binding[Space]@\
803 In a keyword parse, attempt to complete the input up to the next space. This
804is useful for completing the names of @hemlock commands and similar things
805without beeping a lot, and you can continue entering fields while leaving
806previous fields ambiguous. For example, you can invoke @hid[Forward Word] as
807an extended command by typing @binding[M-X f Space w Return]. Each time the
808user enters space, @Hemlock attempts to complete the current field and all
809previous fields.
810
811@binding[C-i, Tab]@\
812 In a string or keyword parse, insert the default so that it may be edited.
813
814@binding[C-p]@\
815 Retrieve the text of the last string input from a history of echo area inputs.
816Repeating this moves to successively earlier inputs.
817
818@binding[C-n]@\
819 Go the other way in the echo area history.
820
821@binding[C-q]@\
822 Quote the next key-event so that it is not interpreted as a command.
823@end[description]
824
825@defhvar[var "Ignore File Types"]
826This variable is a list of file types (or extensions), represented as a string
827without the dot, e.g. @f["fasl"]. Files having any of the specified types will
828be considered nonexistent for completion purposes, making an unambiguous
829completion more likely. The initial value contains most common binary and
830output file types.
831@enddefhvar
832
833
834@section[Online Help]
835
836@label[help]
837@index[online help]
838@index[documentation, hemlock]
839@hemlock has a fairly good online documentation facility. You can get brief
840documentation for every command, variable, character attribute, and key
841by typing a key.
842
843@defcom[com "Help", bind (Home, C-_)]
844This command prompt for a key-event indicating one of a number of other
845documentation commands. The following are valid responses:
846@begin[description]
847@bf[a]@\
848 List commands and other things whose names contain a specified keyword.
849
850@bf[d]@\
851 Give the documentation and bindings for a specified command.
852
853@bf[g]@\
854 Give the documentation for any @hemlock thing.
855
856@bf[v]@\
857 Give the documentation for a @hemlock variable and its values.
858
859@bf[c]@\
860 Give the documentation for a command bound to some key.
861
862@bf[l]@\
863 List the last sixty key-events typed.
864
865@bf[m]@\
866 Give the documentation for a mode followed by a short description of its
867mode-specific bindings.
868
869@bf[p]@\
870 Give the documentation and bindings for commands that have at least one
871binding involving a mouse/pointer key-event.
872
873@bf[w]@\
874 List all the key bindings for a specified command.
875
876@bf[t]@\
877 Describe a @llisp object.
878
879@binding[q]@\
880 Quit without doing anything.
881
882@binding[Home, C-_, ?, h]@\
883 List all of the options and what they do.
884@end[description]
885@enddefcom
886
887@defcom[com "Apropos", bind (Home a, C-_ a)]
888This command prints brief documentation for all commands, variables, and
889character attributes whose names match the input. This performs a prefix match
890on each supplied word separately, intersecting the names in each word's result.
891For example, giving @hid[Apropos] "@f[f m]" causes it to tersely describe
892following commands and variables:
893@Begin[Itemize]
894@hid[Auto Fill Mode]
895
896@hid[Fundamental Mode]
897
898@hid[Mark Form]
899
900@hid[Default Modeline Fields]
901
902@hid[Fill Mode Hook]
903
904@hid[Fundamental Mode Hook]
905@End[Itemize]
906Notice @hid[Mark Form] demonstrates that the "@f[f]" words may follow the
907"@f[m]" order of the fields does not matter for @hid[Apropos].
908
909The bindings of commands and values of variables are printed with the
910documentation.
911@enddefcom
912
913@defcom[com "Describe Command", bind (Home d, C-_ d)]
914This command prompts for a command and prints its full documentation and all
915the keys bound to it.
916@enddefcom
917
918@defcom[com "Describe Key", bind (Home c, C-_ c, M-?)]
919This command prints full documentation for the command which is bound to
920the specified key in the current environment.
921@enddefcom
922
923@defcom[com "Describe Mode", bind (Home m, C-_ m)]
924This command prints the documentation for a mode followed by a short
925description of each of its mode-specific bindings.
926@enddefcom
927
928@defcom[com "Show Variable"]
929@defcom1[com "Describe and Show Variable"]
930@hid[Show Variable] prompts for the name of a variable and displays
931the global value of the variable, the value local to the current buffer (if
932any), and the value of the variable in all defined modes that have it as a
933local variable. @hid[Describe and Show Variable] displays the variable's
934documentation in addition to the values.
935@enddefcom
936
937@defcom[com "What Lossage", bind (Home l, C-_ l)]
938This command displays the last sixty key-events typed. This can be useful
939if, for example, you are curious what the command was that you typed by
940accident.
941@enddefcom
942
943@defcom[com "Describe Pointer"]
944This command displays the documentation and bindings for commands that have
945some binding involving a mouse/pointer key-event. It will not show the
946documentation for the @hid[Illegal] command regardless of whether it has a
947pointer binding.
948@enddefcom
949
950@defcom[com "Where Is", bind (Home w, C-_ w)]
951This command prompts for the name of a command and displays its key
952bindings in a pop-up window. If a key binding is not global, the
953environment in which it is available is displayed.
954@enddefcom
955
956@defcom[com "Generic Describe", bind (Home g, C-_ g)]
957This command prints full documentation for any thing that has
958documentation. It first prompts for the kind of thing to document, the
959following options being available:
960@begin[description]
961@i[attribute]@\Describe a character attribute, given its name.
962
963@i[command]@\Describe a command, given its name.
964
965@i[key]@\Describe a command, given a key to which it is bound.
966
967@i[variable]@\Describe a variable, given its name. This is the default.
968@end[description]
969@enddefcom
970
971
972@section[Entering and Exiting]
973
974@index[entering hemlock]@hemlock is entered by using the @clisp @f[ed]
975function. Simply typing @f[(ed)] will enter @hemlock, leaving you in the state
976that you were in when you left it. If @hemlock has never been entered before
977then the current buffer will be @hid[Main]. The @f[-edit] command-line switch
978may also be used to enter @hemlock: see page @pageref[edit-switch].
979
980@f[ed] may optionally be given a file name or a symbol argument. Typing
981@f[(ed @i[filename])] will cause the specified file to be read into @hemlock,
982as though by @hid[Find File]. Typing @w<@f[(ed @i[symbol])]> will pretty-print
983the definition of the symbol into a buffer whose name is obtained by adding
984"@f[Edit ]" to the beginning of the symbol's name.
985
986@defcom[com "Exit Hemlock", bind (C-c, C-x C-z)]
987@defcom1[com "Pause Hemlock"]
988@index[exiting hemlock]@hid[Exit Hemlock] exits @hemlock, returning @f[t].
989@hid[Exit Hemlock] does not by default save modified buffers, or do
990anything else that you might think it should do; it simply exits. At any time
991after exiting you may reenter by typing @f[(ed)] to @llisp without losing
992anything. Before you quit from @llisp using @f[(quit)], you should
993save any modified files that you want to be saved.
994
995@hid[Pause Hemlock] is similar, but it suspends the @llisp process and returns
996control to the shell. When the process is resumed, it will still be running
997@hemlock.
998@enddefcom
999
1000
1001@section[Helpful Information]
1002
1003@label[aborting]
1004@index[aborting]
1005@index[undoing]
1006@index[error recovery]
1007This section contains assorted helpful information which may be useful in
1008staying out of trouble or getting out of trouble.
1009
1010@begin[itemize]
1011It is possible to get some sort of help nearly everywhere by typing
1012@binding[Home] or @binding[C-_].
1013
1014Various commands take over the keyboard and insist that you type the key-events
1015that they want as input. If you get in such a situation and want to get out,
1016you can usually do so by typing @bf[C-g] some small number of times. If this
1017fails you can try typing @binding[C-x C-z] to exit @hemlock and then "@f[(ed)]"
1018to re-enter it.
1019
1020Before you quit, make sure you have saved all your changes. @binding[C-u C-x
1021C-b] will display a list of all modified buffers. If you exit using @bf[C-x
1022M-z], then @hemlock will save all modified buffers with associated files.
1023
1024If you lose changes to a file due to a crash or accidental failure to save,
1025look for backup ("@i[file]@f[.BAK]") or checkpoint ("@i[file]@f[.CKP]") files
1026in the same directory where the file was.
1027
1028If the screen changes unexpectedly, you may have accidentally typed an
1029incorrect command. Use @binding[Home l] to see what it was. If you are
1030not familiar with the command, use @binding[Home c] to see what it is so that
1031you know what damage has been done. Many interesting commands can be found
1032in this fashion. This is an example of the much-underrated learning
1033technique known as "Learning by serendipitous malcoordination". Who would
1034ever think of looking for a command that deletes all files in the current
1035directory?
1036
1037If you accidentally type a "killing" command such as @binding[C-w], you can
1038get the lost text back using @binding[C-y]. The @hid[Undo] command is also
1039useful for recovering from this sort of problem.
1040@end[itemize]
1041
1042@defhvar[var "Region Query Size", val {30}]
1043@index[large region]
1044Various commands ask for confirmation before modifying a region containing more
1045than this number of lines. If this is @nil, then these commands refrain from
1046asking, no matter how large the region is.
1047@enddefhvar
1048
1049@defcom[com "Undo"]
1050This command undoes the last major modification. Killing commands and some
1051other commands save information about their modifications, so accidental uses
1052may be retracted. This command displays the name of the operation to be undone
1053and asks for confirmation. If the affected text has been modified between the
1054invocations of @hid[Undo] and the command to be undone, then the result may be
1055somewhat incorrect but useful. Often @hid[Undo] itself can be undone by
1056invoking it again.
1057@enddefcom
1058
1059
1060@section[Recursive Edits]
1061@label[recursive-edits]
1062@index[recursive edits]
1063Some sophisticated commands, such as @hid[Query Replace], can place you in a
1064@i[recursive edit]. A recursive edit is simply a recursive invocation of
1065@hemlock done within a command. A recursive edit is useful because it allows
1066arbitrary editing to be done during the execution of a command without losing
1067any state that the command might have. When the user exits a recursive edit,
1068the command that entered it proceeds as though nothing happened. @Hemlock
1069notes recursive edits in the @hid[Echo Area] modeline, or status line. A
1070counter reflects the number of pending recursive edits.
1071
1072@defcom[com "Exit Recursive Edit", bind (C-M-z)]
1073This command exits the current recursive edit, returning @nil. If invoked when
1074not in a recursive edit, then this signals an user error.
1075@enddefcom
1076
1077@defcom[com "Abort Recursive Edit", bind (@bf<C-]>)]
1078This command causes the command which invoked the recursive edit to get an
1079error. If not in a recursive edit, this signals an user error.
1080@enddefcom
1081
1082
1083@section[User Errors]
1084@index[beeping]
1085@index[errors, user]
1086When in the course of editing, @hemlock is unable to do what it thinks you want
1087to do, then it brings this to your attention by a beep or a screen flash
1088(possibly accompanied by an explanatory echo area message such as @w<"@f[No
1089next line.]">.) Although the exact attention-getting mechanism may vary on the
1090output device and variable settings, this is always called @i[beeping].
1091
1092Whatever the circumstances, you had best try something else since @hemlock,
1093being far more stupid than you, is far more stubborn. @hemlock is an
1094extensible editor, so it is always possible to change the command that
1095complained to do what you wanted it to do.
1096
1097@section[Internal Errors]
1098
1099@index[errors, internal]A message of this form may appear in the echo
1100area, accompanied by a beep:
1101@begin[programexample]
1102Internal error:
1103Wrong type argument, NIL, should have been of type SIMPLE-VECTOR.
1104@end[programexample]
1105If the error message is a file related error such as the following, then
1106you have probably done something illegal which @hemlock did not catch,
1107but was detected by the file system:
1108@begin[programexample]
1109Internal error:
1110No access to "/lisp2/emacs/teco.mid"
1111@end[programexample]
1112Otherwise, you have found a bug. Try to avoid the behavior that resulted
1113in the error and report the problem to your system maintainer. Since @llisp
1114has fairly robust error recovery mechanisms, probably no damage has been
1115done.
1116
1117If a truly abominable error from which @hemlock cannot recover occurs,
1118then you will be thrown into the @llisp debugger. At this point it would be
1119a good idea to save any changes with @f[save-all-buffers] and then start
1120a new @llisp.
1121
1122@index[save-all-buffers, function]The @llisp function @f[save-all-buffers] may
1123be used to save modified buffers in a seriously broken @hemlock. To use this,
1124type "@f[(save-all-buffers)]" to the top-level ("@f[* ]") or debugger
1125("@f<1] >") prompt and confirm saving of each buffer that should be saved.
1126Since this function will prompt in the "@f[Lisp]" window, it isn't very useful
1127when called inside of @hemlock.
Note: See TracBrowser for help on using the repository browser.