source: branches/1.7-appstore/source/cocoa-ide/hemlock/doc/user/user.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: 82.3 KB
Line 
1@Make[Manual] @comment{-*- Dictionary: /afs/cs/project/clisp/scribe/hem/hem; Mode: spell; Package: Hemlock -*-}
2@Device[postscript]
3@Style(Spacing = 1.2 lines)
4@Style(StringMax = 5000)
5@Use(Database "/afs/cs/project/clisp/docs/database/")
6@Style(FontFamily=TimesRoman)
7@Style(Date="March 1952")
8@style(DOUBLESIDED)
9@Libraryfile[ArpaCredit]
10@libraryfile[hem]
11@Libraryfile[Spice]
12@Libraryfile[Uttir]
13
14@String(REPORTTITLE "Hemlock User's Manual")
15
16@comment<@begin[TitlePage]
17@begin[TitleBox]
18>
19@blankspace(1.3inches)
20@heading[Hemlock User's Manual]
21
22@center[@b<Bill Chiles>
23@b<Robert A. MacLachlan>
24
25
26@b<@value[date]>
27
28@b<CMU-CS-89-133-R1>
29]
30@comment<@end[TitleBox]>
31@blankspace(2lines)
32@begin[Center]
33School of Computer Science
34Carnegie Mellon University
35Pittsburgh, PA 15213
36@end[Center]
37@blankspace[2lines]
38
39@begin[Center]
40This is a revised version of Technical Report CMU-CS-87-158.
41@end[Center]
42
43@heading<Abstract>
44@begin(Text, indent 0)
45This document describes the @Hemlock text editor, version M3.2. @Hemlock is a
46customizable, extensible text editor whose initial command set closely
47resembles that of ITS/TOPS-20 @Emacs. @Hemlock is written in CMU Common Lisp
48and has been ported to other implementations.
49@end(Text)
50
51@begin[ResearchCredit]
52@ArpaCredit[Contract=Basic87-90]
53@end[ResearchCredit]
54@comment<@end[TitlePage]>
55
56
57@commandstring(mh = "@f1(MH)")
58@commandstring(dash = "@Y[M]")
59
60@comment[This tabclear is necessary since the definition macros don't
61 take care of the own tabbing needs]
62@tabclear
63
64
65@comment[@chap (Introduction)]
66@include(intro)
67
68
69@comment[@chap (Basic Commands)]
70@include(commands)
71
72
73
74@chap[Files, Buffers, and Windows]
75
76@section[Introduction]
77
78@index[files]
79@index[buffers]
80@index[windows]
81@hemlock provides three different abstractions which are used in combination to
82solve the text-editing problem, while other editors tend to mash these ideas
83together into two or even one.
84@begin[description]
85File@\A file provides permanent storage of text. @hemlock has commands
86to read files into buffers and write buffers out into files.
87
88Buffer@\A buffer provides temporary storage of text and a capability to
89edit it. A buffer may or may not have a file associated with it; if it
90does, the text in the buffer need bear no particular relation to the text
91in the file. In addition, text in a buffer may be displayed in any number
92of windows, or may not be displayed at all.
93
94Window@\A window displays some portion of a buffer on the screen. There
95may be any number of windows on the screen, each of which may display any
96position in any buffer. It is thus possible, and often useful, to have
97several windows displaying different places in the same buffer.
98@end[description]
99
100
101@section[Buffers]
102In addition to some text, a buffer has several other user-visible attributes:
103@begin[description]
104A name@\
105A buffer is identified by its name, which allows it to be selected, destroyed,
106or otherwise manipulated.
107
108A collection of modes@\
109The modes present in a buffer alter the set of commands available and
110otherwise alter the behavior of the editor. For details see page
111@pageref[modes].
112
113A modification flag @\
114This flag is set whenever the text in a buffer is modified. It is often
115useful to know whether a buffer has been changed, since if it has it should
116probably be saved in its associated file eventually.
117
118A write-protect flag @\
119If this flag is true, then any attempt to modify the buffer will result in an
120error.
121@end[description]
122
123@defcom[com "Select Buffer", bind (C-x b)]
124This command prompts for the name of a existing buffer and makes that buffer
125the @i[current buffer]. The newly selected buffer is displayed in the
126current window, and editing commands now edit the text in that buffer.
127Each buffer has its own point, thus the point will be in the place it was
128the last time the buffer was selected. When prompting for the buffer, the
129default is the buffer that was selected before the current one.
130@enddefcom
131
132@defcom[com "Select Previous Buffer", bind (C-M-l)]
133@defcom1[com "Circulate Buffers", bind (C-M-L)]
134With no prefix argument, @hid[Select Previous Buffer] selects the buffer that
135has been selected most recently, similar to @binding[C-x b Return]. If given a
136prefix argument, then it does the same thing as @hid[Circulate Buffers].
137
138@hid[Circulate Buffers] moves back into successively earlier buffers in the
139buffer history. If the previous command was not @hid[Circulate Buffers] or
140@hid[Select Previous Buffer], then it does the same thing as
141@hid[Select Previous Buffer], otherwise it moves to the next most recent
142buffer. The original buffer at the start of the excursion is made the previous
143buffer, so @hid[Select Previous Buffer] will always take you back to where you
144started.
145
146These commands are generally used together. Often @hid[Select Previous Buffer]
147will take you where you want to go. If you don't end up there, then using
148@hid[Circulate Buffers] will do the trick.
149@enddefcom
150
151@defcom[com "Create Buffer", bind (C-x M-b)]
152This command is very similar to @hid[Select Buffer], but the buffer need not
153already exist. If the buffer does not exist, a new empty buffer is created
154with the specified name.
155@enddefcom
156
157@defcom[com "Kill Buffer", bind (C-x k)]
158This command is used to make a buffer go away. There is no way to restore
159a buffer that has been accidentally deleted, so the user is given a chance
160to save the hapless buffer if it has been modified. This command is poorly
161named, since it has nothing to do with killing text.
162@enddefcom
163
164@defcom[com "List Buffers", bind (C-x C-b)]
165This command displays a list of all existing buffers in a pop-up window. A
166"@f[*]" is displayed before the name of each modified buffer. A buffer with no
167associated file is represented by the buffer name followed by the number of
168lines in the buffer. A buffer with an associated file are is represented by
169the name and type of the file, a space, and the device and directory. If the
170buffer name doesn't match the associated file, then the buffer name is also
171displayed. When given a prefix argument, this command lists only the modified
172buffers.
173@enddefcom
174
175@defcom[com "Buffer Not Modified", bind (M-~)]
176This command resets the current buffer's modification flag @dash @i[it does not
177save any changes]. This is primarily useful in cases where a user accidentally
178modifies a buffer and then undoes the change. Resetting the modified flag
179indicates that the buffer has no changes that need to be written out.
180@enddefcom
181
182@defcom[com "Check Buffer Modified", bind (C-x ~)]
183This command displays a message indicating whether the current buffer is modified.
184@enddefcom
185
186@defcom[com "Set Buffer Read-Only"]
187This command changes the flag that allows the current buffer to be modified.
188If a buffer is read-only, any attempt to modify it will result in an error. The
189buffer may be made writable again by repeating this command.
190@enddefcom
191
192@defcom[com "Set Buffer Writable"]
193This command ensures the current buffer is modifiable.
194@enddefcom
195
196@defcom[com "Insert Buffer"]
197This command prompts for the name of a buffer and inserts its contents at the
198point, pushing a buffer mark before inserting. The buffer inserted is
199unaffected.
200@enddefcom
201
202@defcom[com "Rename Buffer"]
203This command prompts for a new name for the current buffer, which defaults
204to a name derived from the associated filename.
205@enddefcom
206
207
208@section[Files]
209@index[files]
210These commands either read a file into the current buffer or write it out to
211some file. Various other bookkeeping operations are performed as well.
212
213@defcom[com "Find File", bind (C-x C-f)]
214This is the command normally used to get a file into @hemlock. It prompts
215for the name of a file, and if that file has already been read in, selects
216that buffer; otherwise, it reads file into a new buffer whose name is
217derived from the name of the file. If the file does not exist, then the
218buffer is left empty, and @w<"@f[(New File)]"> is displayed in the echo area;
219the file may then be created by saving the buffer.
220
221The buffer name created is in the form @w<"@i[name] @i[type] @i[directory]">.
222This means that the filename "@f[/sys/emacs/teco.mid]" has
223@w<"@f[Teco Mid /Sys/Emacs/]"> as its the corresponding buffer name. The
224reason for rearranging the fields in this fashion is that it facilitates
225recognition since the components most likely to differ are placed first. If
226the buffer cannot be created because it already exists, but has another file in
227it (an unlikely occurrence), then the user is prompted for the buffer to use,
228as by @hid[Create Buffer].
229
230@hid[Find File] takes special action if the file has been modified on disk
231since it was read into @hemlock. This usually happens when several people are
232simultaneously editing a file, an unhealthy circumstance. If the buffer is
233unmodified, @hid[Find File] just asks for confirmation before reading in the
234new version. If the buffer is modified, then @hid[Find File] beeps and prompts
235for a single key-event to indicate what action to take. It recognizes
236the following key-events:
237@begin[description]
238@binding[Return, Space, y]@\
239 Prompt for a file in which to save the current buffer and then read in the
240file found to be modified on disk.
241
242@binding[Delete, Backspace, n]@\
243 Forego reading the file.
244
245@binding[r]@\
246 Read the file found to be modified on disk into the buffer containing the
247earlier version with modifications. This loses all changes you had in the
248buffer.
249@end[description]
250@enddefcom
251
252@defcom[com "Save File", bind (C-x C-s)]
253This command writes the current buffer out to its associated file and
254resets the buffer modification flag. If there is no associated file, then
255the user is prompted for a file, which is made the associated file. If
256the buffer is not modified, then the user is asked whether to actually
257write it or not.
258
259If the file has been modified on disk since the last time it was read,
260@hid[Save File] prompts for confirmation before overwriting the file.
261@enddefcom
262
263@defcom[com "Save All Files", bind (C-x C-m)]
264@defcom1[com "Save All Files and Exit", bind (C-x M-z)]
265@defhvar1[var "Save All Files Confirm", val {t}]
266@hid[Save All Files] does a @hid[Save File] on all buffers which have an
267associated file. @hid[Save All Files and Exit] does the same thing and then
268exits @hemlock.
269
270When @hid[Save All Files Confirm] is true, these commands will ask for
271confirmation before saving a file.
272@enddefcom
273
274@defcom[com "Visit File", bind (C-x C-v)]
275This command prompts for a file and reads it into the current buffer,
276setting the associated filename. Since the old contents of the buffer are
277destroyed, the user is given a chance to save the buffer if it is modified.
278As for @hid[Find File], the file need not actually exist. This command warns
279if some other buffer also contains the file.
280@enddefcom
281
282@defcom[com "Write File", bind (C-x C-w)] This command prompts for a file
283and writes the current buffer out to it, changing the associated filename
284and resetting the modification flag. When the buffer's associated file is
285specified this command does the same thing as @hid[Save File]. @enddefcom
286
287@defcom[com "Backup File"]
288This command is similar to @hid[Write File], but it neither sets the
289associated filename nor clears the modification flag. This is useful for
290saving the current state somewhere else, perhaps on a reliable machine.
291
292Since @hid[Backup File] doesn't update the write date for the buffer,
293@hid[Find File] and @hid[Save File] will get all upset if you back up
294a buffer on any file that has been read into @hemlock.
295@enddefcom
296
297@defcom[com "Revert File"]
298@defhvar1[var "Revert File Confirm", val {t}]
299This command replaces the text in the current buffer with the contents of the
300associated file or the checkpoint file for that file, whichever is more recent.
301The point is put in approximately the same place that it was before the file
302was read. If the original file is reverted to, then clear the modified flag,
303otherwise leave it set. If a prefix argument is specified, then always revert
304to the original file, ignoring any checkpoint file.
305
306If the buffer is modified and @hid[Revert File Confirm] is true, then the user
307is asked for confirmation.
308@enddefcom
309
310@defcom[com "Insert File", bind (C-x C-r)]
311This command prompts for a file and inserts it at the point, pushing a buffer
312mark before inserting.
313@enddefcom
314
315@defcom[com "Write Region"]
316This command prompts for a file and writes the text in the region out to it.
317@enddefcom
318
319@defhvar[var "Add Newline at EOF on Writing File", val {:ask-user}]
320This variable controls whether some file writing commands add a newline at the
321end of the file if the last line is non-empty.
322@begin[description]
323@f[:ask-user]@\Ask the user whether to add a newline.
324
325@f[t]@\Automatically add a newline and inform the user.
326
327@nil@\Never add a newline and do not ask.
328@end[description]
329Some programs will lose the text on the last line or get an
330error when the last line does not have a newline at the end.
331@enddefhvar
332
333@defhvar[var "Keep Backup Files", val {nil}]
334Whenever a file is written by @hid[Save File] and similar commands, the old
335file is renamed by appending "@f[.BAK]" to the name, ensuring that some version
336of the file will survive a system crash during the write. If set to true, this
337backup file will not deleted even when the write successfully completes.
338@enddefhvar
339
340
341@subsection[Auto Save Mode]
342
343@hid[Save] mode protects against loss of work in system crashes by periodically
344saving modified buffers in checkpoint files.
345
346@defcom[com "Auto Save Mode"]
347This command turns on @hid[Save] mode if it is not on, and turns off when it is
348on. @hid[Save] mode is on by default.
349@enddefcom
350
351@defhvar[var "Auto Save Checkpoint Frequency", val {120}]
352@defhvar1[var "Auto Save Key Count Threshold", val {256}]
353These variables determine how often modified buffers in @hid[Save] mode will be
354checkpointed. Checkpointing is done after
355@hid[Auto Save Checkpoint Frequency] seconds, or after
356@hid[Auto Save Key Count Threshold] keystrokes that modify the buffer
357(whichever comes first). Either kind of checkpointing may be disabled by
358setting the corresponding variable to @nil.
359@enddefhvar
360
361@defhvar[var "Auto Save Cleanup Checkpoints", val {t}]
362If this variable is true, then any checkpoint file for a buffer will be deleted
363when the buffer is successfully saved in its associated file.
364@enddefhvar
365
366@defhvar[var "Auto Save Filename Pattern", val {"~A~A.CKP"}]
367@defhvar1[var "Auto Save Pathname Hook", val {make-unique-save-pathname}]
368These variables determine the naming of checkpoint files.
369@hid[Auto Save Filename Pattern] is a format string used to name the checkpoint
370files for buffers with associated files. Format is called with two arguments:
371the directory and file namestrings of the associated file.
372
373@hid[Auto Save Pathname Hook] is a function called by @hid[Save] mode to get a
374checkpoint pathname when there is no pathname associated with a buffer. It
375should take a buffer as its argument and return either a pathname or @nil. If
376a pathname is returned, then it is used as the name of the checkpoint file. If
377the function returns @nil, or if the hook variable is @nil, then @hid[Save]
378mode is turned off in the buffer. The default value for this variable returns
379a pathname in the default directory of the form "@w<@f[save-]@i[number]>",
380where @i[number] is a number used to make the file unique.
381@enddefhvar
382
383
384@subsection[Filename Defaulting and Merging]
385@index[merging, filename]
386@index[defaulting, filename]
387@index[filename defaulting]
388@label[merging]
389@index[pathnames]
390When @hemlock prompts for the name of a file, it always offers a default.
391Except for a few commands that have their own defaults, filename defaults are
392computed in a standard way. If it exists, the associated file for the current
393buffer is used as the default, otherwise a more complex mechanism creates a
394default.
395
396@defhvar[var "Pathname Defaults", val {(pathname "gazonk.del")}]
397@defhvar1[var "Last Resort Pathname Defaults Function"]
398@defhvar1[var "Last Resort Pathname Defaults", val {(pathname "gazonk")}]
399These variables control the computation of default filename defaults when the
400current buffer has no associated file.
401
402@hid[Pathname Defaults] holds a "sticky" filename default. Commands that
403prompt for files set this to the file specified, and the value is used as a
404basis for filename defaults. It is undesirable to offer the unmodified value
405as a default, since it is usually the name of an existing file that we don't
406want to overwrite. If the current buffer's name is all alphanumeric, then the
407default is computed by substituting the buffer name for the the name portion of
408@hid[Pathname Defaults]. Otherwise, the default is computed by calling
409@hid[Last Resort Pathname Defaults Function] with the buffer as an argument.
410
411The default value of @hid[Last Resort Pathname Defaults Function] merges
412@hid[Last Resort Pathname Defaults] with @hid[Pathname Defaults].
413Unlike @hid[Pathname Defaults], @hid[Last Resort Pathname Defaults] is not
414modified by file commands, so setting it to a silly name ensures that real
415files aren't inappropriately offered as defaults.
416@enddefhvar
417
418When a default is present in the prompt for a file, @hemlock @i[merges] the
419given input with the default filename. The semantics of merging, described in
420the Common Lisp manual, is somewhat involved, but @hemlock has a few rules it
421uses:
422@begin[enumerate]
423If @hemlock can find the user's input as a file on the @f["default:"] search
424list, then it forgoes merging with the displayed default. Basically, the
425system favors the files in your current working directory over those found by
426merging with the defaults offered in the prompt.
427
428Merging comes in two flavors, just merge with the displayed default's directory
429or just merge with the displayed default's @f[file-namestring]. If the user
430only responds with a directory specification, without any name or type
431information, then @hemlock merges the default's @f[file-namestring]. If the
432user responds with any name or type information, then @hemlock only merges with
433the default's directory. Specifying relative directories in this second
434situation coordinates with the displayed defaults, not the current working
435directory.
436@end[enumerate]
437
438
439@subsection[Type Hooks and File Options]
440@index[mode comment]
441@index[type hooks]
442When a file is read either by @hid[Find File] or @hid[Visit File], @hemlock
443attempts to guess the correct mode in which to put the buffer, based on the
444file's @i[type] (the part of the filename after the last dot). Any default
445action may be overridden by specifying the mode in the file's @i[file
446options].@index[modes]@index[package]
447
448@label[file-options]@index[file options]
449The user specifies file options with a special syntax on the first line of a
450file. If the first line contains the string "@f[-*-]", then @hemlock
451interprets the text between the first such occurrence and the second, which
452must be contained in one line , as a list of @w{"@f<@i[option]: @i[value]>"}
453pairs separated by semicolons. The following is a typical example:
454@begin[programexample]
455;;; -*- Mode: Lisp, Editor; Package: Hemlock -*-
456@end[programexample]
457
458These options are currently defined:
459@begin[description]
460Dictionary@\The argument is the filename of a spelling dictionary associated
461with this file. The handler for this option merges the argument with the
462name of this file. See @comref[Set Buffer Spelling Dictionary].
463
464Log@\The argument is the name of the change log file associated with this file
465(see page @pageref[log-files]). The handler for this option merges the
466argument with the name of this file.
467
468Mode@\The argument is a comma-separated list of the names of modes to turn on
469in the buffer that the file is read into.
470
471Package@\The argument is the name of the package to be used for reading code in
472the file. This is only meaningful for Lisp code (see page
473@pageref[lisp-package].)
474
475Editor@\The handler for this option ignores its argument and turns on
476@hid[Editor] mode (see @comref[Editor Mode]).
477
478@end[description]
479If the option list contains no "@f[:]" then the entire string is used as
480the name of the major mode for the buffer.
481
482@defcom[com "Process File Options"]
483This command processes the file options in the current buffer as described
484above. This is useful when the options have been changed or when a file is
485created.
486@enddefcom
487
488
489@section[Windows]
490@index[windows]
491
492@hemlock windows display a portion of a buffer's text. See the section on
493@i[window groups], @ref[groups], for a discussion of managing windows on bitmap
494device.
495
496@defcom[com "New Window", bind (C-x C-n)]
497This command prompts users for a new window which they can place anywhere on
498the screen. This window is in its own group. This only works with bitmap
499devices.
500@enddefcom
501
502@defcom[com "Split Window", bind (C-x 2)]
503This command splits the current window roughly in half to make two windows. If
504the current window is too small to be split, the command signals a user error.
505@enddefcom
506
507@defcom[com "Next Window", bind (C-x n)]
508@defcom1[com "Previous Window", bind (C-x p)]
509These commands make the next or previous window the new current window, often
510changing the current buffer in the process. When a window is created, it is
511arbitrarily made the next window of the current window. The location of the
512next window is, in general, unrelated to that of the current window.
513@enddefcom
514
515@defcom[com "Delete Window", bind (C-x C-d, C-x d)]
516@defcom1[com "Delete Next Window", bind (C-x 1)]
517@hid[Delete Window] makes the current window go away, making the next window
518current. @hid[Delete Next Window] deletes the next window, leaving the current
519window unaffected.
520
521On bitmap devices, if there is only one window in the group, either command
522deletes the group, making some window in another group the current window. If
523there are no other groups, they signal a user error.
524@enddefcom
525
526@defcom[com "Go to One Window"]
527This command deletes all window groups leaving one with the @hid[Default
528Initial Window X], @hid[Default Initial Window Y], @hid[Default Initial Window
529Width], and @hid[Default Initial Window Height]. This remaining window
530retains the contents of the current window.
531@enddefcom
532
533@defcom[com "Line to Top of Window", bind (M-!)]
534@defcom1[com "Line to Center of Window", bind (M-#)]
535@index[scrolling]@hid[Line to Top of Window] scrolls the current window up
536until the current line is at the top of the screen.
537
538@hid[Line to Center of Window] attempts to scroll the current window so that
539the current line is vertically centered.
540@enddefcom
541
542@defcom[com "Scroll Next Window Down", bind (C-M-v)]
543@defcom1[com "Scroll Next Window Up", bind (C-M-V)]
544These commands are the same as @hid[Scroll Window Up] and
545@hid[Scroll Window Down] except that they operate on the next window.
546@enddefcom
547
548@defcom[com "Refresh Screen", bind {C-l}]
549This command refreshes all windows, which is useful if the screen got trashed,
550centering the current window about the current line. When the user supplies a
551positive argument, it scrolls that line to the top of the window. When the
552argument is negative, the line that far from the bottom of the window is moved
553to the bottom of the window. In either case when an argument is supplied, this
554command only refreshes the current window.
555@enddefcom
556
557
558@chap[Editing Documents]
559@index[documents, editing]
560Although @hemlock is not dedicated to editing documents as word processing
561systems are, it provides a number of commands for this purpose. If @hemlock is
562used in conjunction with a text-formatting program, then its lack of complex
563formatting commands is no liability.
564
565
566@defcom[com "Text Mode"]
567This commands puts the current buffer into "Text" mode.
568@enddefcom
569
570
571@section[Sentence Commands]
572@index[sentence commands]
573A sentence is defined as a sequence of characters ending with a period,
574question mark or exclamation point, followed by either two spaces or a newline.
575A sentence may also be terminated by the end of a paragraph. Any number of
576closing delimiters, such as brackets or quotes, may be between the punctuation
577and the whitespace. This somewhat complex definition of a sentence is used so
578that periods in abbreviations are not misinterpreted as sentence ends.
579
580@defcom[com "Forward Sentence", bind {M-a}]
581@defcom1[com "Backward Sentence", bind {M-e}]
582@index[motion, sentence]@hid[Forward Sentence] moves the point forward
583past the next sentence end. @hid[Backward Sentence] moves to the beginning
584of the current sentence. A prefix argument may be used as a repeat count.
585@enddefcom
586
587@defcom[com "Forward Kill Sentence", bind {M-k}]
588@defcom1[com "Backward Kill Sentence", bind (C-x Delete, C-x Backspace)]
589@index[killing, sentence]@hid[Forward Kill Sentence] kills text from the
590point through to the end of the current sentence. @hid[Backward Kill Sentence]
591kills from the point to the beginning of the current sentence. A
592prefix argument may be used as a repeat count.
593@enddefcom
594
595@defcom[com "Mark Sentence"]
596This command puts the point at the beginning and the mark at the end of the
597next or current sentence.
598@enddefcom
599
600
601@section[Paragraph Commands]
602
603@index[paragraph commands]A paragraph may be delimited by a blank line or a
604line beginning with "@f[']" or "@f[.]", in which case the delimiting line is
605not part of the paragraph. Other characters may be paragraph delimiters in
606some modes. A line with at least one leading whitespace character may also
607introduce a paragraph and is considered to be part of the paragraph. Any
608fill-prefix which is present on a line is disregarded for the purpose of
609locating a paragraph boundary.
610
611@defcom[com "Forward Paragraph", bind (@bf<M-]>)]
612@defcom1[com "Backward Paragraph", bind (M-[)]
613@index[motion, paragraph]@index[paragraph, motion]@hid[Forward Paragraph]
614moves to the end of the current or next paragraph. @hid[Backward Paragraph]
615moves to the beginning of the current or previous paragraph. A prefix
616argument may be used as a repeat count.
617@enddefcom
618
619@defcom[com "Mark Paragraph", bind {M-h}]
620This command puts the point at the beginning and the mark at the end of the
621current paragraph.
622@enddefcom
623
624@defhvar[var "Paragraph Delimiter Function", val {default-para-delim-function}]
625This variable holds a function that takes a mark as its argument and returns
626true when the line it points to should break the paragraph.
627@enddefhvar
628
629@section[Filling]
630
631@index[filling]@index[formatting]Filling is a coarse text-formatting
632process which attempts to make all the lines roughly the same length, but
633doesn't vary the amount of space between words. Editing text may leave
634lines with all sorts of strange lengths; filling this text will return it
635to a moderately aesthetic form.
636
637@defcom[com "Set Fill Column", bind (C-x f)]
638This command sets the fill column to the column that the point is currently at,
639or the one specified by the absolute value of prefix argument, if it is
640supplied. The fill column is the column past which no text is permitted to
641extend.
642@enddefcom
643
644@defcom[com "Set Fill Prefix", bind (C-x .)]
645This command sets the fill prefix to the text from the beginning of the
646current line to the point. The fill-prefix is a string which filling commands
647leave at the beginning of every line filled. This feature is useful for
648filling indented text or comments.
649@enddefcom
650
651@defhvar[var "Fill Column", val {75}]
652@defhvar1[var "Fill Prefix", val {nil}]
653These variables hold the value of the fill prefix and fill column, thus
654setting these variables will change the way filling is done. If
655@hid[Fill Prefix] is @nil, then there is no fill prefix.
656@enddefcom
657
658@defcom[com "Fill Paragraph", bind {M-q}]
659@index[paragraph, filling]This command fills the text in the current or next
660paragraph. The point is not moved.
661@enddefcom
662
663@defcom[com "Fill Region", bind {M-g}]
664@index[region, filling]This command fills the text in the region. Since
665filling can mangle a large quantity of text, this command asks for confirmation
666before filling a large region (see @hid[Region Query Size].)
667@enddefcom
668
669
670@defcom[com "Auto Fill Mode"]
671@index[modes, auto fill]This command turns on or off the @hid[Fill]
672minor mode in the current buffer. When in @hid[Fill] mode, @bf[Space],
673@bf[Return] and @bf[Linefeed] are rebound to commands that check whether
674the point is past the fill column and fill the current line if it is.
675This enables typing text without having to break the lines manually.
676
677If a prefix argument is supplied, then instead of toggling, the sign
678determines whether @hid[Fill] mode is turned off; a positive argument
679argument turns in on, and a negative one turns it off.
680@enddefcom
681
682@defcom[com "Auto Fill Linefeed", stuff (bound to @bf[Linefeed] in @hid[Fill] mode)]
683@defcom1[com "Auto Fill Return", stuff (bound to @bf[Return] in @hid[Fill] mode)]
684@hid[Auto Fill Linefeed] fills the current line if it needs it and then goes to
685a new line and inserts the fill prefix. @hid[Auto Fill Return] is similar, but
686does not insert the fill prefix on the new line.
687@enddefcom
688
689@defcom[com "Auto Fill Space", stuff (bound to @bf[Space] in @hid[Fill] mode)]
690If no prefix argument is supplied, this command inserts a space and
691fills the current line if it extends past the fill column. If the argument is
692zero, then it fills the line if needed, but does not insert a space. If the
693argument is positive, then that many spaces are inserted without filling.
694@enddefcom
695
696@defhvar[var "Auto Fill Space Indent", val {nil}]
697This variable determines how lines are broken by the auto fill commands. If it
698is true, new lines are created using the @hid[Indent New Comment Line] command,
699otherwise the @hid[New Line] command is used. Language modes should define
700this variable to be true so that auto fill mode can be used on code.
701@enddefhvar
702
703
704@section[Scribe Mode]
705
706@hid[Scribe] mode provides a number of facilities useful for editing Scribe
707documents. It is also sufficiently parameterizable to be adapted to other
708similar syntaxes.
709
710@defcom[com "Scribe Mode"]
711@index[modes, scribe]This command puts the current buffer in @hid[Scribe] mode.
712Except for special Scribe commands, the only difference between @hid[Scribe]
713mode and @hid[Text] mode is that the rules for determining paragraph breaks are
714different. In @hid[Scribe] mode, paragraphs delimited by Scribe commands are
715normally placed on their own line, in addition to the normal paragraph breaks.
716The main reason for doing this is that it prevents @hid[Fill Paragraph] from
717mashing these commands into the body of a paragraph.
718@enddefcom
719
720@defcom[com "Insert Scribe Directive", stuff (@bf[C-h] in @hid[Scribe] mode)]
721This command prompts for a key-event to determine which Scribe directive to
722insert. Directives are inserted differently depending on their kind:
723@begin[description]
724@i[environment]@\
725The current or next paragraph is enclosed in a begin-end pair:
726@f<@@begin[@i{directive}]> @i[paragraph] @f<@@end[@i{directive}]>. If the
727current region is active, then this command encloses the region instead of the
728paragraph it would otherwise chose.
729
730@i[command]@\
731The previous word is enclosed by @f<@@@i[directive][@i[word]]>. If the
732previous word is already enclosed by a use of the same command, then the
733beginning of the command is extended backward by one word.
734@end[description]
735
736Typing @bf[Home] or @bf[C-_] to this command's prompt will display a list of
737all the defined key-events on which it dispatches.
738@enddefcom
739
740@defcom[com "Add Scribe Directive"]
741This command adds to the database of directives recognized by the
742@hid[Insert Scribe Directive] command. It prompts for the directive's name,
743the kind of directive (environment or command) and the key-event on which to
744dispatch.
745@enddefcom
746
747@defcom[com "Add Scribe Paragraph Delimiter"]
748@defcom1[com "List Scribe Paragraph Delimiters"]
749@hid[Add Scribe Paragraph Delimiter] prompts for a string to add to the list of
750formatting commands that delimit paragraphs in @hid[Scribe] mode. If the user
751supplies a prefix argument, then this command removes the string as a
752delimiter.
753
754@hid[List Scribe Paragraph Delimiters] displays in a pop-up window the Scribe
755commands that delimit paragraphs.
756@enddefcom
757
758@defhvar[var "Escape Character", val {#\@@}]
759@defhvar1[var "Close Paren Character", val {#\]}]
760@defhvar1[var "Open Paren Character", val {#\[}]
761These variables determine the characters used when a Scribe directive is
762inserted.
763@enddefhvar
764
765@defcom[com "Scribe Insert Bracket"]
766@defhvar1[var "Scribe Bracket Table"]
767@hid[Scribe Insert Bracket] inserts a bracket (@bf[>], @bf[}], @bf[)], or
768@bf<]>), that caused its invocation, and then shows the matching bracket.
769
770@hid[Scribe Bracket Table] holds a @f[simple-vector] indexed by character
771codes. If a character is a bracket, then the entry for its @f[char-code]
772should be the opposite bracket. If a character is not a bracket, then the
773entry should be @nil.
774@enddefcom
775
776
777@section[Spelling Correction]
778@index[spelling correction]
779@hemlock has a spelling correction facility based on the dictionary for the ITS
780spell program. This dictionary is fairly small, having only 45,000 word or so,
781which means it fits on your disk, but it also means that many reasonably common
782words are not in the dictionary. A correct spelling for a misspelled word will
783be found if the word is in the dictionary and is only erroneous in that it has
784a wrong character, a missing character, an extra character or a transposition
785of two characters.
786
787
788@defcom[com "Check Word Spelling", bind (M-$)]
789This command looks up the previous or current word in the dictionary and
790attempts to correct the spelling if it is misspelled. There are four possible
791results of invoking this command:
792@begin[enumerate]
793This command displays the message "@f[Found it.]" in the echo area. This means
794it found the word in the dictionary exactly as given.
795
796This command displays the message "@f[Found it because of @i[word].]", where
797@i[word] is some other word with the same root but a different ending. The
798word is no less correct than if the first message is given, but an additional
799piece of useless information is supplied to make you feel like you are using a
800computer.
801
802The command prompts with "@f[Correction choice:]" in the echo area and lists
803possible correct spellings associated with numbers in a pop-up display. Typing
804a number selects the corresponding correction, and the command replaces the
805erroneous word, preserving case as though by @hid[Query Replace]. Typing
806anything else rejects all the choices.
807
808This commands displays the message "@f[Word not found.]". The word is not in
809the dictionary and possibly spelled correctly anyway. Furthermore, no
810similarly spelled words were found to offer as possible corrections. If this
811happens, it is worth trying some alternate spellings since one of them might
812be close enough to some known words that this command could display.
813@end[enumerate]
814@enddefcom
815
816@defcom[com "Correct Buffer Spelling"]
817This command scans the entire buffer looking for misspelled words and offers to
818correct them. It creates a window into the @hid[Spell Corrections] buffer, and
819in this buffer it maintains a log of any actions taken by the user. When this
820finds an unknown word, it prompts for a key-event. The user has the following
821options:
822@begin[description]
823@bf[a]@\
824 Ignore this word. If the command finds the word again, it will prompt again.
825
826@bf[i]@\
827 Insert this word in the dictionary.
828
829@bf[c]@\
830 Choose one of the corrections displayed in the @hid[Spell Corrections] window
831by specifying the correction number. If the same misspelling is encountered
832again, then the command will make the same correction automatically, leaving a
833note in the log window.
834
835@bf[r]@\
836 Prompt for a word to use instead of the misspelled one, remembering the
837correction as with @bf[c].
838
839@binding[C-r]@\
840 Go into a recursive edit at the current position, and resume checking when the
841recursive edit is exited.
842@end[description]
843After this command completes, it deletes the log window leaving the buffer
844around for future reference.
845@enddefcom
846
847@defhvar[var "Spell Ignore Uppercase", val {nil}]
848@index[case sensitivity]
849If this variable is true, then @hid[Auto Check Word Spelling] and @hid[Correct
850Buffer Spelling] will ignore unknown words that are all uppercase. This is
851useful for acronyms and cryptic formatter directives.
852@enddefhvar
853
854@defcom[com "Add Word to Spelling Dictionary", bind (C-x $)]
855This command adds the previous or current word to the spelling dictionary.
856@enddefcom
857
858@defcom[com "Remove Word from Spelling Dictionary"]
859This command prompts for a word to remove from the spelling dictionary. Due to
860the dictionary representation, removal of a word in the initial spelling
861dictionary will remove all words with the same root. The user is asked for
862confirmation before removing a root word with valid suffix flags.
863@enddefcom
864
865@defcom[com "List Incremental Spelling Insertions"]
866This command displays the incremental spelling insertions for the current
867buffer's associated spelling dictionary file.
868@enddefcom
869
870@defcom[com "Read Spelling Dictionary"]
871This command adds some words from a file to the spelling dictionary. The
872format of the file is a list of words, one on each line.
873@enddefcom
874
875@defcom[com "Save Incremental Spelling Insertions"]
876This command appends incremental dictionary insertions to a file. Any words
877added to the dictionary since the last time this was done will be appended to
878the file. Except for @hid[Augment Spelling Dictionary], all the commands that
879add words to the dictionary put their insertions in this list. The file is
880prompted for unless @hid[Set Buffer Spelling Dictionary] has been executed in
881the buffer.
882@enddefcom
883
884@defcom[com "Set Buffer Spelling Dictionary"]
885This command Prompts for the dictionary file to associate with the current
886buffer. If the specified dictionary file has not been read for any other
887buffer, then it is read. Incremental spelling insertions from this buffer
888can be appended to this file with @hid[Save Incremental Spelling
889Insertions]. If a buffer has an associated spelling dictionary, then
890saving the buffer's associated file also saves any incremental dictionary
891insertions. The @w<"@f[Dictionary: ]@i[file]"> file option may also be
892used to specify the dictionary for a buffer (see section
893@ref[file-options]).
894@enddefcom
895
896@defhvar[var "Default User Spelling Dictionary", val {nil}]
897This variable holds the pathname of a dictionary to read the first time
898@hid[Spell] mode is entered in a given editing session. When
899@hid[Set Buffer Spelling Dictionary] or the "@f[dictionary]" file option is
900used to specify a dictionary, this default one is read also. It defaults to
901nil.
902@enddefhvar
903
904
905@subsection[Auto Spell Mode]
906@hid[Auto Spell Mode] checks the spelling of each word as it is typed.
907When an unknown word is typed the user is notified and allowed to take a
908number of actions to correct the word.
909
910@defcom[com "Auto Spell Mode"]
911This command turns @hid[Spell] mode on or off in the current buffer.
912@enddefcom
913
914@defcom[com "Auto Check Word Spelling",
915 stuff (bound to word delimiters in @hid[Spell] mode)]
916@defhvar1[var "Check Word Spelling Beep", val {t}]
917@defhvar1[var "Correct Unique Spelling Immediately", val {t}]
918This command checks the spelling of the word before the point, doing nothing if
919the word is in the dictionary. If the word is misspelled but has a known
920correction previously supplied by the user, then this command corrects the
921spelling. If there is no correction, then this displays a message in the echo
922area indicating the word is unknown. An unknown word detected by this command
923may be corrected using the @hid[Correct Last Misspelled Word] command. This
924command executes in addition to others bound to the same key; for example, if
925@hid[Fill] mode is on, any of its commands bound to the same keys as this
926command also run.
927
928If @hid[Check Word Spelling Beep] is true, then this command will beep when an
929unknown word is found. If @hid[Correct Unique Spelling Immediately] is true,
930then this command will immediately attempt to correct any unknown word,
931automatically making the correction if there is only one possible.
932@enddefhvar
933
934@defcom[com "Undo Last Spelling Correction", bind (C-x a)]
935@defhvar1[var "Spelling Un-Correct Prompt for Insert", val {nil}]
936@hid[Undo Last Spelling Correction] undoes the last incremental spelling
937correction. The "correction" is replaced with the old word, and the old word
938is inserted in the dictionary. Any automatic replacement for the old word is
939eliminated. When @hid[Spelling Un-Correct Prompt for Insert] is true, the user
940is asked to confirm the insertion into the dictionary.
941@enddefcom
942
943@defcom[com "Correct Last Misspelled Word", bind (M-:)]
944This command places the cursor after the last misspelled word detected by the
945@hid[Auto Check Word Spelling] command and then prompts for a key-event on
946which it dispatches:
947@begin[description]
948@bf[c]@\
949 Display possible corrections in a pop-up window, and prompt for the one to
950make according to the corresponding displayed digit or letter.
951
952@i[any digit]@\
953 Similar to @bf[c] @i[digit], but immediately makes the correction, dispensing
954with display of the possible corrections. This is shorter, but only works when
955there are less than ten corrections.
956
957@bf[i]@\
958 Insert the word in the dictionary.
959
960@bf[r]@\
961 Replace the word with another.
962
963@binding[Backspace, Delete, n]@\
964 Skip this word and try again on the next most recently misspelled word.
965
966@binding[C-r]@\
967 Enter a recursive edit at the word, exiting the command when the recursive
968edit is exited.
969
970@binding[Escape]@\
971 Exit and forget about this word.
972@end[description]
973As in @hid[Correct Buffer Spelling], the @bf[c] and @bf[r] commands add the
974correction to the known corrections.
975@enddefcom
976
977
978
979@chap[Managing Large Systems]
980
981@hemlock provides three tools which help to manage large systems:
982@begin[enumerate]
983File groups, which provide several commands that operate on all the files
984in a possibly large collection, instead of merely on a single buffer.
985
986A source comparison facility with semi-automatic merging, which can be used
987to compare and merge divergent versions of a source file.
988
989A change log facility, which maintains a single file containing a record of the
990edits done on a system.
991@end[enumerate]
992
993
994@section[File Groups]
995
996@index[file groups]@index[searching, group]@index[replacing, group]
997A file group is a set of files, upon which various editing operations can be
998performed. The files in a group are specified by a file in the following
999format:
1000@begin[itemize]
1001Any line which begins with one "@f[@@]" is ignored.
1002
1003Any line which does not begin with an "@f[@@]" is the name of a file in the
1004group.
1005
1006A line which begins with "@f[@@@@]" specifies another file having this
1007syntax, which is recursively examined to find more files in the group.
1008@end[itemize]
1009This syntax is used for historical reasons. Although any number of file groups
1010may be read into @hemlock, there is only one @i[active group], which is the
1011file group implicitly used by all of the file group commands.
1012Page @pageref[compile-group-command] describes the @hid[Compile Group] command.
1013
1014@defcom[com "Select Group"]
1015This command prompts for the name of a file group to make the active group.
1016If the name entered is not the name of a group whose definition has been
1017read, then the user is prompted for the name of a file to read the group
1018definition from. The name of the default pathname is the name of the
1019group, and the type is "@f[upd]".
1020@enddefcom
1021
1022@defcom[com "Group Query Replace"]
1023This command prompts for target and replacement strings and then executes an
1024interactive string replace on each file in the active group. This reads in
1025each file as if @hid[Find File] were used and processes it as if @hid[Query
1026Replace] were executing.
1027@enddefcom
1028
1029@defcom[com "Group Replace"]
1030This is like @hid[Group Query Replace] except that it executes a
1031non-interactive replacement, similar to @hid[Replace String].
1032@enddefcom
1033
1034@defcom[com "Group Search"]
1035This command prompts for a string and then searches for it in each file in the
1036active group. This reads in each file as if @hid[Find File] were used. When
1037it finds an occurrence, it prompts the user for a key-event indicating what
1038action to take. The following commands are defined:
1039@begin[description]
1040@binding[Escape, Space, y]@\
1041 Exit @hid[Group Search].
1042
1043@binding[Delete, Backspace, n]@\
1044 Continue searching for the next occurrence of the string.
1045
1046@binding[!]@\
1047 Continue the search at the beginning of the next file, skipping the remainder
1048of the current file.
1049
1050@binding[C-r]@\
1051 Go into a recursive edit at the current location, and continue the search when
1052it is exited.
1053@end[description]
1054@enddefcom
1055
1056@defhvar[var "Group Find File", val {nil}]
1057The group searching and replacing commands read each file into its own buffer
1058using @hid[Find File]. Since this may result in large amounts of memory being
1059consumed by unwanted buffers, this variable controls whether to delete the
1060buffer after processing it. When this variable is false, the default, the
1061commands delete the buffer if it did not previously exist; however, regardless
1062of this variable, if the user leaves the buffer modified, the commands will not
1063delete it.
1064@enddefhvar
1065
1066@defhvar[var "Group Save File Confirm", val {t}]
1067If this variable is true, the group searching and replacing commands ask for
1068confirmation before saving any modified file. The commands attempt to save
1069each file processed before going on to the next one in the group.
1070@enddefhvar
1071
1072
1073@section[Source Comparison]
1074@index[buffer, merging]
1075@index[buffer, comparison]
1076@index[source comparison]
1077
1078These commands can be used to find exactly how the text in two buffers differs,
1079and to generate a new version that combines features of both versions.
1080
1081@defhvar[var "Source Compare Default Destination", val {"Differences"}]
1082This is a sticky default buffer name to offer when comparison commands prompt
1083for a buffer in which to insert the results.
1084@enddefhvar
1085
1086@defcom[com "Compare Buffers"]
1087This command prompts for three buffers and then does a buffer comparison.
1088The first two buffers must exist, as they are the buffers to be compared.
1089The last buffer, which is created if it does not exist, is the buffer to
1090which output is directed. The output buffer is selected during the
1091comparison so that its progress can be monitored. There are various variables
1092that control exactly how the comparison is done.
1093
1094If a prefix argument is specified, then only only the lines in the the regions
1095of the two buffers are compared.
1096@enddefcom
1097
1098@defcom[com "Buffer Changes"]
1099This command compares the contents of the current buffer with the disk version
1100of the associated file. It reads the file into the buffer
1101@hid[Buffer Changes File], and generates the comparison in the buffer
1102@hid[Buffer Changes Result]. As with @hid[Compare Buffers], the output buffer
1103is displayed in the current window.
1104@enddefcom
1105
1106@defcom[com "Merge Buffers"]
1107This command functions in a very similar fashion to @hid[Compare Buffers], the
1108difference being that a version which is a combination of the two buffers being
1109compared is generated in the output buffer. This copies text that is identical
1110in the two comparison buffers to the output buffer. When it encounters a
1111difference, it displays the two differing sections in the output buffer and
1112prompts the user for a key-event indicating what action to take. The following
1113commands are defined:
1114@begin[description]
1115@bf[1]@\
1116 Use the first version of the text.
1117
1118@bf[2]@\
1119 Use the second version.
1120
1121@bf[b]@\
1122 Insert the string @w<"@f[**** MERGE LOSSAGE ****]"> followed by both versions.
1123This is useful if the differing sections are too complex, or it is unclear
1124which is the correct version. If you cannot make the decision conveniently at
1125this point, you can later search for the marking string above.
1126
1127@binding[C-r]@\
1128 Do a recursive edit and ask again when the edit is exited.
1129@end[description]
1130@enddefcom
1131
1132
1133@defhvar[var "Source Compare Ignore Case", val {nil}]
1134@index[case sensitivity]
1135If this variable is non-@nil, @hid[Compare Buffers] and @hid[Merge Buffers]
1136will do comparisons case-insensitively.
1137@enddefhvar
1138
1139@defhvar[var "Source Compare Ignore Indentation", val {nil}]
1140If this variable is non-@nil, @hid[Compare Buffers] and @hid[Merge Buffers]
1141ignore initial whitespace when comparing lines.
1142@enddefhvar
1143
1144@defhvar[var "Source Compare Ignore Extra Newlines", val {t}]
1145If this variable is true, @hid[Compare Buffers] and @hid[Merge Buffers]
1146will treat all groups of newlines as if they were a single newline.
1147@enddefhvar
1148
1149@defhvar[var "Source Compare Number of Lines", val {3}]
1150This variable controls the number of lines @hid[Compare Buffers] and
1151@hid[Merge Buffers] will compare when resynchronizing after a difference
1152has been encountered.
1153@enddefhvar
1154
1155
1156@section[Change Logs]
1157@label[log-files]
1158@index[edit history]
1159@index[change log]
1160
1161The @hemlock change log facility encourages the recording of changes to a
1162system by making it easy to do so. The change log is kept in a separate file
1163so that it doesn't clutter up the source code. The name of the log for a file
1164is specified by the @f[Log] file option (see page @pageref[file-options].)
1165
1166@defcom[com "Log Change"]
1167@defhvar1[var "Log Entry Template"]
1168@hid[Log Change] makes a new entry in the change log associated with the file.
1169Any changes in the current buffer are saved, and the associated log file is
1170read into its own buffer. The name of the log file is determined by merging
1171the name specified in the @f[Log] option with the current buffer's file name,
1172so it is not usually necessary to put the full name there. After inserting a
1173template for the log entry at the beginning of the buffer, the command enters a
1174recursive edit (see page @pageref[recursive-edits]) so that the text of the
1175entry may be filled in. When the user exits the recursive edit, the log file
1176is saved.
1177
1178The variable @hid[Log Entry Template] determines the format of the change log
1179entry. Its value is a @clisp @f[format] control string. The format string is
1180passed three string arguments: the full name of the file, the creation date for
1181the file and the name of the file author. If the creation date is not
1182available, the current date is used. If the author is not available then @nil
1183is passed. If there is an @f[@@] in the template, then it is deleted and the
1184point is left at that position.
1185@enddefcom
1186
1187
1188
1189@comment[@chap (Special Modes)]
1190@include(special-modes)
1191
1192
1193
1194@chap[Editing Programs]
1195
1196
1197@section[Comment Manipulation]
1198@index[comment manipulation]
1199@hemlock has commenting commands which can be used in almost any language. The
1200behavior of these commands is determined by several @hemlock variables which
1201language modes should define appropriately.
1202
1203@defcom[com "Indent for Comment", bind (M-;)]
1204@index[indentation, comment]@label[comment-indentation]
1205This is the most basic commenting command. If there is already a comment on
1206the current line, then this moves the point to the start of the comment. If
1207there no comment, this creates an empty one.
1208
1209This command normally indents the comment to start at @hid[Comment Column].
1210The comment indents differently in the following cases:
1211@begin[enumerate]
1212If the comment currently starts at the beginning of the line, or if the last
1213character in the @hid[Comment Start] appears three times, then the comment
1214remains unmoved.
1215
1216If the last character in the @hid[Comment Start] appears two times, then the
1217comment is indented like a line of code.
1218
1219If text on the line prevents the comment occurring in the desired position,
1220this places the comment at the end of the line, separated from the text by a
1221space.
1222@end[enumerate]
1223Although the rules about replication in the comment start are oriented toward
1224Lisp commenting styles, you can exploit these properties in other languages.
1225
1226When given a prefix argument, this command indents any existing comment on that
1227many consecutive lines. This is useful for fixing up the indentation of a
1228group of comments.
1229@enddefcom
1230
1231@defcom[com "Indent New Comment Line", bind {M-j, M-Linefeed}]
1232This commend ends the current comment and starts a new comment on a blank line,
1233indenting the comment the same way that @hid[Indent for Comment] does.
1234When not in a comment, this command is the same as @hid[Indent New Line].
1235@enddefcom
1236
1237@defcom[com "Up Comment Line", bind {M-p}]
1238@defcom1[com "Down Comment Line", bind {M-n}]
1239These commands are similar to @hid[Previous Line] or @hid[Next Line]
1240followed by @hid[Indent for Comment]. Any empty comment on the current line is
1241deleted before moving to the new line.
1242@enddefcom
1243
1244@defcom[com "Kill Comment", bind (C-M-;)]
1245This command kills any comment on the current line. When given a prefix
1246argument, it kills comments on that many consecutive lines. @hid[Undo] will
1247restore the unmodified text.
1248@enddefcom
1249
1250@defcom[com "Set Comment Column", bind (C-x ;)]
1251This command sets the comment column to its prefix argument. If used without a
1252prefix argument, it sets the comment column to the column the point is at.
1253@enddefcom
1254
1255@defhvar[var "Comment Start", val {nil}]
1256@defhvar1[var "Comment End", val {nil}]
1257@defhvar1[var "Comment Begin", val {nil}]
1258@defhvar1[var "Comment Column", val {0}]
1259These variables determine the behavior of the comment commands.
1260@begin[description]
1261@hid[Comment Start]@\The string which indicates the start of a comment. If
1262this is @nil, then there is no defined comment syntax.
1263
1264@hid[Comment End]@\The string which ends a comment. If this is @nil, then
1265the comment is terminated by the end of the line.
1266
1267@hid[Comment Begin]@\The string inserted to begin a new comment.
1268
1269@hid[Comment Column]@\The column that normal comments start at.
1270@end[description]
1271@enddefcom
1272
1273
1274@section[Indentation]
1275@label[indentation]
1276@index[indentation]
1277Nearly all programming languages have conventions for indentation or leading
1278whitespace at the beginning of lines. The @hemlock indentation facility is
1279integrated into the command set so that it interacts well with other features
1280such as filling and commenting.
1281
1282@defcom[com "Indent", bind (Tab, C-i)]
1283This command indents the current line. With a prefix argument, indents that
1284many lines and moves down. Exactly what constitutes indentation depends on the
1285current mode (see @hid[Indent Function]).
1286@enddefcom
1287
1288@defcom[com "Indent New Line", bind (Linefeed)]
1289This command starts a new indented line. Deletes any whitespace before the
1290point and inserts indentation on a blank line. The effect of this is similar
1291to @binding[Return] followed by @binding[Tab]. The prefix argument is passed
1292to @hid[New Line], which is used to insert the blank line.
1293@enddefcom
1294
1295@defcom[com "Indent Region", bind (C-M-\)]
1296This command indents every line in the region. It may be undone with
1297@hid[Undo].
1298@enddefcom
1299
1300@defcom[com "Back to Indentation", bind {M-m, C-M-m}]
1301@index[motion, indentation]
1302This command moves point to the first non-whitespace character on the current
1303line.
1304@enddefcom
1305
1306@defcom[com "Delete Indentation", bind (M-^, C-M-^)]
1307@hid[Delete Indentation] joins the current line with the previous one, deleting
1308excess whitespace. This operation is the inverse of the @bf[Linefeed] command
1309in most modes. Usually this leaves one space between the two joined lines, but
1310there are several exceptions.
1311
1312The non-whitespace immediately surrounding the deleted line break determine the
1313amount of space inserted.
1314@begin[enumerate]
1315If the preceding character is an "@f[(]" or the following character is a
1316"@f[)]", then this inserts no space.
1317
1318If the preceding character is a newline, then this inserts no space. This will
1319happen if the previous line was blank.
1320
1321If the preceding character is a sentence terminator, then this inserts two
1322spaces.
1323@end[enumerate]
1324
1325When given a prefix argument, this command joins the current and next lines,
1326rather than the previous and current lines.
1327@enddefcom
1328
1329@defcom[com "Quote Tab", bind (M-Tab)]
1330This command inserts a tab character.
1331@enddefcom
1332
1333@defcom[com "Indent Rigidly", bind (C-x Tab, C-x C-i)]
1334This command changes the indentation of all the lines in the region. Each
1335line is moved to the right by the number of spaces specified by the prefix
1336argument, which defaults to eight. A negative prefix argument moves lines
1337left.
1338@enddefcom
1339
1340@defcom[com "Center Line"]
1341This indents the current line so that it is centered between the left margin
1342and @hvarref[Fill Column]. If a prefix argument is supplied, then it is used
1343as the width instead of @hid[Fill Column].
1344@enddefcom
1345
1346@defhvar[var "Indent Function", val {tab-to-tab-stop}]
1347The value of this variable determines how indentation is done, and it is a
1348function which is passed a mark as its argument. The function should indent
1349the line which the mark points to. The function may move the mark around on
1350the line. The mark will be @f[:left-inserting]. The default simply inserts a
1351tab character at the mark.
1352@enddefhvar
1353
1354@defhvar[var "Indent with Tabs", val {indent-using-tabs}]
1355@defhvar1[var "Spaces per Tab", val {8}]
1356@hid[Indent with Tabs] holds a function that takes a mark and a number of
1357spaces. The function will insert a maximum number of tabs and a minimum number
1358of spaces at mark to move the specified number of columns. The default
1359definition uses @hid[Spaces per Tab] to determine the size of a tab. @i[Note,]
1360@hid[Spaces per Tab] @i[is not used everywhere in @hemlock yet, so changing
1361this variable could have unexpected results.]
1362@enddefhvar
1363
1364
1365@section[Language Modes]
1366
1367@hemlock@comment{}'s language modes are currently fairly crude, but probably
1368provide better programming support than most non-extensible editors.
1369
1370@defcom[com "Pascal Mode"]
1371@index[indentation, pascal]@index[modes, pascal]This command sets the current
1372buffer's major mode to @hid[Pascal]. @hid[Pascal] mode borrows parenthesis
1373matching from Scribe mode and indents lines under the previous line.
1374@enddefcom
1375
1376
1377@chap[Editing Lisp]
1378@index[lisp, editing]
1379@hemlock provides a large number of powerful commands for editing Lisp code.
1380It is possible for a text editor to provide a much higher level of support for
1381editing Lisp than ordinary programming languages, since its syntax is much
1382simpler.
1383
1384
1385@section[Lisp Mode]
1386@index[lisp mode]
1387@index[modes, lisp]
1388@hid[Lisp] mode is a major mode used for editing Lisp code. Although most
1389Lisp specific commands are globally bound, @hid[Lisp] mode is necessary to
1390enable Lisp indentation, commenting, and parenthesis-matching. Whenever the
1391user or some @hemlock mechanism turns on @hid[Lisp] mode, the mode's setup
1392includes locally setting @hid[Current Package] (see section @ref[lisp-package])
1393in that buffer if its value is non-existent there; the value used is
1394@f["USER"].
1395
1396@defcom[com "Lisp Mode"]
1397This command sets the major mode of the current buffer to @hid[Lisp].
1398@enddefcom
1399
1400
1401@section[Form Manipulation]
1402@index[form manipulation]
1403These commands manipulate Lisp forms, the printed representations of Lisp
1404objects. A form is either an expression balanced with respect to parentheses
1405or an atom such as a symbol or string.
1406
1407@defcom[com "Forward Form", bind (C-M-f)]
1408@defcom1[com "Backward Form", bind (C-M-b)]
1409@index[motion, form]@hid[Forward Form] moves to the end of the current or
1410next form, while @hid[Backward Form] moves to the beginning of the current
1411or previous form. A prefix argument is treated as a repeat count.
1412@enddefcom
1413
1414@defcom[com "Forward Kill Form", bind (C-M-k)]
1415@defcom1[com "Backward Kill Form", bind (C-M-Delete, C-M-Backspace)]
1416@index[killing, form]@hid[Forward Kill Form] kills text from the point to
1417the end of the current form. If at the end of a list, but inside the close
1418parenthesis, then kill the close parenthesis. @hid[Backward Kill Form] is
1419the same, except it goes in the other direction. A prefix argument is
1420treated as a repeat count.
1421@enddefcom
1422
1423@defcom[com "Mark Form", bind (C-M-@@)]
1424This command sets the mark at the end of the current or next form.
1425@enddefcom
1426
1427@defcom[com "Transpose Forms", bind (C-M-t)]
1428This command transposes the forms before and after the point and moves
1429forward. A prefix argument is treated as a repeat count. If the prefix
1430argument is negative, then the point is moved backward after the
1431transposition is done, reversing the effect of the equivalent positive
1432argument.
1433@enddefcom
1434
1435@defcom[com "Insert ()", bind {M-(}]
1436This command inserts an open and a close parenthesis, leaving the point
1437inside the open parenthesis. If a prefix argument is supplied, then the
1438close parenthesis is put at the end of the form that many forms from the
1439point.
1440@enddefcom
1441
1442@defcom[com "Extract Form"]
1443This command replaces the current containing list with the next form. The
1444entire affected area is pushed onto the kill ring. If an argument is supplied,
1445that many upward levels of list nesting is replaced by the next form. This is
1446similar to @hid[Extract List], but this command is more generally useful since
1447it works on any kind of form; it is also more intuitive since it operates on
1448the next form as many @hid[Lisp] mode commands do.
1449@enddefcom
1450
1451
1452@section[List Manipulation]
1453
1454@index[list manipulation]List commands are similar to form commands, but
1455they only pay attention to lists, ignoring any atomic objects that may
1456appear. These commands are useful because they can skip over many symbols
1457and move up and down in the list structure.
1458
1459@defcom[com "Forward List", bind (C-M-n)]
1460@defcom1[com "Backward List", bind (C-M-p)]
1461@index[motion, list]@hid[Forward List] moves the point to immediately
1462after the end of the next list at the current level of list structure. If
1463there is not another list at the current level, then it moves up past
1464the end of the containing list.
1465@hid[Backward List] is identical, except that it moves backward and leaves
1466the point at the beginning of the list. The prefix argument is used as a
1467repeat count.
1468@enddefcom
1469
1470@defcom[com "Forward Up List", bind {C-M-@bf<)>}]
1471@defcom1[com "Backward Up List", bind (C-M-@bf<(>, C-M-u)]
1472@hid[Forward Up List] moves to after the end of the enclosing list.
1473@hid[Backward Up List] moves to the beginning. The prefix argument is used
1474as a repeat count.
1475@enddefcom
1476
1477@defcom[com "Down List", bind (C-M-d)]
1478This command moves to just after the beginning of the next list. The
1479prefix argument is used as a repeat count.
1480@enddefcom
1481
1482@defcom[com "Extract List", bind (C-M-x)]
1483This command "extracts" the current list from the list which contains it.
1484The outer list is deleted, leaving behind the current list. The entire
1485affected area is pushed on the kill ring, so that this possibly catastrophic
1486operation can be undone. The prefix argument is used as a repeat count.
1487@enddefcom
1488
1489
1490
1491@section[Defun Manipulation]
1492
1493@index[defun manipulation]A @i[defun] is a list whose open parenthesis is
1494against the left margin. It is called this because an occurrence of the
1495@f[defun] top level form usually satisfies this definition, but
1496other top level forms such as a @f[defstruct] and @f[defmacro] work just as
1497well.
1498
1499@defcom[com "End of Defun", bind (@bf<C-M-e, C-M-]>)]
1500@defcom1[com "Beginning of Defun", bind (C-M-a, C-M-[)]
1501@index[motion, defun]@hid[End of Defun] moves to the end of the current
1502or next defun. @hid[Beginning of Defun] moves to the beginning of the
1503current or previous defun. @hid[End of Defun] will not work if the
1504parentheses are not balanced.
1505@enddefcom
1506
1507@defcom[com "Mark Defun", bind (C-M-h)]
1508This command puts the point at the beginning and the mark at the end of the
1509current or next defun.
1510@enddefcom
1511
1512
1513
1514@section[Indentation]
1515
1516@index[indentation, lisp]
1517One of the most important features provided by @hid[Lisp] mode is automatic
1518indentation of Lisp code. Since unindented Lisp is unreadable, poorly indented
1519Lisp is hard to manage, and inconsistently indented Lisp is subtly misleading.
1520See section @ref[indentation] for a description of the general-purpose
1521indentation commands. @hid[Lisp] mode uses these indentation rules:
1522@begin[itemize]
1523If in a semicolon (@f[;]) comment, then use the standard comment indentation
1524rules. See page @pageref[comment-indentation].
1525
1526If in a quoted string, then indent to the column one greater than the column
1527containing the opening double quote. This is exactly what you want in function
1528documentation strings and wrapping @f[error] strings.
1529
1530If there is no enclosing list, then use no indentation.
1531
1532If enclosing list resembles a call to a known macro or special-form, then the
1533first few arguments are given greater indentation and the first body form is
1534indented two spaces. If the first special argument is on the same line as the
1535beginning of the form, then following special arguments will be indented to the
1536start of the first special argument, otherwise all special arguments are
1537indented four spaces.
1538
1539If the previous form starts on its own line, then the indentation is copied
1540from that form. This rule allows the default indentation to be overridden:
1541once a form has been manually indented to the user's satisfaction, subsequent
1542forms will be indented in the same way.
1543
1544If the enclosing list has some arguments on the same line as the form start,
1545then subsequent arguments will be indented to the start of the first argument.
1546
1547If the enclosing list has no argument on the same line as the form start, then
1548arguments will be indented one space.
1549@end[itemize]
1550
1551
1552@defcom[com "Indent Form", bind (C-M-q)]
1553This command indents all the lines in the current form, leaving the point
1554unmoved. This is undo-able.
1555@enddefcom
1556
1557@defcom[com "Fill Lisp Comment Paragraph",
1558 stuff <bound to @bf[M-q] in @hid[Lisp] mode>]
1559@defhvar1[var "Fill Lisp Comment Paragraph Confirm", val {t}]
1560This fills a flushleft or indented Lisp comment. This also fills Lisp string
1561literals using the proper indentation as a filling prefix. When invoked
1562outside of a comment or string, this tries to fill all contiguous lines
1563beginning with the same initial, non-empty blankspace. When filling a comment,
1564the current line is used to determine a fill prefix by taking all the initial
1565whitespace on the line, the semicolons, and any whitespace following the
1566semicolons.
1567
1568When invoked outside of a comment or string, this command prompts for
1569confirmation before filling. It is useful to use this for filling long
1570@f[export] lists or other indented text or symbols, but since this is a less
1571common use, this command tries to make sure that is what you wanted. Setting
1572@hid[Fill Lisp Comment Paragraph Confirm] to @nil inhibits the confirmation
1573prompt.
1574@enddefcom
1575
1576@defcom[com "Defindent", bind (C-M-#)]
1577This command prompts for the number of special arguments to associate with
1578the symbol at the beginning of the current or containing list.
1579@enddefcom
1580
1581@defhvar[var "Indent Defanything", val {2}]
1582This is the number of special arguments implicitly assumed to be supplied in
1583calls to functions whose names begin with "@f[def]". If set to @nil, this
1584feature is disabled.
1585@enddefhvar
1586
1587@defcom[com "Move Over )", bind {M-)}]
1588This command moves past the next close parenthesis and then does the equivalent
1589of @hid[Indent New Line].
1590@enddefcom
1591
1592
1593@section[Parenthesis Matching]
1594
1595@index[parenthesis matching]Another very important facility provided by
1596@hid[Lisp] mode is @i[parenthesis matching]. Two different styles of
1597parenthesis matching are supported: highlighting and pausing.
1598
1599@defhvar[var "Highlight Open Parens", val {t}]
1600@defhvar1[var "Open Paren Highlighting Font", val {nil}]
1601When @hid[Highlight Open Parens] is true, and a close paren is immediately
1602before the point, then @hemlock displays the matching open paren in @hid[Open
1603Paren Highlighting Font].
1604
1605@hid[Open Paren Highlighting Font] is the string name of the font used for
1606paren highlighting. Only the "@f[(]" character is used in this font. If null,
1607then a reasonable default is chosen. The highlighting font is read at
1608initialization time, so this variable must be set before the editor is first
1609entered to have any effect.
1610@enddefhvar
1611
1612@defcom[com "Lisp Insert )", stuff <bound to @bf[)] in @hid[Lisp] mode>]
1613@defhvar1[var "Paren Pause Period", val {0.5}]
1614This command inserts a close parenthesis and then attempts to display the
1615matching open parenthesis by placing the cursor on top of it for
1616@hid[Paren Pause Period] seconds. If there is no matching parenthesis then
1617beep. If the matching parenthesis is off the top of the screen, then the line
1618on which it appears is displayed in the echo area. Paren pausing may be
1619disabled by setting @hid[Paren Pause Period] to @nil.
1620@enddefcom
1621
1622The initial values shown for @hid[Highlight Open Parens] and @hid[Paren Pause
1623Period] are only approximately correct. Since paren highlighting is only
1624meaningful in Lisp mode, @hid[Highlight Open Parens] is false globally, and
1625has a mode-local value of @true in Lisp mode. It it redundant to do both
1626kinds of paren matching, so there is also a binding of @hid[Paren Pause Period]
1627to @false in Lisp mode.
1628
1629Paren highlighting is only supported under @windows, so the above defaults are
1630conditional on the device type. If @hemlock is started on a terminal, the
1631initialization code makes Lisp mode bindings of @false and @f[0.5] for
1632@hid[Highlight Open Parens] and @hid[Paren Pause Period]. Since these
1633alternate default bindings are made at initialization time, the only way to
1634affect them is to use the @f[after-editor-initializations] macro.
1635
1636
1637@section[Parsing Lisp]
1638Lisp mode has a fairly complete knowledge of Lisp syntax, but since it does
1639not use the reader, and must work incrementally, it can be confused by legal
1640constructs. Lisp mode totally ignores the read-table, so user-defined read
1641macros have no effect on the editor. In some cases, the values the @hid[Lisp
1642Syntax] character attribute can be changed to get a similar effect.
1643
1644Lisp commands consistently treat semicolon (@f[;]) style comments as
1645whitespace when parsing, so a Lisp command used in a comment will affect the
1646next (or previous) form outside of the comment. Since @f[#| ... |#] comments
1647are not recognized, they can used to comment out code, while still allowing
1648Lisp editing commands to be used.
1649
1650Strings are parsed similarly to symbols. When within a string, the next form
1651is after the end of the string, and the previous form is the beginning of the
1652string.
1653
1654
1655@defhvar[var "Defun Parse Goal", val {2}]
1656@defhvar1[var "Maximum Lines Parsed", val {500}]
1657@defhvar1[var "Minimum Lines Parsed", val {50}]
1658In order to save time, Lisp mode does not parse the entire buffer every time
1659a Lisp command is used. Instead, it uses a heuristic to guess the region of
1660the buffer that is likely to be interesting. These variables control the
1661heuristic.
1662
1663Normally, parsing begins and ends on defun boundaries (an open parenthesis at
1664the beginning of a line). @hid[Defun Parse Goal] specifies the number of
1665defuns before and after the point to parse. If this parses fewer lines than
1666@hid[Minimum Lines Parsed], then parsing continues until this lower limit is
1667reached. If we cannot find enough defuns within @hid[Maximum Lines Parsed]
1668lines then we stop on the farthest defun found, or at the point where we
1669stopped if no defuns were found.
1670
1671When the heuristic fails, and does not parse enough of the buffer, then
1672commands usually act as though a syntax error was detected. If the parse
1673starts in a bad place (such as in the middle of a string), then Lisp commands
1674will be totally confused. Such problems can usually be eliminated by
1675increasing the values of some of these variables.
1676@enddefhvar
1677
1678@defhvar[var "Parse Start Function", val {start-of-parse-block}]
1679@defhvar1[var "Parse End Function", val {end-of-parse-block}]
1680These variables determine the region of the buffer parsed. The values are
1681functions that take a mark and move it to the start or end of the parse region.
1682The default values implement the heuristic described above.
1683@enddefhvar
1684
1685
1686
1687@comment[@chap(Interacting With Lisp)]
1688@include(lisp)
1689
1690
1691@comment[@chap(Mail Interface)]
1692@include(mail)
1693
1694
1695@comment[@chap(Netnews Interface)]
1696@include(netnews)
1697
1698
1699
1700@chap[System Interface]
1701
1702@hemlock provides a number of commands that access operating system resources
1703such as the filesystem and print servers. These commands offer an alternative
1704to leaving the editor and using the normal operating system command language
1705(such as the Unix shell), but they are implementation dependent. Therefore,
1706they might not even exist in some implementations.
1707
1708
1709@section[File Utility Commands]
1710This section describes some general file operation commands and quick directory
1711commands.
1712
1713See section @ref[dired] for a description @hemlock@comment{}'s directory editing
1714mechanism, @hid[Dired] mode.
1715
1716@defcom[com "Copy File"]
1717This command copies a file, allowing one wildcard in the filename. It prompts
1718for source and destination specifications.
1719
1720If these are both directories, then the copying process is recursive on the
1721source, and if the destination is in the subdirectory structure of the source,
1722the recursion excludes this portion of the directory tree. Use
1723@f[dir-spec-1/*] to copy only the files in a source directory without
1724recursively descending into subdirectories.
1725
1726If the destination specification is a directory, and the source is a file, then
1727it is copied into the destination with the same filename.
1728
1729The copying process copies files maintaining the source's write date.
1730
1731See the description of @hid[Dired Copy File Confirm], page
1732@pageref[copy-confirm], for controlling user interaction when the destination
1733exists.
1734@enddefcom
1735
1736@defcom[com "Rename File"]
1737This command renames a file, allowing one wildcard in the filename. It prompts
1738for source and destination specifications.
1739
1740If the destination is a directory, then the renaming process moves file(s)
1741indicated by the source into the directory with their original filenames.
1742
1743For Unix-based implementations, if you want to rename a directory, do not
1744specify the trailing slash in the source specification.
1745@enddefcom
1746
1747@defcom[com "Delete File"]
1748This command prompts for the name of a file and deletes it.
1749@enddefcom
1750
1751@defcom[com "Directory", bind (C-x C-d)]
1752@defcom1[com "Verbose Directory", bind (C-x C-D)]
1753These commands prompt for a pathname (which may contain wildcards), and display
1754a directory listing in a pop-up window. If a prefix argument is supplied, then
1755normally hidden files such as Unix dot-files will also be displayed.
1756@hid[Directory] uses a compact, multiple-column format;
1757@hid[Verbose Directory] displays one file on a line, with information about
1758protection, size, etc.
1759@enddefcom
1760
1761
1762@section[Printing]
1763
1764@defcom[com "Print Region"]
1765@defcom1[com "Print Buffer"]
1766@defcom1[com "Print File"]
1767@hid[Print Region] and @hid[Print Buffer] print the contents of the current
1768region and the current buffer, respectively. @hid[Print File] prompts for a
1769the name of a file and prints that file. Any error messages will be displayed
1770in the echo area.
1771@enddefcom
1772
1773@defhvar[var "Print Utility", val {"/usr/cs/bin/lpr"}]
1774@defhvar1[var "Print Utility Switches", val {()}]
1775@hid[Print Utility] is the program the print commands use to send files to the
1776printer. The program should act like @f[lpr]: if a filename is given as an
1777argument, it should print that file, and if no name appears, standard input
1778should be assumed. @hid[Print Utility Switches] is a list of strings
1779specifying the options to pass to the program.
1780@enddefhvar
1781
1782
1783@section[Scribe]
1784@defcom[com "Scribe Buffer File",
1785 stuff (bound to @bf[C-x c] in @hid[Scribe] mode)]
1786@defhvar1[var "Scribe Buffer File Confirm", val {t}]
1787@defcom1[com "Scribe File"]
1788@hid[Scribe Buffer File] invokes @hid[Scribe Utility] on the file associated
1789with the current buffer. That process's default directory is the directory of
1790the file. The process sends its output to the @hid[Scribe Warnings] buffer.
1791Before doing anything, this asks the user to confirm saving and formatting the
1792file. This prompting can be inhibited with "Scribe Buffer File Confirm".
1793
1794@hid[Scribe File] invokes @hid[Scribe Utility] on a file supplied by the user
1795in the same manner as describe above.
1796@enddefcom
1797
1798@defhvar[var "Scribe Utility", val {"/usr/misc/bin/scribe"}]
1799@defhvar1[var "Scribe Utility Switches"]
1800@hid[Scribe Utility] is the program the Scribe commands use to compile the text
1801formatting. @hid[Scribe Utility Switches] is a list of strings whose contents
1802would be contiguous characters, other than space, had the user invoked this
1803program on a command line outside of @hemlock. Do not include the name of the
1804file to compile in this variable; the Scribe commands supply this.
1805@enddefhvar
1806
1807@defcom[com "Select Scribe Warnings", bind (Scribe: C-M-C)]
1808This command makes the @hid[Scribe Warnings] buffer current if it exists.
1809@enddefcom
1810
1811
1812@section[Miscellaneous]
1813
1814@defcom[com "Manual Page"]
1815This command displays a Unix manual page in a buffer which is in @hid[View]
1816mode. When given an argument, this puts the manual page in a pop-up display.
1817@enddefcom
1818
1819@defcom[com "Unix Filter Region"]
1820This command prompts for a UNIX program and then passes the current region to
1821the program as standard input. The standard output from the program is used to
1822replace the region. This command is undoable.
1823@enddefcom
1824
1825
1826
1827@chap[Simple Customization]
1828
1829@index[customization]@hemlock can be customized and extended to a very
1830large degree, but in order to do much of this a knowledge of Lisp is
1831required. These advanced aspects of customization are discussed in the
1832@i[Hemlock Command Implementor's Manual], while simpler methods of
1833customization are discussed here.
1834
1835
1836@section[Keyboard Macros]
1837@index[keyboard macros]
1838Keyboard macros provide a facility to turn a sequence of commands into one
1839command.
1840
1841@defcom[com "Define Keyboard Macro", bind {C-x (}]
1842@defcom1[com "End Keyboard Macro", bind {C-x )}]
1843@hid[Define Keyboard Macro] starts the definition of a keyboard macro. The
1844commands which are invoked up until @hid[End Keyboard Macro] is invoked
1845become the definition for the keyboard macro, thus replaying the keyboard
1846macro is synonymous with invoking that sequence of commands.
1847@enddefcom
1848
1849@defcom[com "Last Keyboard Macro", bind (C-x e)]
1850This command is the keyboard macro most recently defined; invoking it will
1851replay the keyboard macro. The prefix argument is used as a repeat count.
1852@enddefcom
1853
1854@defcom[com "Define Keyboard Macro Key", bind (C-x M-(; )]
1855@defhvar1[var "Define Keyboard Macro Key Confirm", val {t}]
1856This command prompts for a key before going into a mode for defining keyboard
1857macros. After defining the macro @hemlock binds it to the key. If the key is
1858already bound, @hemlock asks for confirmation before clobbering the binding;
1859this prompting can be inhibited by setting @hid[Define Keyboard Macro Key
1860Confirm] to @nil.
1861@enddefcom
1862
1863@defcom[com "Keyboard Macro Query", bind (C-x q)]
1864This command conditionalizes the execution of a keyboard macro. When invoked
1865during the definition of a macro, it does nothing. When the macro replays, it
1866prompts the user for a key-event indicating what action to take. The following
1867commands are defined:
1868@begin[description]
1869@binding[Escape]@\
1870 Exit all repetitions of this keyboard macro. More than one may have been
1871specified using a prefix argument.
1872
1873@binding[Space, y]@\
1874 Proceed with the execution of the keyboard macro.
1875
1876@binding[Delete, Backspace, n]@\
1877 Skip the remainder of the keyboard macro and go on to the next repetition, if
1878any.
1879
1880@binding[!]@\
1881 Do all remaining repetitions of the keyboard macro without prompting.
1882
1883@binding[.]@\
1884 Complete this repetition of the macro and then exit without doing any of the
1885remaining repetitions.
1886
1887@binding[C-r]@\
1888 Do a recursive edit and then prompt again.
1889@end[description]
1890@enddefcom
1891
1892@defcom[com "Name Keyboard Macro"]
1893This command prompts for the name of a command and then makes the
1894definition for that command the same as @hid[Last Keyboard Macro]'s current
1895definition. The command which results is not clobbered when another
1896keyboard macro is defined, so it is possible to keep several keyboard
1897macros around at once. The resulting command may also be bound to a key
1898using @hid[Bind Key], in the same way any other command is.
1899@enddefcom
1900
1901Many keyboard macros are not for customization, but rather for one-shot
1902use, a typical example being performing some operation on each line of a file.
1903To add "@f[del ]" to the beginning and "@f[.*]" to the end of every line in
1904in a buffer, one could do this:
1905@begin[programexample]
1906C-x ( d e l Space C-e . * C-n C-a C-x ) C-u 9 9 9 C-x e
1907@end[programexample]
1908First a keyboard macro is defined which performs the desired operation on
1909one line, and then the keyboard macro is invoked with a large prefix
1910argument. The keyboard macro will not actually execute that many times;
1911when the end of the buffer is reached the @binding[C-n] will get an error
1912and abort the execution.
1913
1914
1915@section[Binding Keys]
1916@index[key bindings]
1917@label[binding-keys]
1918
1919@defcom[com "Bind Key"]
1920This command prompts for a command, a key and a kind of binding to make,
1921and then makes the specified binding. The following kinds of bindings are
1922allowed:
1923@begin[description]
1924@i[buffer]@\Prompts for a buffer and then makes a key binding which is
1925only present when that buffer is the current buffer.
1926
1927@i[mode]@\Prompts for the name of a mode and then makes a key binding which
1928is only in present when that mode is active in the current buffer.
1929
1930@i[global]@\Makes a global key binding which is in effect when there is
1931no applicable mode or buffer key binding. This is the default.
1932@end[description]
1933@enddefcom
1934
1935@defcom[com "Delete Key Binding"]
1936This command prompts for a key binding the same way that @hid[Bind Key]
1937does and makes the specified binding go away.
1938@enddefcom
1939
1940@section[Hemlock Variables]
1941
1942@label[vars]@index[variables, hemlock]@index[hemlock variables]A number
1943of commands use @hemlock variables as flags to control their behavior. Often
1944you can get a command to do what you want by setting a variable. Generally the
1945default value for a variable is chosen to be the safest value for novice users.
1946
1947@defcom[com "Set Variable"]
1948This command prompts for the name of a @hemlock variable and an expression,
1949then sets the current value of the variable to the result of the evaluation of
1950the expression.
1951@enddefcom
1952
1953
1954@defcom[com "Defhvar"]
1955Like @hid[Set Variable], this command prompts for the name of a @hemlock
1956variable and an expression. Like @hid[Bind Key], this command prompts for a
1957place: mode, buffer or local. The result of evaluating the expression is
1958defined to be the value of the named variable in the specified place.
1959
1960This command is most useful for making mode or buffer local bindings of
1961variables. Redefining a variable in a mode or buffer will create a
1962customization that takes effect only when in that mode or buffer.
1963
1964Unlike @hid[Set Variable], the variable name need not be the name of an
1965existing variable: new variables may be defined. If the variable is already
1966defined in the current environment, @hemlock copies the documentation and hooks
1967to the new definition.
1968@enddefcom
1969
1970
1971@section[Init Files]
1972@index[init files]
1973@hemlock customizations are normally put in @hemlock@comment{}'s initialization file,
1974"@f[hemlock-init.lisp]", or when compiled "@f[hemlock-init.fasl]". When
1975starting up Lisp, use the @f[-hinit] switch to indicate a particular file. The
1976contents of the init file must be Lisp code, but there is a fairly
1977straightforward correspondence between the basic customization commands and the
1978equivalent Lisp code. Rather than describe these functions in depth here, a
1979brief example follows:
1980@begin[programexample]
1981;;; -*- Mode: Lisp; Package: Hemlock -*-
1982
1983;;; It is necessary to specify that the customizations go in
1984;;; the hemlock package.
1985(in-package 'hemlock)
1986
1987;;; Bind @hid[Kill Previous Word] to @binding[M-h].
1988(bind-key "Kill Previous Word" '#(#\m-h))
1989;;;
1990;;; Bind @hid[Extract List] to @binding[C-M-?] when in @hid[Lisp] mode.
1991(bind-key "Extract List" '#(#\c-m-?) :mode "Lisp")
1992
1993;;; Make @binding[C-w] globally unbound.
1994(delete-key-binding '#(#\c-w))
1995
1996;;; Make string searches case-sensitive.
1997(setv string-search-ignore-case nil)
1998;;;
1999;;; Make "Query Replace" replace strings literally.
2000(setv case-replace nil)
2001@end[programexample]
2002For a detailed description of these functions, see the @i[Hemlock Command
2003Implementor's Manual].
Note: See TracBrowser for help on using the repository browser.