TIPS FOR WORKING QUICKLY WITH PREDITOR/2 2.0 ___________________ PREDITOR/2 is packed with handy features designed to increase your productivity. Here are some tips that the product's developers find most useful when working with the editor. ___________________ Quick Loading The initial loading of PREDITOR/2 may be slowed down if you store too many options in the CPE.CFG file. Therefore, use the LOCAL.PEL file to indicate options that are not likely to change often. Online Examples To learn more about configuring the CPE.CFG file, refer to the EXAMPLE.CFG file in the CPE directory. (By default, this directory is C:\CPE.) Set Variables in the CPE.CFG File Rather than changing the notebook settings each time you change your work environments, you can create multiple CPE.CFG files (with different names) pertaining to each environment. Edit the CPE.CFG file directly to set variables. Once the CPE.CFG file contains the variable settings you want to use as your defaults, create a back-up copy so that you don't have to re-set your variables if you happen to lose the file. Before Debugging To debug PEL functions, you must first compile the .AE file without the -compress option. Make this change by editing the MAKE_AE.CMD file in your PEL subdirectory. Then rename the file CPE.AE to CPE.BAK and recompile the function library by running MAKE_AE.CMD. Command and File Name Expansion To expand a partial command or file name from the Command or File prompt, press the tab key. If there is one matching name, it is displayed at the prompt. If there are multiple matching names, a dialog box is displayed listing possible matches you can select . Open File Under Cursor Quickly open a referenced file by executing the Open file under cursor command from the File menu. When you select Open file under cursor, the selected file is opened into a new buffer. Note: You can achieve the same results by executing the open_file_under_cursor command from the command dialog box. Scroll Context To increase the performance of scrolling when using the keyboard, set your Scroll context variables on the Scroll vars page of the Windows settings notebook. Buffer Filter The Buffer filter item on the Windows menu enables you to move quickly between your loaded files. When you select Buffer filter, a dialog box is displayed. Enter the type of file (for example *.pel) that you want to filter through. You can then use the Next buffer and Previous buffer commands to move through your currently loaded files of that type. Managing Swap File Size It is possible for your swap file to become uncommonly large, especially after performing large search and replace operations. To keep your swap file at a reasonable size, occasionally save your work. This is good practice, and clears all "undo" information out of the swap file. History Lists 1. Press UpArrow to scroll through history lists of search strings, file names, or commands in the Search, Command, and Edit File dialog boxes. 2. Press PageUp to scroll through history lists in Search, Command, and Edit File dialog boxes (in all emulations other than CUA). Tags File A tags file is a data file that lists identifiers (function names, variables, etc.) with information on where each is defined in the source code. Create tags files to help you quickly find information in your source code. Once your tags file is built, you can use the tags() and tags_auto() functions to retrieve the appropriate source file and position the cursor at the definition. The tags() function prompts for a symbol to locate and the tags_auto() function locates the symbol under the cursor. When you run ctags_make(), it will report the date that the tags file was last updated, and will prompt you for the extensions of the files you wish to parse. It only works on the files in the editor's current directory, so you should use the 'chdir' command to change to the directory containing your source files. After creating tags files in your project directories, you can search them all by setting the 'Tags path' item on the Directories page of the settings notebook to contain the list of directories to search for tags files. Use the Error File The Error file item on the File menu enables you to view errors found after compiling, that were redirected to a file. Simply enter information in the dialog boxes presented by the Error file command to indicate the file name and compiler you are using. The Error file generates a list box specific to this information, from which you can double-click on a listed error to open a file with the cursor located on that error. Quickly Scanning Dialog Items The PREDITOR/2 toolbar provides the ERR buttons to enable you to more quickly flip through a list of matching search strings or compile errors with the List dialog box minimized. The ERR buttons are located near the right end of the toolbar. When you have completed a search and the results are presented in the Find All List dialog box or a compile with the results in a compile list dialog box, 1. Minimize the List dialog box by clicking on the upper right corner of the dialog box. 2. Click on the ERR buttons to move forward and backward through the results list. Your cursor will automatically move to the next occurrence found by the search process. Context-Sensitive Search Use the pop-up menu for a quick, context-sensitive search. Within the buffer you are searching, simply move the cursor to the word you are searching for, press and release the right mouse button, and select the Find String menu item from the pop-up menu that appears. Incremental Find The Incremental find function enables you to follow the progress of the search as you enter a search pattern. For example, if you are searching for the pattern 'apple', the editor finds the first occurrence of 'a' when you type 'a', then it finds the first occurence of 'ap' when you typed 'p' and so on until you have typed the entire pattern. You can access incremental find from the Search menu on the menu bar. The letters you enter appear on the Status bar. If your status bar is toggled off, it is automatically toggled on for the incremental find process. Use the Esc key to end the Incremental find command. Context-Sensitive Help for Editor Commands Press F1 at the command prompt to receive context-sensitive help on the command name you have entered. Wrap Paragraph Function Paragraphs are delimited by empty lines. The wrap_paragraph command reflows a paragraph at the margins. This is useful when editing a text file that has different margins than those you have specified. The wrap_paragraph command operates from the current cursor position to the next empty line or on the current selection. Note: Before you execute wrap_paragraph, your text should be aligned at the left margin. It is often handy to reformat a paragraph after making changes that don't cause an automatic update. By assigning a key to the function wrap_paragraph(), you can press that key to reformat the current paragraph from the cursor position to the end of the paragraph. If you highlight one or more paragraphs and press the key assigned to the wrap_paragraph() function, all of the highlighted text is reformatted while paragraph boundaries are honored. It is also handy to quickly reformat a paragraph using margin settings other than your standard settings. For example, you might want to indent a list or chart. To do this, move the block to the desired left margin then highlight the paragraph with a column block, starting and ending at your desired margins, and execute the wrap_paragraph() function. Enabling PVCS To enable PVCS, simply toggle it on by typing "PVCS" in the command dialog box (or at the status bar prompt). Toggle PVCS off by entering the same command. Comparing without PVCS or Vdiff If you do not have PVCS or Vdiff, you can still compare two versions of a file with the compare_buffers() and compare_windows() functions. With these functions, you do not have to compare entire files. In some cases, this characteristic makes compare_buffers() and compare_windows() a quicker alternative than using Vdiff. 1. Compare Buffers To use the compare_buffers() function, simply load both files into consecutive buffers, place the cursor in each buffer at the position where you would like to start the comparison, and call the compare_buffers() function from the command line. Note: When calling compare_buffers(), make sure you are in the first of the two buffers in the list, as compare_buffers() simply compares the current and next buffers, starting at their respective cursor positions. When the editor finds a difference, the cursor position in both buffers is updated to that location. Cycling between buffers enables you to see the differences between the two. If you wish to continue comparing the buffers' remaining content, move the cursor in each buffer to a new location and call the compare_buffers() function again. If no differences are found, the cursors are positioned at the end of the buffers. 2. Compare Windows The compare_windows() function is a more visual version of the compare_buffers() function. You must have two and only two windows open, with the buffers to compare displayed in the windows. The easiest approach to using this function is to: --load the files into buffers --position the cursors --choose Windows/Split vertical (or horizontal) --call compare_windows() Because both buffers are visible, you can view the differences side-by-side. Otherwise, the functionality is the same as the compare_buffers() function. Create Windows When in MDI mode, create a new window by simply pressing the left mouse button in the main editor window, dragging the mouse to a diagonal location and releasing the left mouse button. Minimize_and_Save Rather than exiting the editor and restarting each time you want to edit a file, call the minimize_and_save() function to save all your open buffers and minimize the editor. The editor appears to be closed but is running in the background. Users who habitually exit the editor rather than minimizing frequently assign the minimize_and_save() function to the "Quit" key in the emulations they use. Prompts on the Status Bar To receive command prompts from the status bar (rather than a the Command dialog box), select the "Prompts" option on the Editor Settings notebook Status bar page. With the prompts "on," you can press the F10 key and the command prompt appears on your status bar. Note: This features is accessible in all emulations but CUA. Enabling Template Expansion Templates are programming constructs you can expand from an abbreviated keyword, and are specific to a programming language. By default, PREDITOR/2's templates are disabled. To enable template expansion, 1. Click on the Tools menu on the menu bar. 2. Click on the Command dialog menu item. 3. Type ec in the text box and click on the OK button. (The command ec toggles the template on and off.) The status bar displays the state of template expansion. 4. Type the abbreviated keyword and press the space bar. The construct corresponding to the keyword is displayed after the cursor. Many templates contain fields. After expansion, press the Ctrl-Enter key to select the next field in the current buffer. By default, the Expand Template key is Space and the Next Field key is Ctrl+Enter. You can change these by modifying ELECTRIC.PEL around line 77 (search for the string DEFAULT_) and recompiling. Determining Key Assignments To determine what function is assigned to a key (or keys), use the print_bindings command. After running print_bindings, any key (or key combination) that you type will display the assigned function on the status bar. Press the escape key to end the print_bindings command. To receive a list of all assigned keys, execute the list_keymap command. Two optional parameters to the list_keymap command are 'pel' and 'cfg' which display the output in PEL or config file format respectively. Useful Functions to Assign to Keys tags tags_auto peltags peltags_auto mark_matching mark_matching_next goto_matching outdent_tab_maybe indent_tab_maybe upper lower outdent_columns indent_columns search_again goto_bookmark 1-9 minimize_and_save