Command Line Completion

The jed editor has several hundred built–in functions as well as many more written in the S-Lang extension language. Many of these functions are bound to keys and many are not. It is simply unreasonable to require the user to remember if a function is bound to a key or not and, if it is, to remember the key to which it is bound. This is especially true of those functions that are bound but rarely used. More often than not, one simply forgets the exact name or spelling of a function and requires a little help. For this reason, jed supports command line completion in the mini-buffer. This function, called emacs_escape_x, is bound to the key ESC X. This is one binding that must be remembered!

As an example, suppose that you are editing several buffers and you wish to insert the contents of one buffer into the current buffer. The function that does this is called insert_buffer and has no default key-binding. Pressing ESC X produces the prompt M-x. This prompt, borrowed from the Emacs editor, simply means that ESC X was pressed. Now type in and hit the space bar or the TAB key. In this context (completion context) the space bar and the TAB will expand the string in the Mini-Buffer up until it is no longer unique. In this case, insert_file and insert_buffer are only the two functions that start with in. Hence, in will expand to insert_ at which point it becomes necessary to enter more information to uniquely specify the desired function. However, in a completion context, the space bar also has a special property that enables the user to cycle among the possible completions. For this example, hitting the space bar twice consecutively will produce the string insert_file and hitting it again produces the desired string insert_buffer.

The role of the space bar in completion is a point where Emacs and jed differ. Emacs will pop up a buffer of possible completions but jed expects the user to press the space bar to cycle among them. Both have there pros and cons. Frequently, one sees messages on the Usenet newsgroup gnu.emacs.help from Emacs users asking for the kind of completion jed employs.