The Landing
"Just the place for a Snark!" the Bellman cried,
As he landed his crew with care;
Supporting each man on the top of the tide
By a finger entwined in his hair.
"Just the place for a Snark! I have said it twice:
That alone should encourage the crew.
Just the place for a Snark! I have said it thrice:
What i tell you three times is true."
You can extend Jabberwocky in two ways:
If you want to extend the functions avaialble in the JABBERWOCKY package, you have to modify the "seed.lisp" file in the source directory (the directory where you have expanded the jabberwocky.x.y.tgz file). Start then Jabberwocky (I assume that it is already installed) and run <Options><Generate Lisp Binding>. This will create a file "jabberwocky.lisp" which will contain the functions in "seed.lisp" together with a lisp function for each action and constants associated with the java keycodes and java keymasks needed to create key sequences. You should then rerun 'install' so that the new functionality is copied to the installation directory.
When Jabberwocky starts a interaction window it will search for a lisp file to be load automatically once the interaction buffer is initialized. You can place your own code calling code in the JABBERWOCKY package to extend the functionality of Jabberwocky via LISP code. To specify the location file, just use <Options><Lisp Startup Script> and specify the location of startup file.
For a definition and explanation of the functions in the JABBERWOCKY package to call Jabberwocky actions see Actions and JABBERWOCKY:: functions. All these function should be called with no argument.
For a description of the constant I refer to the Java documentation, although most constants speaks for themself. For example **vk-a** maps to the java constant KeyEvent.VK_A and refers to the 'A' key on the keyboard, **ctrl-mask** maps to KeyEvent.CTRL_MASK and represents the pressing of the <ctrl> key while pressing another character.
The remaining functions are described in the following table. Be aware that because this is a alpha version, the list of functions is incomplete and will change considerable in the nearby future (hopefully only additions are needed).
function | Call syntax | Explanation |
add-action-to-menu | (add-action-to-menu mode action menu) | mode is a string representing the mode where you want to make the binding, action is a string representing the name of the action with a menu, menu is a string representing the menu where the action is bound to. A menu is string of the form "'topmenu'/'submenu'/..../'menupoint'" and add-action-to-menu will bind the action to this menu in the given mode. |
add-action-to-popup-menu | (add-action-to-popup-menu mode action menu) | mode is a string representing the mode where you want to make the binding, action is a string representing the name of the action with a menu, menu is a string representing the menu where the action is bound to. A menu is string of the form "'topmenu'/'submenu'/..../'menupoint'" (if menu is "" then the action will be in the root of the popup menu). add-action-to-menu will bind the action to this menu in the given mode. |
add-button | (add-button mode action) | mode is the name of a mode and action is the name of a action. add-button will add button to the toolbar in the given mode which will activate the action when pressed. |
add-checkbox-to-menu | (add-checkbox-to-menu mode action menu enabled) | mode is a string representing the mode where you want to make the binding, action is a string representing the name of the action with a menu, menu is a string representing the menu where the action is bound to and enabled is boolean (t or nil) which tells if the checkbox must be enabled initially. A menu is string of the form "'topmenu'/'submenu'/..../'menupoint'" and add-checkbox-to-menu will bind the action to this menu in the given mode as a checkbox. |
add-separator-to-menu | (add-separator-to-menu mode menu) | mode is a string representing the mode where you want to make the binding, menu is a string representing the menu where you want a separator to. add-separator-to-menu adds a separator to the menu menu in the mode mode. |
add-separator-to-popup-menu | (add-separator-to-popup-menu mode menu) | mode is a string representing the mode where you want to make the binding, menu is a string representing the menu where you want a separator to. add-separator-to-popup-menu adds a separator to the popup menu menu in the mode mode. |
ask-number-question | (ask-number-question guidetext callback) | guidetext is a string containing the guide text of the question asked via the Input Area, callback is a lisp function with one argument which can be assumed to be a integer. ask-number-question will let Jabberwocky ask for a number and calls callback with the answer as its argument. |
ask-string-question | (ask-string-question guidetext callback) | guidetext is a string containing the guide text of the question asked via the Input Area, callback is a lisp function with one argument which can be assumed to be a string. ask-string-question will let Jabberwocky ask for a string and calls callback with the answer as its argument. |
bind-action-to-key-sequence | (bind-action-to-key-sequence mode action keysequence) | mode is the name of a mode, action is the name of a action and keysequence is java object representing a key sequence make via creat-key-sequence. bind-action-to-key-sequence will bind the action with name action to the keysequence in the mode with name mode. |
create-action | (create-action name short long function &optional icon) | name is a string representing the name of the new action, short is a string representing a short description of the action, long is a string representing a long description of the action, icon represents a Java ImageIcon object created by create-icon and function is a lisp function with no arguments representing the functionality of the action. With create-action you can create a Jabberwocky action with name name that will execute function when activated. |
create-editor | (create-editor &optional filename) | filename is a string representing a file, if filename is omitted a empty editor buffer is created, otherwise a editor buffer is created and the file pointed to by filename is loaded. Returns the editor buffer created |
create-key-sequence | (create-key-sequence &rest keys) | keys are a even number of arguments of the form 'key modifiers ... ' where key is a fixnum representing a java key code and modifiers is a fixnum representing a combination (via binary or) of java key masks. create-key-sequence returns a java object that represents thiskey sequence. |
create-icon | (create-icon filename) | filename is a string which is the filename for a file containing image data to create a icon of. All images formats which can be used be the java ImageIcon constructor are supported. |
copy-mode | (copy-mode mode name) | mode is a string representing the source mode, name is the name of the mode to create that contains the contents of the mode with name mode. A mode is a name collection of menus (and their action bindings), keybindings to a action and popupmenus bindings to a action. With copy-mode you can create your own mode with name name based on a existing mode with name mode. The current modes defined in Jabberwocky are "root" (the root of all the nodes), "basic" (the mode used by a normal edit buffer) and "debug" (the mode used when a editor buffer is in debug mode). |
execute-action | (execute-action action-name) | action-name is a string representing the name of a action. execute-action will execute the named action. |
get-editor | (get-editor &optional filename) | Return a java object representing either the current editor or the editor which contains the source stored in the file with file name filename |
get-cursor-offset | (get-cursor-edit editor) | editor is a java object created via get-editor. get-cursor-offset gives you a integer representing the current offset of the cursor in the editor. |
get-text | (get-text editor position length) | editor is a java object created via get-editor, position and length are fixnums. get-text will return the text in the editor with starts at position position and length length. If there is a error (you go out of the boundaries of the editor bufer). |
set-current-editor | (set-current-editor editor) | editor is a java object obtained via get-editor, make this editor the current editor in the IDE. |
insert-text | (insert-text editor position text) | editor is a java-object obtained via get-editor, position is a fixnum indicating the position from where the text must be inserted and text is the string which must be inserted. Insert a text in a editor at a given positions. |
remove-text | (remove-text editor position length) | editor is a java-object obtained via get-editor, position is a fixnum indicating the position from where the text must be removed and length is the number of characters that must be removed. |
search-next | (search-next matcher &optional position) | matcher is a matcher obtained via search-text (a matcher contains a regular expression, a reference to a editor buffer and the last position where a match was found in the the text via the regular expression, position resets the internal position of a matcher to a new position before the search for a next match. Returns the next matched position (-1 if no match can be found). |
search-text | (search-text editor regexp case position) | editro is a java-object obtained via get-editor representing a editor buffer, regexp is a string containing a regular perl expression, case is a boolean indicating if we do a case sensitive or case insensitive match and position is the begin posistion form where we wants to start a match. search-text will search for the first match with the regulqr expression from position position. The start of the matching position (-1 if no match can be found) and a matcher object (used to do further searching) will be returned. |
set-cursor | (set-cursor editor position) | editor is a java object created via get-editor, position is a fixnum indicating a position in the editor. set-cursor will change the cursor position in the editor to position position |