.NH 1 Commands for English Text .XS \n(PN \*(SN Commands for English Text .XE .LP \s-2JOVE\s0 has many commands that work on the basic units of English text: words, sentences and paragraphs. .NH 2 Word Commands .XS \n(PN 5n \*(SN Word Commands .XE .LP \s-2JOVE\s0 has commands for moving over or operating on words. By convention, they are all ESC commands. .IP "ESC F" 20n Move Forward over a word. .IP "ESC B" 20n Move Backward over a word. .IP "ESC D" 20n Kill forward to the end of a word. .IP "ESC Rubout" 20n Kill backward to the beginning of a word. .LP Notice how these commands form a group that parallels the character- based commands, C-F, C-B, C-D, and Rubout. .LP The commands ESC F and ESC B move forward and backward over words. They are thus analogous to Control-F and Control-B, which move over single characters. Like their Control- analogues, ESC F and ESC B move several words if given an argument. ESC F with a negative argument moves backward like ESC B, and ESC B with a negative argument moves forward. Forward motion stops right after the last letter of the word, while backward motion stops right before the first letter. .LP It is easy to kill a word at a time. ESC D kills the word after point. To be precise, it kills everything from point to the place ESC F would move to. Thus, if point is in the middle of a word, only the part after point is killed. If some punctuation comes after point, and before the next word, it is killed along with the word. If you wish to kill only the next word but not the punctuation, simply do ESC F to get to the end, and kill the word backwards with ESC Rubout. ESC D takes arguments just like ESC F. .LP ESC Rubout kills the word before point. It kills everything from point back to where ESC B would move to. If point is after the space in "FOO, BAR", then "FOO, " is killed. If you wish to kill just "FOO", then do a ESC B and a ESC D instead of a ESC Rubout. .NH 2 Sentence Commands .XS \n(PN 5n \*(SN Sentence Commands .XE .LP The \s-2JOVE\s0 commands for manipulating sentences and paragraphs are mostly ESC commands, so as to resemble the word-handling commands. .IP "ESC A" 20n Move back to the beginning of the sentence. .IP "ESC E" 20n Move forward to the end of the sentence. .IP "ESC K" 20n Kill forward to the end of the sentence. .IP "C-X Rubout" 20n Kill back to the beginning of the sentence. .LP The commands ESC A and ESC E move to the beginning and end of the current sentence, respectively. They were chosen to resemble Control-A and Control-E, which move to the beginning and end of a line. Unlike them, ESC A and ESC E if repeated or given numeric arguments move over successive sentences. \s-2JOVE\s0 considers a sentence to end wherever there is a ".", "?", or "!" followed by the end of a line or by one or more spaces. Neither ESC A nor ESC E moves past the end of the line or spaces which delimit the sentence. .LP Just as C-A and C-E have a kill command, C-K, to go with them, so ESC A and ESC E have a corresponding kill command ESC K which kills from point to the end of the sentence. With minus one as an argument it kills back to the beginning of the sentence. Positive arguments serve as a repeat count. .LP There is a special command, C-X Rubout for killing back to the beginning of a sentence, because this is useful when you change your mind in the middle of composing text. .NH 2 Paragraph Commands .XS \n(PN 5n \*(SN Paragraph Commands .XE .LP The \s-2JOVE\s0 commands for handling paragraphs are .IP "ESC [" 20n Move back to previous paragraph beginning. .IP "ESC ]" 20n Move forward to next paragraph end. .LP ESC [ moves to the beginning of the current or previous paragraph, while ESC ] moves to the end of the current or next paragraph. Paragraphs are delimited by lines of differing indent, or lines with text formatter commands, or blank lines. \s-2JOVE\s0 knows how to deal with most indented paragraphs correctly, although it can get confused by one- or two-line paragraphs delimited only by indentation. .NH 2 Text Indentation Commands .XS \n(PN 5n \*(SN Text Indentation Commands .XE .LP .IP "Tab" 20n Indent "appropriately" in a mode-dependent fashion. .IP "LineFeed" 20n Is the same as Return, except it copies the indent of the line you just left. .IP "ESC M" 20n Moves to the line's first non-blank character. .LP .LP The way to request indentation is with the Tab command. Its precise effect depends on the major mode. In \fIText\fP mode, it indents to the next tab stop. In \fIC\fP mode, it indents to the "right" position for C programs. .LP To move over the indentation on a line, do ESC M (\fIfirst-non-blank\fP). This command, given anywhere on a line, positions the cursor at the first non-blank, non-tab character on the line. .NH 2 Text Filling .XS \n(PN 5n \*(SN Text Filling .XE .LP \fIAuto Fill\fP mode causes text to be \fIfilled\fP (broken up into lines that fit in a specified width) automatically as you type it in. If you alter existing text so that it is no longer properly filled, \s-2JOVE\s0 can fill it again if you ask. .LP Entering \fIAuto Fill\fP mode is done with ESC X \fIauto-fill-mode\fP. From then on, lines are broken automatically at spaces when they get longer than the desired width. To leave \fIAuto Fill\fP mode, once again execute ESC X \fIauto-fill-mode\fP. When \fIAuto Fill\fP mode is in effect, the word \fBFill\fP appears in the mode line. .LP If you edit the middle of a paragraph, it may no longer correctly be filled. To refill a paragraph, use the command ESC J (\fIfill-paragraph\fP). It causes the paragraph that point is inside to be filled. All the line breaks are removed and new ones inserted where necessary. .LP The maximum line width for filling is in the variable \fIright-margin\fP. Both ESC J and auto-fill make sure that no line exceeds this width. The value of \fIright-margin\fP is initially 78. .LP Normally ESC J figures out the indent of the paragraph and uses that same indent when filling. If you want to change the indent of a paragraph you set \fIleft-margin\fP to the new position and type C-U\ ESC\ J. \fIfill-paragraph\fP, when supplied a numeric argument, uses the value of \fIleft-margin\fP. .LP If you know where you want to set the right margin but you don't know the actual value, move to where you want to set the value and use the \fIright-margin-here\fP command. \fIleft-margin-here\fP does the same for the \fIleft-margin\fP variable. .NH 2 Case Conversion Commands .XS \n(PN 5n \*(SN Case Conversion Commands .XE .LP .IP "ESC L" 15n Convert following word to lower case. .IP "ESC U" 15n Convert following word to upper case. .IP "ESC C" 15n Capitalize the following word. .LP .LP The word conversion commands are most useful. ESC L converts the word after point to lower case, moving past it. Thus, successive ESC L's convert successive words. ESC U converts to all capitals instead, while ESC C puts the first letter of the word into upper case and the rest into lower case. All these commands convert several words at once if given an argument. They are especially convenient for converting a large amount of text from all upper case to mixed case, because you can move through the test using ESC L, ESC U or ESC C on each word as appropriate. .LP When given a negative argument, the word case conversion commands apply to the appropriate number of words before point, but do not move point. This is convenient when you have just typed a word in the wrong case. You can give the case conversion command and continue typing. .LP If a word case conversion command is given in the middle of a word, it applies only to the part of the word which follows the cursor, treating it as a whole word. .LP The other case conversion functions are \fIcase-region-upper\fP and \fIcase-region-lower\fP, which convert everything between point and mark to the specified case. Point and mark remain unchanged. .NH 2 Commands for Fixing Typos .XS \n(PN 5n \*(SN Commands for Fixing Typos .XE .LP In this section we describe the commands that are especially useful for the times when you catch a mistake on your text after you have made it, or change your mind while composing text on line. .IP "Rubout" 25n Delete last character. .IP "ESC Rubout" 25n Kill last word. .IP "C-X Rubout" 25n Kill to beginning of sentence. .IP "C-T" 25n Transpose two characters. .IP "C-X C-T" 25n Transpose two lines. .IP "ESC Minus ESC L" 25n Convert last word to lower case. .IP "ESC Minus ESC U" 25n Convert last word to upper case. .IP "ESC Minus ESC C" 25n Convert last word to lower case with capital initial. .LP .NH 2 Killing Your Mistakes .XS \n(PN 5n \*(SN Killing Your Mistakes .XE .LP The Rubout command is the most important correction command. When used among printing (self-inserting) characters, it can be thought of as canceling the last character typed. .LP When your mistake is longer than a couple of characters, it might be more convenient to use ESC Rubout or C-X Rubout. ESC Rubout kills back to the start of the last word, and C-X Rubout kills back to the start of the last sentence. C-X Rubout is particularly useful when you are thinking of what to write as you type it, in case you change your mind about phrasing. ESC Rubout and C-X Rubout save the killed text for C-Y and ESC Y to retrieve. .LP ESC Rubout is often useful even when you have typed only a few characters wrong, if you know you are confused in your typing and aren't sure what you typed. At such a time, you cannot correct with Rubout except by looking at the screen to see what you did. It requires less thought to kill the whole word and start over again, especially if the system is heavily loaded. .LP If you were typing a command or command parameters, C-G will abort the command with no further processing. .NH 2 Transposition .XS \n(PN 5n \*(SN Transposition .XE .LP The common error of transposing two characters can be fixed with the C-T (\fItranspose-characters\fP) command. Normally, C-T transposes the two characters on either side of the cursor and moves the cursor forward one character. Repeating the command several times "drags" a character to the right. (Remember that \fIpoint\fP is considered to be between two characters, even though the visible cursor in your terminal is on only one of them.) When given at the end of a line, rather than switching the last character of the line with the line separator, which would be useless, C-T transposes the last two characters on the line. So, if you catch your transposition error right away, you can fix it with just a C-T. If you don't catch it so fast, you must move the cursor back to between the two characters. .LP To transpose two lines, use the C-X C-T (\fItranspose-lines\fP) command. The line containing the cursor is exchanged with the line above it; the cursor is left at the beginning of the line following its original position. .NH 2 Checking and Correcting Spelling .XS \n(PN 5n \*(SN Checking and Correcting Spelling .XE .LP When you write a paper, you should correct its spelling at some point close to finishing it. To correct the entire buffer, do ESC X \fIspell-buffer\fP. This invokes the .UX .I spell program, which prints a list of all the misspelled words. \s-2JOVE\s0 catches the list and places it in a \s-2JOVE\s0 buffer called \fBSpell\fP. You are given an opportunity to delete from that buffer any words that aren't really errors; then \s-2JOVE\s0 looks up each misspelled word and remembers where it is in the buffer being corrected. Then you can go forward to each misspelled word with C-X C-N (\fInext-error\fP) and backward with C-X C-P (\fIprevious-error\fP). See the section entitled \fIError Message Parsing\fP. .NH 1 File Handling .XS \n(PN \*(SN File Handling .XE .LP The basic unit of stored data is the file. Each program, each paper, lives usually in its own file. To edit a program or paper, the editor must be told the name of the file that contains it. This is called \fIvisiting\fP a file. To make your changes to the file permanent on disk, you must \fIsave\fP the file. .NH 2 Visiting Files .XS \n(PN 5n \*(SN Visiting Files .XE .LP .IP "C-X C-V" 15n Visit a file. .IP "C-X C-R" 15n Same as C-X C-V. .IP "C-X C-S" 15n Save the visited file. .IP "ESC ~" 15n Tell \s-2JOVE\s0 to forget that the buffer has been changed. .LP .LP \fIVisiting\fP a file means copying its contents into \s-2JOVE\s0 where you can edit them. \s-2JOVE\s0 remembers the name of the file you visited. Unless you use the multiple buffer feature of \s-2JOVE\s0, you can only be visiting one file at a time. The name of the current selected buffer is visible in the mode line. .LP The changes you make with \s-2JOVE\s0 are made in a copy inside \s-2JOVE\s0. The file itself is not changed. The changed text is not permanent until you \fIsave\fP it in a file. The first time you change the text, an asterisk appears at the end of the mode line; this indicates that the text contains fresh changes which will be lost unless you save them. .LP To visit a file, use the command C-X C-V. Follow the command with the name of the file you wish to visit, terminated by a Return. You can abort the command by typing C-G, or edit the filename with many of the standard \s-2JOVE\s0 commands (e.g., C-A, C-E, C-F, ESC F, ESC Rubout). If the filename you wish to visit is similar to the filename in the mode line (the default filename), you can type C-R to insert the default and then edit it. If you do type a Return to finish the command, the new file's text appears on the screen, and its name appears in the mode line. In addition, its name becomes the new default filename. .LP If you wish to save the file and make your changes permanent, type C-X C-S. After the save is finished, C-X C-S prints the filename and the number of characters and lines that it wrote to the file. If there are no changes to save (no asterisk at the end of the mode line), the file is not saved; otherwise the changes saved and the asterisk at the end of the mode line will disappear. .LP What if you want to create a file? Just visit it. \s-2JOVE\s0 prints \fI(New file)\fP but aside from that behaves as if you had visited an existing empty file. If you make any changes and save them, the file is created. If you visit a nonexistent file unintentionally (because you typed the wrong filename), go ahead and visit the file you meant. If you don't save the unwanted file, it is not created. .LP If you alter one file and then visit another in the same buffer, \s-2JOVE\s0 offers to save the old one. If you answer YES, the old file is saved; if you answer NO, all the changes you have made to it since the last save are lost. You should not type ahead after a file visiting command, because your type-ahead might answer an unexpected question in a way that you would regret. .LP Sometimes you will change a buffer by accident. Even if you undo the effect of the change by editing, \s-2JOVE\s0 still knows that "the buffer has been changed". You can tell \s-2JOVE\s0 to pretend that there have been no changes with the ESC \s+2~\s0 command (\fImake-buffer-unmodified\fP). This command simply clears the "modified" flag which says that the buffer contains changes which need to be saved. Even if the buffer really \fIis\fP changed \s-2JOVE\s0 will still act as if it were not. .LP If \s-2JOVE\s0 is about to save a file and sees that the date of the version on disk does not match what \s-2JOVE\s0 last read or wrote, \s-2JOVE\s0 notifies you of this fact, and asks what to do, because this probably means that something is wrong. For example, somebody else may have been editing the same file. If this is so, there is a good chance that your work or his work will be lost if you don't take the proper steps. You should first find out exactly what is going on. If you determine that somebody else has modified the file, save your file under a different filename and then DIFF the two files to merge the two sets of changes. (The "patch" command is useful for applying the results of context diffs directly). Also get in touch with the other person so that the files don't diverge any further. .NH 2 How to Undo Drastic Changes to a File .XS \n(PN 5n \*(SN How to Undo Drastic Changes to a File .XE .LP If you have made several extensive changes to a file and then change your mind about them, and you haven't yet saved them, you can get rid of them by reading in the previous version of the file. You can do this with the C-X C-V command, to visit the unsaved version of the file. .NH 2 Recovering from system/editor crashes .XS \n(PN 5n \*(SN Recovering from system/editor crashes .XE .LP JOVE does not have \fIAuto Save\fP mode, but it does provide a way to recover your work in the event of a system or editor crash. JOVE saves information about the files you're editing every so many changes to a buffer to make recovery possible. Since a relatively small amount of information is involved it's hardly even noticeable when JOVE does this. The variable "sync-frequency" says how often to save the necessary information, and the default is every 50 changes. 50 is a very reasonable number: if you are writing a paper you will not lose more than the last 50 characters you typed, which is less than the average length of a line. .NH 2 Miscellaneous File Operations .XS \n(PN 5n \*(SN Miscellaneous File Operations .XE .LP .LP ESC X \fIwrite-file\fP writes the contents of the buffer into the file , and then visits that file. It can be thought of as a way of "changing the name" of the file you are visiting. Unlike C-X C-S, \fIwrite-file\fP saves even if the buffer has not been changed. C-X C-W is another way of getting this command. .LP ESC X \fIinsert-file\fP inserts the contents of into the buffer at point, leaving point unchanged before the contents. You can also use C-X C-I to get this command. .LP ESC X \fIwrite-region\fP writes the region (the text between point and mark) to the specified file. It does not set the visited filename. The buffer is not changed. .LP ESC X \fIappend-region\fP appends the region to . The text is added to the end of . .NH 1 Using Multiple Buffers .XS \n(PN \*(SN Using Multiple Buffers .XE .LP When we speak of "the buffer", which contains the text you are editing, we have given the impression that there is only one. In fact, there may be many of them, each with its own body of text. At any time only one buffer can be \fIselected\fP and available for editing, but it isn't hard to switch to a different one. Each buffer individually remembers which file it is visiting, what modes are in effect, and whether there are any changes that need saving. .IP "C-X B" 15n Select or create a buffer. .IP "C-X C-F" 15n Visit a file in its own buffer. .IP "C-X C-B" 15n List the existing buffers. .IP "C-X K" 15n Kill a buffer. .LP Each buffer in \s-2JOVE\s0 has a single name, which normally doesn't change. A buffer's name can be any length. The name of the currently selected buffer and the name of the file visited in it are visible in the mode line when you are at top level. A newly started \s-2JOVE\s0 has only one buffer, named \fBMain\fP, unless you specified files to edit in the shell command that started \s-2JOVE\s0. .NH 2 Creating and Selecting Buffers .XS \n(PN 5n \*(SN Creating and Selecting Buffers .XE .LP To create a new buffer, you need only think of a name for it (say, FOO) and then do C-X B FOO, which is the command C-X B (\fIselect-buffer\fP) followed by the name. This makes a new, empty buffer (if one by that name didn't previously exist) and selects it for editing. The new buffer is not visiting any file, so if you try to save it you will be asked for the filename to use. Each buffer has its own major mode; the new buffer's major mode is \fIText\fP mode by default. .LP To return to buffer FOO later after having switched to another, the same command C-X B FOO is used, since C-X B can tell whether a buffer named FOO exists already or not. C-X B Main reselects the buffer Main that \s-2JOVE\s0 started out with. Just C-X B reselects the previous buffer. Repeated C-X B's alternate between the last two buffers selected. .LP You can also read a file into its own newly created buffer, all with one command: C-X C-F (\fIfind-file\fP), followed by the filename. The name of the buffer is the last element of the file's pathname. C-F stands for "Find", because if the specified file already resides in a buffer in your \s-2JOVE\s0, that buffer is reselected. So you need not remember whether you have brought the file in already or not. A buffer created by C-X C-F can be reselected later with C-X B or C-X C-F, whichever you find more convenient. Nonexistent files can be created with C-X C-F just as they can with C-X C-V. .NH 2 Using Existing Buffers .XS \n(PN 5n \*(SN Using Existing Buffers .XE .LP To get a list of all the buffers that exist, do C-X C-B (\fIlist-buffers\fP). Each buffer's type, name, and visited filename is printed. An asterisk before the buffer name indicates a buffer which contains changes that have not been saved. The number that appears at the beginning of a line in a C-X C-B listing is that buffer's \fIbuffer number\fP. You can select a buffer by typing its number in place of its name. If a buffer with that number doesn't already exist, a new buffer is created with that number as its name. .LP If several buffers have modified text in them, you should save some of them with C-X C-M (\fIwrite-modified-files\fP). This finds all the buffers that need saving and then saves them. Saving the buffers this way is much easier and more efficient (but more dangerous) than selecting each one and typing C-X C-S. If you give C-X C-M an argument, \s-2JOVE\s0 will ask for confirmation before saving each buffer. .LP ESC X \fIrename-buffer\fP changes the name of the currently selected buffer. .LP ESC X \fIerase-buffer\fP erases the contents of the without deleting the buffer entirely. .NH 2 Killing Buffers .XS \n(PN 5n \*(SN Killing Buffers .XE .LP After you use a \s-2JOVE\s0 for a while, it may fill up with buffers which you no longer need. Eventually you can reach a point where trying to create any more results in an "out of memory" or "out of lines" error. When this happens you will want to kill some buffers with the C-X K (\fIdelete-buffer\fP) command. You can kill the buffer FOO by doing C-X K FOO. If you type C-X K JOVE will kill the previously selected buffer. If you try to kill a buffer that needs saving \s-2JOVE\s0 will ask you to confirm it. .LP If you need to kill several buffers, use the command \fIkill-some-buffers\fP. This prompts you with the name of each buffer and asks for confirmation before killing that buffer. .NH 1 Controlling the Display .XS \n(PN \*(SN Controlling the Display .XE .LP Since only part of a large file will fit on the screen, \s-2JOVE\s0 tries to show the part that is likely to be interesting. The display control commands allow you to see a different part of the file. .IP "C-L" 15n Reposition point at a specified vertical position, OR clear and redraw the screen with point in the same place. .IP "C-V" 15n Scroll forwards (a screen or a few lines). .IP "ESC V" 15n Scroll backwards. .IP "C-Z" 15n Scroll forward some lines. .IP "ESC Z" 15n Scroll backwards some lines. .LP .LP The terminal screen is rarely large enough to display all of your file. If the whole buffer doesn't fit on the screen, \s-2JOVE\s0 shows a contiguous portion of it, containing .I point. It continues to show approximately the same portion until point moves outside of what is displayed; then \s-2JOVE\s0 chooses a new portion centered around the new .I point. This is \s-2JOVE\s0's guess as to what you are most interested in seeing, but if the guess is wrong, you can use the display control commands to see a different portion. The available screen area through which you can see part of the buffer is called \fIthe window\fP, and the choice of where in the buffer to start displaying is also called \fIthe window\fP. (When there is only one window, it plus the mode line and the input line take up the whole screen). .LP First we describe how \s-2JOVE\s0 chooses a new window position on its own. The goal is usually to place .I point half way down the window. This is controlled by the variable \fIscroll-step\fP, whose value is the number of lines above the bottom or below the top of the window that the line containing point is placed. A value of 0 (the initial value) means center .I point in the window. .LP The basic display control command is C-L (\fIredraw-display\fP). In its simplest form, with no argument, it tells \s-2JOVE\s0 to choose a new window position, centering point half way from the top as usual. .LP C-L with a positive argument chooses a new window so as to put point that many lines from the top. An argument of zero puts point on the very top line. Point does not move with respect to the text; rather, the text and point move rigidly on the screen. .LP If point stays on the same line, the window is first cleared and then redrawn. Thus, two C-L's in a row are guaranteed to clear the current window. ESC C-L will clear and redraw the entire screen. .LP The \fIscrolling\fP commands C-V, ESC V, C-Z, and ESC Z, let you move the whole display up or down a few lines. C-V (\fInext-page\fP) with an argument shows you that many more lines at the bottom of the screen, moving the text and point up together as C-L might. C-V with a negative argument shows you more lines at the top of the screen, as does ESC V (\fIprevious-page\fP) with a positive argument. .LP To read the buffer a window at a time, use the C-V command with no argument. It takes the last line at the bottom of the window and puts it at the top, followed by nearly a whole window of lines not visible before. Point is put at the top of the window. Thus, each C-V shows the "next page of text", except for one line of overlap to provide context. To move backward, use ESC V without an argument, which moves a whole window backwards (again with a line of overlap). .LP C-Z and ESC Z scroll one line forward and one line backward, respectively. These are convenient for moving in units of lines without having to type a numeric argument. .NH 2 Multiple Windows .XS \n(PN 5n \*(SN Multiple Windows .XE .LP \s-2JOVE\s0 allows you to split the screen into two or more \fIwindows\fP and use them to display parts of different files, or different parts of the same file. .IP "C-X 2" 15n Divide the current window into two smaller ones. .IP "C-X 1" 15n Delete all windows but the current one. .IP "C-X D" 15n Delete current window. .IP "C-X N" 15n Switch to the next window. .IP "C-X P" 15n Switch to the previous window. .IP "C-X O" 15n Same as C-X P. .IP "C-X ^" 15n Make this window bigger. .IP "ESC C-V" 15n Scroll the other window. .LP .LP When using \fImultiple window\fP mode, the text portion of the screen is divided into separate parts called \fIwindows\fP, which can display different pieces of text. Each window can display different files, or parts of the same file. Only one of the windows is .I active; that is the window which the cursor is in. Editing normally takes place in that window alone. To edit in another window, you would give a command to move the cursor to the other window, and then edit there. .LP Each window displays a mode line for the buffer it's displaying. This is useful to keep track of which window corresponds with which file. In addition, the mode line serves as a separator between windows. By setting the variable \fImode-line-should-standout\fP to "on" you can have \s-2JOVE\s0 display the mode-line in reverse video (assuming your particular terminal has the reverse video capability). .LP The command C-X 2 (\fIsplit-current-window\fP) enters multiple window mode. A new mode line appears across the middle of the screen, dividing the text display area into two halves. Both windows contain the same buffer and display the same position in it, namely where point was at the time you issued the command. The cursor moves to the second window. .LP To return to viewing only one window, use the command C-X 1 (\fIdelete-other-windows\fP). The current window expands to fill the whole screen, and the other windows disappear until the next C-X 2. (The buffers and their contents are unaffected by any of the window operations). .LP While there is more than one window, you can use C-X N (\fInext-window\fP) to switch to the next window, and C-X P (\fIprevious-window\fP) to switch to the previous one. If you are in the bottom window and you type C-X N, you will be placed in the top window, and the same kind of thing happens when you type C-X P in the top window, namely you will be placed in the bottom window. C-X O is the same as C-X P. It stands for "other window" because when there are only two windows, repeated use of this command will switch between the two windows. .LP Often you will be editing one window while using the other just for reference. Then, the command ESC C-V (\fIpage-next-window\fP) is very useful. It scrolls the next window, as if you switched to the next window, typed C-V, and switched back, without your having to do all that. With a negative argument, ESC C-V will do an ESC V in the next window. .LP When a window splits, both halves are approximately the same size. You can redistribute the screen space between the windows with the C-X ^ (\fIgrow-window\fP) command. It makes the currently selected window grow one line bigger, or as many lines as is specified with a numeric argument. Use ESC X \fIshrink-window\fP to make the current window smaller. .NH 2 Multiple Windows and Multiple Buffers .XS \n(PN 5n \*(SN Multiple Windows and Multiple Buffers .XE .LP Buffers can be selected independently in each window. The C-X B command selects a new buffer in whichever window contains the cursor. Other windows' buffers do not change. .LP You can view the same buffer in more than one window. Although the same buffer appears in both windows, they have different values of point, so you can move around in one window while the other window continues to show the same text. Then, having found one place you wish to refer to, you can go back into the other window with C-X O or C-X P to make your changes. .LP If you have the same buffer in both windows, you must beware of trying to visit a different file in one of the windows with C-X C-V, because if you bring a new file into this buffer, it will replaced the old file in \fIboth\fP windows. To view different files in different windows, you must switch buffers in one of the windows first (with C-X B or C-X C-F, perhaps). .LP A convenient "combination" command for viewing something in another window is C-X 4 (\fIwindow-find\fP). With this command you can ask to see any specified buffer, file or tag in the other window. Follow the C-X 4 with either B and a buffer name, F and a filename, or T and a tag name. This switches to the other window and finds there what you specified. If you were previously in one-window mode, multiple-window mode is entered. C-X 4 B is similar to C-X 2 C-X B. C-X 4 F is similar to C-X 2 C-X C-F. C-X 4 T is similar to C-X 2 C-X T. The difference is one of efficiency, and also that C-X 4 works equally well if you are already using two windows. .NH 1 Processes Under \s-2JOVE\s0 .XS \n(PN \*(SN Processes Under \s-2JOVE\s0 .XE .LP Another feature in \s-2JOVE\s0 is its ability to interact with .UX in a useful way. You can run other .UX commands from \s-2JOVE\s0 and catch their output in \s-2JOVE\s0 buffers. In this chapter we will discuss the different ways to run and interact with .UX commands. .NH 2 Non-interactive .UX commands .XS \n(PN 5n \*(SN Non-interactive .XE .LP To run a .UX command from \s-2JOVE\s0 just type "C-X !" followed by the name of the command terminated with Return. For example, to get a list of all the users on the system, you do: .DS I C-X ! who .DE Then \s-2JOVE\s0 picks a reasonable buffer in which the output from the command will be placed. E.g., "who" uses a buffer called \fBwho\fP; "ps alx" uses \fBps\fP; and "fgrep -n foo *.c" uses \fBfgrep\fP. If \s-2JOVE\s0 wants to use a buffer that already exists it first erases the old contents. If the buffer it selects holds a file, not output from a previous shell command, you must first delete that buffer with C-X K. .LP Once \s-2JOVE\s0 has picked a buffer it puts that buffer in a window so you can see the command's output as it is running. If there is only one window \s-2JOVE\s0 will automatically make another one. Otherwise, \s-2JOVE\s0 tries to pick the most convenient window which isn't the current one. .LP It's not a good idea to type anything while the command is running. There are two reasons for this: .IP (i) \s-2JOVE\s0 won't see the characters (thus won't execute them) until the command finishes, so you may forget what you've typed. .IP (ii) Although \s-2JOVE\s0 won't know what you've typed, it .I will know that you've typed something, and then it will try to be "smart" and not update the display until it's interpreted what you've typed. But, of course, \s-2JOVE\s0 won't interpret what you type until the .UX command completes, so you're left with the uneasy feeling you get when you don't know what the hell the computer is doing*. .FS *This is a bug and should be fixed, but probably won't be for a while. .FE .LP If you want to interrupt the command for some reason (perhaps you mistyped it, or you changed your mind) you can type C-]. Typing this inside \s-2JOVE\s0 while a process is running is the same as typing C-C when you are outside \s-2JOVE\s0, namely the process stops in a hurry. .LP When the command finishes, \s-2JOVE\s0 puts you back in the window in which you started. Then it prints a message indicating whether or not the command completed successfully in its (the command's) opinion. That is, if the command had what it considers an error (or you interrupt it with C-]) \s-2JOVE\s0 will print an appropriate message. .NH 2 Limitations of Non-Interactive Processes .XS \n(PN 5n \*(SN Limitations of Non-Interactive Processes .XE .LP The reason these are called non-interactive processes is that you can't type any input to them; you can't interact with them; they can't ask you questions because there is no way for you to answer. For example, you can't run a command interpreter (a shell), or .I mail or .I crypt with C-X ! because there is no way to provide it with input. Remember that \s-2JOVE\s0 (not the process in the window) is listening to your keyboard, and \s-2JOVE\s0 waits until the process dies before it looks at what you type. .LP C-X ! is useful for running commands that do some output and then exit. For example, it's very useful to use with the C compiler to catch compilation error messages (see Compiling C Programs), or with the \fIgrep\fP commands. .NH 2 Interactive Processes \(em Run a Shell in a Window .XS \n(PN 5n \*(SN Interactive Processes \(em Run a Shell in a Window .XE .LP Some versions of \s-2JOVE\s0\(dg .FS \(dg For example, the version provided with 4.3BSD. .FE have the capability of running interactive processes. This is more useful than non-interactive processes for certain types of jobs: .IP (i) You can go off and do some editing while the command is running. This is useful for commands that do sporadic output and run for fairly long periods of time. .IP (ii) Unlike non-interactive processes, you can type input to these. In addition, you can edit what you type with the power of all the \s-2JOVE\s0 commands \fIbefore\fP you send the input to the process. This is a really important feature, and is especially useful for running a shell in a window. .IP (iii) Because you can continue with normal editing while one of the processes is running, you can create a bunch of contexts and manage them (select them, delete them, or temporarily put them aside) with \s-2JOVE\s0's window and buffer mechanisms. .LP Although we may have given an image of processes being attached to .I windows, in fact they are attached to .I buffers. Therefore, once an \fIi-process\fP is running you can select another buffer into that window, or if you wish you can delete the window altogether. If you reselect that buffer later it will be up to date. That is, even though the buffer wasn't visible it was still receiving output from the process. You don't have to worry about missing anything when the buffer isn't visible. .NH 2 Advantages of Running Processes in \s-2JOVE\s0 Windows. .XS \n(PN 5n \*(SN Advantages of Running Processes in \s-2JOVE\s0 Windows. .XE .LP There are several advantages to running a shell in a window. What you type isn't seen immediately by the process; instead \s-2JOVE\s0 waits until you type an entire line before passing it on to the process to read. This means that before you type all of \s-2JOVE\s0's editing capabilities are available for fixing errors on your input line. If you discover an error at the beginning of the line, rather than erasing the whole line and starting over, you can simply move to the error, correct it, move back and continue typing. .LP Another feature is that you have the entire history of your session in a \s-2JOVE\s0 buffer. You don't have to worry about output from a command moving past the top of the screen. If you missed some output you can move back through it with ESC V and other commands. In addition, you can save yourself retyping a command (or a similar one) by sending edited versions of previous commands, or edit the output of one command to become a list of commands to be executed ("immediate shell scripts"). .NH 2 Differences between Normal and I-process Buffers .XS \n(PN 5n \*(SN Differences between Normal and I-process Buffers .XE .LP \s-2JOVE\s0 behaves differently in several ways when you are in an \fIi-process\fP buffer. Most obviously, does different things depending on both your position in the buffer and on the state of the process. In the normal case, when point is at the end of the buffer, Return does what you'd expect: it inserts a line-separator and then sends the line to the process. If you are somewhere else in the buffer, possibly positioned at a previous command that you want to edit, Return will place a copy of that line (with the prompt discarded if there is one) at the end of the buffer and move you there. Then you can edit the line and type Return as in the normal case. If the process has died for some reason, Return does nothing. It doesn't even insert itself. If that happens unexpectedly, you should type ESC X \fIlist-processes\fP to get a list of each process and its state. If your process died abnormally, \fIlist-processes\fP may help you figure out why. .NH 2 How to Run a Shell in a Window .XS \n(PN 5n \*(SN How to Run a Shell in a Window .XE .LP Type ESC X \fIshell\fP to start up a shell. As with C-X !, \s-2JOVE\s0 will create a buffer, called \fB*shell*\-1\fP, and select a window for this new buffer. But unlike C-X ! you will be left in the new window. Now, the shell process is said to be attached to \fBshell\-1\fP.