<> <> <> <> <> <> <> <> <> <> <<>> EXECHACKS CEDAR 6.1  FOR INTERNAL XEROX USE ONLY ExecHacks Michael Plass © Copyright 1985 Xerox Corporation. All rights reserved. Abstract: ExecHacks adds some handy menu buttons to CommandTool viewers: "DoIt" and "Redo". "DoIt" deduces a filename from the selection, and depending on the extension executes some interesting command: for .Mesa files, it compiles; for .DF files it SModels and VerifiesDF, etc. "Redo" performs two functions. Left-clicking or middle-clicking "Redo" will replay the command currently pointed to. Right-clicking "Redo" will list the last 10 commands issued to the CommandTool, with duplicates removed. ExecHacks also registers two commands. "Redo " re-executes the most recent command beginning with "". "History -d 10" does the same thing as right buttoning "Redo". Finally, ExecHacks modifies the "Save" button on tioga viewers, so that right-clicking Save will save the file and DoIt, depending on the extension of the file. Keywords: DoIt, Redo, History, DWIM, Compile, SModel, VerifyDF, Copy, Command File, User Profile, Save Button, EditorComforts, Icons XEROX Xerox Corporation Palo Alto Research Center 3333 Coyote Hill Road Palo Alto, California 94304 For Internal Xerox Use Only ExecHacks ExecHacks adds some handy menu buttons to CommandTool viewers: DoIt and Redo. DoIt Buttons A DoIt button deduces a filename from the selection, and depending on the extension executes some interesting command: for .mesa files, it compiles; for .df files it SModels and VerifiesDF; .cm or .load files are simply invoked; and so on. The action perfomed is actually determined by user profile entries, and can be extended by the user. The association given above is from the defaults, which are given below. The DoIt operation is purely textual, and the command is executed in the current working directory of the command tool, which may be different from the directory containing the file, so watch your directories. When a DoIt button labeled DoThis operation is invoked on a file with extension foo, ExecHacks looks for a user profile entry ExecHacks.DoThis.foo (if not found it will look for ExecHacks.For.foo for historical compatibility), or ExecHacks.DoThisNoExtension (plus ExecHacks.ForNoExtension for historical compatibility) if the filename has no extension. The command to be executed is derived from the entry by replacing every occurrence of the a string of the form "" by the appropriate part of the filename. The recognized fields are: `server', `dir', `subDirs', `base', `ext', `ver', `directory', `short' and `fileName'. The `fileName' field means the whole filename, in IFS "brackety" syntax, including version, if present. The others are the result of parsing the filename as "[Server]SubDirs>Base.Ext!Ver" or as "DirectoryShort!Ver". Redo Button Redo performs two functions on the history of commands in a CommandTool typescript. Left-clicking or middle-clicking Redo will replay the command(s) currently contained in the current selection. If the selection is at the end of the CommandTool viewer or in another viewer, then the most recently issued command is executed. Right-clicking Redo will list the last 10 commands issued to the CommandTool, with duplicates removed. These can then be executed by selecting one or more of them and left-clicking Redo. Initiating ExecHacks To use ExecHacks, add the command ExecHacks to the CommandTool.PerLogin and CommandTool.PerCommandTool entries in your profile. The ExecHacks command affects only the command tool it is invoked from. Redo and History Commands ExecHacks also implements a UNIX-like redo. Issuing the command % Redo fo (in a command tool that has been hacked by ExecHacks) causes the most recent command whose name (excluding directory part) begins with "fo". The command % History -d 47 prints out the last 47 commands; if the number is omitted, 10 is used. The -d means to suppress duplicates. Also, a -% switch would suppress printing the prompt before each command. This is useful for building command files from history. SaveAndDoIt When the SaveAndDoIt feature is enabled, right-clicking Save will save the file, look for a CommandTool in the same directory as the file, and DoIt (accordingly to the extension) in that CommandTool. The screen will blink if it is not possible to DoIt. No attention is paid whether the CommandTool is currently active, or iconic, or both: in all cases the action is logged in the CommandTool queue. Note that SaveAndDoIt will execute the first button in your DoIt button list. The SaveAndDoIt feature leaves unchanged the left and middle Save, so people wanting to use both EditorComforts and the SaveAndDoIt saving features should in sequence left-click and right-Click Save, and a middle click still only executes vanilla Save. Icon Mapping ExecHacks also will automatically select an icon shape for newly created (or edited or saved) files, based on the extension of the file, and whether the viewer is considered to be edited or not. The icons to be used must have been registered with IconRegistry. The icon to be used will be the first of the following: 1) The icon specified by the profile entry "ExecHacks.Icon.extension". (It will also check for "ExecHacks.DirtyIcon.extension" first if the viewer is edited.) 2) If the icon "extension" is registered (and "Dirtyextension" if ...), then it will use that one. 3) The icon specified by the profile entry "ExecHacks.DefaultIcon". (It will also check for "ExecHacks.DirtyDefaultIcon" first if the viewer is edited.) 4) Whatever the client code which created the viewer requested. The following profile entry may by added to your profile to get one such mapping. (N.B. If you use Remember or another package which uses IconRegistry, you may need to fold these in as additions.) RegisteredIcons: " Mesa: ///Commands/ExecHacks.icons 0 DirtyMesa: ///Commands/ExecHacks.icons 1 Tioga: ///Commands/ExecHacks.icons 2 DirtyTioga: ///Commands/ExecHacks.icons 3 Df: ///Commands/ExecHacks.icons 4 DirtyDf: ///Commands/ExecHacks.icons 5 Config: ///Commands/ExecHacks.icons 6 DirtyConfig: ///Commands/ExecHacks.icons 7 Errlog: ///Commands/ExecHacks.icons 8 DirtyErrlog: ///Commands/ExecHacks.icons 9 " User Profile Entries ExecHacks.DoitButtonName: LIST OF ROPE _ LIST["DoIt"] <> ExecHacks.RedoButtonName: ROPE _ "Redo" <> ExecHacks.ButtonName.Mesa: ROPE _ "RCompile " ExecHacks.ButtonName.Cedar: ROPE _ "RCompile " ExecHacks.ButtonName.Config: ROPE _ "Bind " ExecHacks.ButtonName.cm: ROPE _ "" ExecHacks.ButtonName.load: ROPE _ "" ExecHacks.ButtonName.DF: ROPE _ "SModel ;\nVerifyDF " ExecHacks.ButtonName.BCD: ROPE _ "Run " ExecHacks.ButtonName.Profile: ROPE _ "Copy [User]<>6.1> _ ///.profile" ExecHacks.ButtonName.*: ROPE _ "Blink" < is the base part of the selected file name ., when the button with the name ButtonName is executed.>> ExecHacks.ButtonNameNoExtension: ROPE _ "RCompile " <> ExecHacks.SaveAndDoIt: BOOL _ TRUE <> ExecHacks.DirtyIcon.extension: ROPE _ IconName ExecHacks.Icon.extension: ROPE _ IconName ExecHacks.DefaultDirtyIcon: ROPE _ IconName ExecHacks.DefaultIcon: ROPE _ IconName