# The jabbrevs Abbreviation Manager

## Introduction

The `jabbrevs` application is a tool for maintaining lists of abbreviations, which works with `jedit`. It is distributed as part of the jstools package.

`jabbrevs` was designed for use with `jedit`'s static abbreviation feature, which allows you to have abbreviations which you define for words (and phrases) automatically expanded as you type. However, it could easily be used by other Tk or Tclbased editors, and it could conceivably be used for other purposes as well.

This document describes `jabbrevs` version 1998.11.04.

Copyright and contact information is available in the jstools documentation.

## Invocation

`jabbrevs`

`jabbrevs` is typically called by `jedit` when you choose `Edit Static Abbreviations' from the Abbrev menu, but you can also start it yourself from the Unix command line by typing ``jabbrevs`'. In either case, it needs to be found in your path.

If you have trouble starting `jabbrevs`, see the Usage documentation for jstools.

## Working with Abbreviations

### Defining a New Abbreviation

To define a new abbreviation, type the abbreviation into the top text field, marked Abbreviation, and press Tab to move the cursor to the Expansion text field. Type the word or phrase your abbreviation should expand to in the Expansion text field and press Return or click Add to define the abbreviation. (The insertion cursor will be moved back to the Abbreviation field so you can enter another abbreviation if you choose.)

Clicking Add (or pressing Return in the `Expansion:' text field) tells `jabbrevs` itself to remember the abbreviation, but doesn't save it to disk or let other applications know about it. To save any new abbreviations to disk, click the Save button.

### Finding the Expansion for an Abbreviation

To find out what the current expansion for a (potential) abbreviation is, type the abbreviation in the Abbreviation text field and press Return (or click Add - but leave the Abbreviation field empty). If you've typed a valid, existing abbreviation, the Expansion field will be filled in with its expansion. (If no such abbreviation exists, you'll get an message to that effect.)

### Changing an Abbreviation

Changing an abbreviation is just like adding a new one. Type the (presumably already defined) abbreviation in the Abbreviation field, type its (changed) expansion in the Expansion field, and click Add or press Return. The abbreviation's old expansion will be replaced with the new one.

When making a minor change to an abbreviation, such as correcting a typo, you may find it convenient to press Return with the Expansion field empty, and let `jabbrevs` fill in the Expansion field with the old expansion. You can then edit it as you choose before pressing Return again (or clicking Add) to change it.

### A Shortcut for Plurals

(This description is specific to English, but the idea may be applied to other inflected languages.)

`jedit` doesn't have any builtin understanding of English plurals or suffixes, so just because you have an abbreviation ``abbr`' defined to expand to ``abbreviation`', `jedit` won't automatically expand ``abbrs`' to ``abbreviations`'. So you may wish to define abbreviations for plurals (or other inflected forms) of words. You can do that easily, though, by typing the singular abbreviation and pressing Return, letting `jabbrevs` fill in the singular expansion. Your insertion cursor is left at the end of the singular form of the expansion, so you can add ``s`' (or otherwise edit the expansion) and press Tab to move the insertion cursor back to the end of the Abbreviation field. (It's important not to press Return at this point, or you'll be overwriting the singular abbreviation.) Then you can add an ``s`' or otherwise distinguish the plural abbreviation from the singular version, and press Return to add the new plural abbreviation. The same principle can be applied to other inflectional endings.

### Deleting Abbreviations

To delete an abbreviation, type it in the Abbreviation field and click Delete. (It doesn't matter whether there's anything in the Expansion field or not.) `jabbrevs` will forget the abbreviation, and the next time you write the abbreviations out to disk, the deleted abbreviation will be removed from the disk file.

## Saving and Reloading Abbreviations

### Saving the Abbreviations

To save your abbreviations to disk, click the Save button. Until you do this, other applications have no way of seeing the new abbreviations you have defined. (Also, if you quit `jabbrevs` without saving your changes, they will be lost.)

### Reloading the Abbreviations from Disk

To reload the abbreviations from disk (for instance if you've accidentally deleted or changed an abbreviation you wanted to keep), choose `Reload' from the `File' menu. Any changes you have not yet written will be lost.

Your abbreviations are always loaded in when `jabbrevs` starts up, so you only need to choose `Reload' to recover from mistakes.

## Quitting jabbrevs

You can quit `jabbrevs` either by clicking the Quit button or by choosing Quit from the `File' menu. (`jabbrevs` will ask for confirmation first if you've chosen `Confirm Actions' on the Global Preferences panel). If you started `jabbrevs` from within `jedit` by choosing `Edit Static Abbrevs' from `jedit`'s `Abbrevs' menu, then `jedit` will reread your (probably changed) abbrevs file from disk when you quit `jabbrevs`.

## The Abbrevs Menu

The `Abbrevs' menu has commands to get information about `jabbrevs` and for a few miscellaneous tasks.

### Help

The `Help' command displays this help file. (It uses the `jdoc` command, so in order for it to work that command must be installed on your system and in your path. The help file must also be installed, or be in the current directory.)
``

### About the Abbrevs Manager...

The `About the Abbrevs Manager...' command displays an information panel with copyright information. The panel also lets you get more information about the author, and about the Tk/Tcl scripting environment.

### Global Preferences...

This command brings up the jstools Global Preferences panel. Preferences which are particularly relevant to `jabbrevs` are `Confirm Actions', which controls whether you're asked to confirm before quitting, and the key bindings preferences, which control which keyboard commands you have available for working in the two entry fields.

### Issue Tcl Command...

This brings up a panel that prompts you for a Tcl command to be executed. This is an advanced feature intended primarily for use in designing and debugging configuration files; it's not normally useful for manipulating abbreviations.

### Issue Unix Command...

This brings up a panel that prompts you for a Unix command to be executed. If the command produces any output, it will be displayed; otherwise you'll see a notice to that effect. If there are any errors in the execution of the command, you'll see an error dialogue box with the error message returned by the command. This command doesn't have any effect on your abbreviations; it's just a convenience.

## Customising the Abbrevs Manager

`jabbrevs` supports the standard jstools customisation mechanisms. You should consult the general jstools customisation documentation as well as the description below.

### The ~/.tk/jabbrevsrc.tcl Startup Script

In addition to the limited customisation you can do through the Global Preferences panel, you can customise the behaviour of `jabbrevs` by putting Tcl code in the startup script ~/.tk/jabbrevsrc.tcl. While you probably don't need to customise an application as simple as `jabbrevs`, you can if you want to.

## Future Directions

- It should be possible to specify other files to use than the default ~/.tk/abbrevs.tcl.
- I hope to give `jabbrevs` the ability (optionally) to write abbreviation definitions to Emacs' ~/.abbrev_defs file and to `vi`'s ~/.exrc file, so if you use multiple editors you can have the same abbreviations available in all of them.

`
`