\begindata{text,538496936} \textdsversion{12} \template{help} \define{global } \chapter{Working with Multiple Files, \ Buffers and Windows in EZ} This help document assumes that you have read the introductory \helptopic{ez}\italic{ }help document and are familiar with basic EZ features of editing text, checkpointing, and saving files. This document has the following sections: \leftindent{About files, buffers and windows in EZ About working with multiple files, buffers and windows Using keybindings and menu options Working with windows Working with files Working with buffers Saving and Quitting Quick Reference Related Tools} \ \section{About files, buffers and windows in EZ} \leftindent{A \italic{\bold{file}} is any collection of information stored electronically on a computer. A file on Andrew can hold almost any kind of information: text documents, computer programs, pictures (rasters or drawings), graphs and tables, and so on. Anytime you use EZ to edit a file, EZ makes a copy of the stored file and puts it into a \italic{\bold{buffer}, }or temporary work space. As you make changes, you are actually changing only the copy in the buffer. The original file, from which the copy was made, remains untouched. The copy in the buffer is said to be "associated" with the original file from which it was copied. To incorporate the changes you have made to the buffer copy into the associated file, you "save" the contents of the buffer. \ Buffers are useful because they let you experiment with a copy of a file without necessarily changing the file itself. No matter what you do in the buffer, the file does not change until you save the buffer copy. You don't always have to save your changes back to the same file, either. You can save the changes you made into a new file by using \bold{Save As}. Or, you can delete a buffer altogether by using a command or by just not saving it at all--either way, the original file is unchanged. EZ uses\bold{ \italic{windows}} to show you the contents of buffers and to let you scroll and edit as you wish. There is normally one window for each buffer you are working with, and new users of EZ typically work with a single window/buffer pair. However, a one-to-one correspondence between windows and buffers is not required, and EZ also allows you to work with more than one window at the same time. The next section explains some ways you can work with multiple buffers (and by association, multiple files) at the same time.} \section{About working with multiple files, buffers and windows} \leftindent{Each time you start up EZ by typing "ez filename" in a command window such as typescript or xterm, you are starting a separate EZ \italic{\bold{process}, }and you could start a different process for each file you wanted to edit. But it is much more efficient to use a single EZ process to work with multiple files, because you use less computer memory compared with starting a separate process for each file. Using less memory for processes leaves more memory for doing other editing tasks. EZ allows you to open more than one window within the same process--see the section below on \bold{Working with Windows} to learn the procedure. This helps make it easy to work with more than one buffer (file) at a time, because you can look at a different buffer in each window, if you choose. There are two main ways to work with multiple files and buffers within a single process: \italic{switching} and \italic{visiting}. \ } \leftindent{When you \bold{\italic{switch}} between files, EZ asks you to specify which file you want to switch to. It creates a new copy of that file and puts it into the current buffer (the one in which you issued the Switch File command). The "switched-to" file overwrites the current contents of the buffer. Because the current contents would otherwise be lost, EZ prompts you to save them before it performs the switch file operation. Note that the Switch File command maintains the same number of buffers you had before. \ When you \italic{\bold{visit}} a file or buffer, in contrast, EZ does not overwrite the current buffer. Instead, it creates a new buffer for the copy of the file you want to visit. The current buffer (from which you issued the Visit File command) stays active, even if it is not visible in a window. Thus you have a different buffer for each file you visit. Because the current buffer is not overwritten, EZ does not prompt you to save before performing the visit file operation. \ } \leftindent{The actual chain of events in visiting is: if a buffer already exists that is associated with the file you want to visit, EZ shows you that buffer. If there is no such buffer, it creates a new buffer and puts a copy of the file into it. If there is no file by the name you specify, EZ creates a new empty buffer and will store its contents into a new file by that name when you save. }\leftindent{As this discussion suggests, visiting makes it possible to have more buffers active in a process than there are windows. If you are a beginning user, you may find it less confusing if you maintain the one buffer-one window relationship by switching rather than visiting. Later on, when you are more used to the idea of multiple buffers, you can edit several buffers in the same window without being confused by them. You can also learn about how to list all your buffers--including those not currently in windows--in the section below on \bold{Working with buffers}. \ } \section{Using keybindings and menu options} \leftindent{The functions you can learn about in sections below are available as keybindings (sequences of keystrokes), as menu options, or both. \ \bold{Using keybindings.} The key sequences bound to file, buffer and window manipulation functions are of two basic types, symbolized \bold{^X^}\bold{Key} and \bold{^X}\bold{key}. \bold{ Key }stands for a particular key, and \bold{^} stands for the "Control" key (\bold{Ctrl }on most keyboards). \ Here are basic instructions for the two kinds of key sequences. Note that \bold{^X} and\bold{ ^Key} are capitalized only because of convention; you do not have to use the Shift key when typing them. \ } \leftindent{\bold{To type a ^X^Key sequence:} \leftindent{\description{1) Press and hold the \bold{Ctrl} key. \ 2) Holding the \bold{Ctrl} key down, press and release the \bold{x} key. \ } \description{3) Still holding the \bold{Ctrl} key down, press and release the \bold{key} key. Release the \bold{Ctrl} key. }} \bold{To type a ^Xkey sequence:} \leftindent{\description{1) Press and hold the \bold{Ctrl} key. \ 2) Holding the \bold{Ctrl }key down, press and release the \bold{x} key. 3) Release the \bold{Ctrl }key. 4) Press and release the \bold{key} key. \ }}} \leftindent{\bold{Using menu options.} Normally, the functions available as menu options in EZ are \bold{Switch File} and\bold{ Save} on the front menu card, and \bold{Save As }and \bold{Save All }on the \italic{File }menu card. You can create two new menu cards in EZ--called \italic{Window} and \italic{Buffer--}by using\bold{ Copy }to add the following entries to your .ezinit file. If you do so, BE SURE to read the \helptopic{initfiles} help document (which will also tell you about what the various parts of the addmenu commands do). } \leftindent{addmenu frame-new-window "Window~15,Open New Window~10" addmenu frame-visit-file "Window~15,Visit File~20" addmenu frame-delete-window "Window~15,Delete This Window~30" addmenu frame-old-buffer "Buffer~20,Visit Buffer~10" addmenu frame-delete-buffer "Buffer~20,Delete Buffer~20" addmenu frame-list-buffers "Buffer~20,List All Buffers~30" }\leftindent{ The sections below explain what each option does. You could also add the following command, which combines opening a new window and visiting a file in it. } \ \leftindent{addmenu frame-visit-file-new-window "Window~15,Window & Visit~21" } \section{Working with windows} \leftindent{\bold{To open }}\leftindent{\bold{a second EZ window: }Move the mouse cursor into your EZ window. Then either \leftindent{a) Type \bold{^X2 }or \ b) Choose \bold{Open New Window} from the \italic{Window} menu card. } After a short pause, another EZ window opens. The second window contains the same text as the first--you are looking at one buffer with two windows. This can be useful for editing two remote sections of a large document, but keep in mind that any changes you make in one window also appear in the other window. \ Note that to see a different file in the second window you then have to use a Visit command, which places a new buffer in the second window. Because switching does not create a new buffer, if you switch files instead of visiting, the "switched-to" file will appear in both windows. \bold{ }\ You can open a new window and visit a file in it all in one step by choosing the \bold{Window & Visit }option on the \italic{Window} menu card, if you have added it. An added advantage of this option is that it helps you maintain the one buffer-one window relationship, which may be less confusing. } \leftindent{\bold{To remove a window: }To get rid of the extra window you have created, move the mouse cursor in the extra window. Then either \leftindent{a) Type \bold{^X^D} or b) Choose \bold{Delete This Window} from the \italic{Window} menu card, or \bold{Delete Window} from the front menu card. } The window disappears from the screen. However, the buffer that used to appear in that window is still active in your EZ process. \ } \section{Working with files} \leftindent{Whenever you visit or switch to a different file, EZ prompts you for the name of the file, providing a default pathname for you on the message line. If this is the first time you have done a Visit File or Switch File during this EZ process, the default pathname will be to the directory from which you started the EZ process. Otherwise, it will be to the directory you last visited or switched to. \bold{Completing prompts.} If the file you want to visit or switch to is in the default directory, all you have to do is type in the desired filename and press Enter. If the file is in another directory, however, you have to remove the default and type in the correct path. You can reduce the amount of backspacing and typing you have to do by using EZ's file completion pacakge. See the \italic{ }\leftindent{\helptopic{ez-command}} help file for more information. \bold{Canceling prompts.} You can abort an operation in the middle if you decide you do not want to complete it, by typing \bold{^G}. \bold{To switch files: }Move the mouse cursor into the window in which you want the "switched-to" file. Then either \leftindent{a) Choose \bold{Switch File }from the front menu card or b) Type \bold{^X^R.} }If you have not just saved your changes, you will be prompted to save them. A "Switch File:" prompt appears on the message line, followed by a pathname. Complete the prompt and press Enter. In a moment, the contents of a different buffer appear in the window. Remember that Switch File always makes a new copy of the file. Even if you had previously worked on the file you now want to switch to, and it is still active in a buffer, using Switch File will create a new copy. You can see the changed version in the buffer by using Visit File instead of Switch File. To reduce confusion about which version of a file you are working on, it is recommended that you save before both visiting and switching. \ \bold{To visit a file: }Move the mouse cursor into the window in which you want to visit. Then either \leftindent{a) Type \bold{^X^V }or \ b) Choose \bold{Visit File }from the \italic{Window} menu card. }\leftindent{ }A "Visit File:" prompt appears on the message line, followed by a pathname. Complete the prompt and press Enter. In moment the contents of a different buffer appear in the window. EZ does not prompt you to save your changes as with Switch File, because Visit File does not overwrite the buffer currently in the window. The current buffer remains active, even though it is not in a window. \ }\section{Working with buffers} \leftindent{Working with buffers is similar to working with files. The main difference is that it is possible to create new empty buffers that are not associated with files (whereas working with files always associates a buffer and a file). Therefore, you cannot switch to buffers, as you can with files. Switching always means making a new copy of a file, and not all buffers are associated with files. Another difference is that you do not type complete pathnames when working with buffers, since many of them have no associated files. You can, however, use the command completion functions discussed above for files, to complete buffer names. \ } \leftindent{\bold{To create a buffer: }To create a new empty buffer when already in an EZ process, move the mouse cursor into the EZ window and t\leftindent{ype \ \bold{^Xb}. }You are prompted on the message line \leftindent{Visit buffer \italic{[Scratch]}:} Type the name of the buffer you want to create. After a moment, a new empty buffer appears in your window. (Note that the \italic{[Scratch]} choice only appears if you already have more than one active buffer in your EZ process. As you can learn below, you can also use ^Xb to visit an existing buffer.) This new buffer is not associated with a file. See the section below on \bold{Saving and Quitting} to learn how to save it into a file. You can also type \bold{^X^V} or choose \bold{Visit File} from the \italic{Window} menu card to create a new buffer. The difference from ^Xb is that ^X^V creates an associated file along with the new empty buffer, in one step, as long as you type a name for which no file exists already. See the section above on visiting files. \ \bold{To visit an existing buffer: }To visit an existing buffer, the most appropriate method is to either \leftindent{a) Type \bold{^X^O} or \ b) Choose \bold{Visit Buffer} from the \italic{Buffer} menu card. } EZ prompts you on the message line: \leftindent{Visit existing buffer [\italic{default}]:} where \italic{default }is usually the name of the buffer you last looked at. To visit \italic{default}, press Enter. To visit a different existing buffer, type its name and press Enter. If no bracketed default appears, there are no buffers besides the one you are now in, so you cannot visit them. Follow the instructions above for creating new buffers if necessary. You can also type \bold{^Xb }to visit a buffer. The difference from ^X^O is that ^Xb will create a new buffer if you type the name of a buffer that does not exist. See the section just above on creating buffers to learn how to respond to ^Xb's prompt. You can also type \bold{^X^V} or choose \bold{Visit File} from the \italic{Window} menu card to visit a buffer. The difference from ^X^O is that ^X^V will create a new buffer and an associated file if you type the name of a buffer that does not exist. See the section above on visiting files. \ } \leftindent{\bold{To delete buffers: }To delete a buffer from the EZ process, either \leftindent{a) Type \bold{^Xk} or b) Choose \bold{Delete Buffer} from the \italic{Buffer} menu card. \ }You are prompted on the message line \leftindent{Delete buffer [\italic{default}]:} where \italic{default} is usually the name of buffer currently in the window. Press Enter to delete \italic{default}, or type the name of a different buffer before pressing Enter. If the buffer has been modified (has unsaved changes), you will be prompted to save them. EZ then deletes the buffer and replaces it in the window with the buffer you visited most recently. If there is no other existing buffer in the process, EZ informs you on the message line that it cannot delete the buffer as requested. \ } \leftindent{\bold{To list buffers: }You can check the status and number of all your buffers by listing them. Either \leftindent{a) Type \bold{^X^B} or b) Choose \bold{List All Buffers} from the \italic{Buffer} menu card. }\leftindent{ }EZ replaces the current buffer temporarily with a special Help Buffer that lists all your active buffers. It looks something like this: \leftindent{\typewriter{Current buffers: \underline{Name} \underline{Size} \underline{Sav} \underline{Object} \underline{File} Help-Buffer-1 0 Mod text filename1 145 Mod text /afs/andrew/usr filename2 240 text /afs/andrew/usr} } The first column lists all of the buffers in the process, under "Current Buffers:". Note that the Help Buffer itself is at the top of the list. \ The second column tells how many characters are in the buffer. The third column tells the status of the file. The Help Buffer is "modified" because EZ put the current buffer information into it. The buffer called \italic{filename2} has been saved recently, so nothing is listed for its status. The buffer containing \italic{filename1} has been modified (something has been typed into it). The fourth column tells you the object that is in the buffer. The fifth lists the pathnames of the files associated with the buffers. The Help Buffer does not have a pathname listed because it will not be saved into a file. Buffer3 does not have a pathname because it was created as a new buffer and has not yet been saved into a file. To return to the buffer that was in the window before, press Enter or click in the window. \bold{Note:} It is easy to confuse the command \bold{^X^B} (list buffers) with \bold{^Xb} (Visit buffer). If you mistype the keys for listing buffers and see the "Visit buffer:" prompt instead, type \bold{^G} to cancel the prompt, then re-try \bold{^X^B}. } \section{Saving and Quitting} \leftindent{As you recall, any time you edit a file, EZ creates a copy of the file and puts the copy into a buffer. Only the buffer changes as you edit, until you save the buffer into its associated file. \ } \leftindent{\bold{To save a buffer into its associated file:} \leftindent{ a) Choose \bold{Save} from the front menu card or b) Type \bold{^X^S}. } EZ saves the current buffer into the associated file, overwriting whatever was in the associated file. You can continue to work in the buffer, but you will have to choose \bold{Save} again to put any more changes into the file. \bold{To save a buffer that has no associated file: }While you are in the window displaying the buffer, either \leftindent{ a) Choose \bold{Save As} from the \italic{File }menu card or b) Type \bold{^X^W}. } EZ prompts you on the message line with "Write to file:" followed by a pathname. Change the pathname if you wish (you must be able to create files in that directory) and type in a filename for the buffer. EZ creates a file by that name and saves the buffer into it. The buffer also takes that name. \ \bold{To save a buffer into a different associated file: }To change the name of the file (and path, for that matter) associated with a buffer, either \leftindent{a) Choose \bold{Save As} from the \italic{File }menu card or b) Type \bold{^X^W}. } and then type in a different filename (or pathname and filename). \bold{Note: } When using \bold{Save As}, remember to choose a name different from any existing file, or you will overwrite the file with that name. \bold{To save all modified buffers: }To save all buffers that have associated files and have been modified or checkpointed, either \leftindent{ a) Choose \bold{Save All }from the \italic{File} menu card or b) Type \bold{^X^M}. } All buffers that have associated files, and have been modified or checkpointed, will be saved. EZ cannot save buffers without associated files when you choose \bold{Save All}, but it does warn you that such buffers exist with a message on the message line. Visit such buffers individually and choose\bold{ Save As} to save them. \bold{To quit EZ:}}\leftindent{ To leave the EZ process, shutting down all windows and buffers you have opened, choose \bold{Quit} from the front menu card. If there are modified buffers with associated files, you are prompted to save the changes.}\leftindent{ Note that EZ does not warn you about the existence of buffers without associated files, which are lost when you quit. }\leftindent{\leftindent{\ }} \section{Quick Reference} \leftindent{For your convenience, all the functions discussed above are listed here with their keybindings and menu options. "Current window" means the window in which the mouse cursor is placed.} \leftindent{\bold{Window operations:} ^X2 Open New Window Divides current EZ window into two windows. ^X^D Delete This Window Closes the current window. \bold{File operations:} ^X^R Switch File Switches to file you name. \ ^X^V Visit File Visits file you name. \bold{Buffer operations:} ^Xb Creates a new buffer; or visits existing buffer. \ ^X^O Visit Existing Buffer Visits an existing buffer. ^Xk Delete Buffer Deletes the buffer you name. ^X^B List All Buffers Lists all active buffers. \ \bold{Save operations:} ^X^S Save Saves buffer into associated file. \ ^X^W Save As Saves the buffer into a file with a name you specify. \ ^X^M Save All Saves all modified buffers into associated files. } \leftindent{See the \helptopic{ez-keys} help document for a listing of additional keybindings that allow movement of the text caret, scrolling of text and other functions. \ } \section{Related Tools} Select (highlight) one of the italicized names and choose Show Help on Selected Word from the pop-up menu to see the help document for: \leftindent{\helptopic{ez} \helptopic{ez-command} \helptopic{ez-keys}} \begindata{bp,538526464} \enddata{bp,538526464} \view{bpv,538526464,1,0,0} Copyright 1992 Carnegie Mellon University and IBM. All rights reserved. \smaller{\smaller{$Disclaimer: Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice, this permission notice, and the following disclaimer appear in supporting documentation, and that the names of IBM, Carnegie Mellon University, and other copyright holders, not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. $ }}\enddata{text,538496936}