ARPUS/ce, Version 2.6.2 (03/10/05) (SCCS 1.6) _______________________________________________________________________________ alias <name> [ [<alias_definition>] ke ] "alias definition" DESCRIPTION: 'alias' is used to set, display, or erase an alias definition for a pseudo command name. The three forms of the 'alias' command are as follows: alias <name> Display in ce's output window the definition currently assigned to the specified alias. alias <name> <def> ke Alias name to be <def>. <def> can be a list of commands, may contain prompts, and may contain positional parameters to be substituted in later. <def> is parsed when the alias is executed. alias <name> ke Erase any definition associated with name. <name> is a 1 to 8 character alias name composed of all alphabetic characters. It must not be the same as any builtin Ce command. <def> is a string of Ce commands separated by semicolons. It is parsed in exactly the same way as a kd (key definition) command. It may contain prompts just like key definitions. In addition, it may contain positional symbolic parameters ($1, $2, etc.) which will be substituted in when the alias is invoked. That is $1 refers to the first word following the alias command, $2 refers to the second word, and so forth. In addition, the constructs $* and $@ are supported. The $* construct resolves during alias expansion to all the supplied arguments with a space between each argument. The $@ construct resolves to all the supplied arguments with a set of double quotes (") around each argument and a space between each argument. Alias'ed names may be used in key definitions. However, the alias must already be defined and the alias is expanded during the processing of the key definition. Thus, aliases which use symbolic substitution need to have their parameters specified within the key definition. EXAMPLES: alias help cv $HELPDIR/$1.hlp ke The above alias creates a command named help which opens a cv window on the help file named as the first and only argument to the command. alias quit wc -q ke The above alias creates a command named quit which closes the a ce session without saving any changes. alias esif es 'if ()';tr;en;tl;[-1,];tr;[+1,-5]; es 'else';tr;en;tl;[-2,];tr;en;tl;[+1,];tr;[-1,-1]; es '{';tr;en;tl;tr;en;tl;[-2,];tr;[+2,-1]; es '}';tr;[+2,-1]; es '{';tr;en;tl;tr;en;tl;[-2,];tr;[+2,-1]; es '}';[-7,]; ke The above alias creates an alias named esif which creates a skeleton "if then else" sequence in the C programming language. kd ^3 help commands ke The above key definition sets the <ctrl>-3 key combination to run the help alias on the help for the list of Ce commands. Note that the help alias is converted to it's list of Ce commands at the time the key definition is parsed. If it is necessary to delay evaluation of the alias, you could code: kd ^3 xl -l tmp "help commands";cmdf -p tmp ke This example puts the text "help commands" into a temporary paste buffer and then uses cmdf to run the paste buffer. As you can see, you can use aliases in command files. Using a prompt in the key definition will also delay expansion of the alias to its Ce commands until the key definition is executed. kd ^3 help &'CMD? ' ke The above key definition keeps behaves in this way. You can check whether the alias has been expanded using the 'kd' command with just the key specification as the only argument. This displays the definition in the message window. alias ispell ro -off;pw;pn;tdmo;tl;dr;tr;xc -l file;tdm;tl;xd -l junk;icon -i;es'cpo -w "ceterm -geo c80x24 -autoclose y -vt on -w \\\'ispell ';xp file;tr;es'\\\'"';en;tmw;1,$xd -l junk;xd -l junk;tdm;es'xp -f ';xp file;tr;en;icon -w ke The above alias runs the ispell command (which is available on the Internet) over the data in a ceterm window and replaces the file being edited with the spell checked data. In English this alias reads: ro -off; Make sure we are in read/write mode pw; Write the file to disk pn; Put the filename in the message window tdmo; Move cursor to message window tl; Move cursor to col 1 in message window dr; Set a mark tr; Move cursor to end of line xc -l file; copy file name to local paste buffer tdm; Move cursor to "Command:" input window tl; Move cursor to col 1 in "Command:" window xd -l junk; Delete anything currently there. icon -i; Icon the ce window es'cpo -w "ceterm -geo c80x24 -autoclose y -vt on -w \\\'ispell '; Logically enter the above string in the "Command:" window. Note the extra '\'s are eaten during keydef processing. In Aegis regular expression mode use '@'. xp file; Paste the file name into the line tr; Move cursor past the file name es'\\\'"'; Put in the closing quote for the 'cpo' command. en; Press enter. tmw; Logically move the cursor to the edit window. 1,$xd -l junk; Throw away the contents of the file xd -l junk; Empty the paste buffer to save memory. tdm; Logically move cursor to the "Command:" window es'xp -f '; Logically type a paste file command xp file; Put in the file name. tr; Move past the file name. en; Press enter icon -w Un-icon the edit window. In the above case, the icon'ing of the file is for more than aesthetic purposes. Since the 'cpo' command is running in wait mode (-w), the window will be frozen while the ispell is running and not accepting X events. On many machines, if enough X events pile up in the X servers queue for a window without any being read, the server decides the application is hung and kills it. Icon'ing the window avoids this. RELATED HELP FILES: kd (Key Definition) (Prompt) cpo (Create Process Only) commands (List of Commands) Cekeys (Key definition file) mi (Menu Item) keyCon (Key Concepts) support (customer support) _______________________________________________________________________________ Copyright (c) 2005, Robert Styma Consulting. All rights reserved.