Previous Up Next

9 Mini-Buffer

The Mini-Buffer consists of a single line located at the bottom of the screen. Much of the dialog between the user and jed takes place in this buffer. For example, when you search for a string, jed will prompt you for the string in the Mini-Buffer.

The Mini-Buffer also provides a direct link to the S-Lang interpreter. To access the interpreter, press Ctrl-X Esc and the S-Lang> prompt will appear in the Mini-Buffer. Enter any valid S-Lang expression for evaluation by the interpreter.

It is possible to recall data previously entered into the Mini-Buffer by using the up and down arrow keys. This makes it possible to use and edit previous expressions in a convenient and efficient manner.

9.1 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.

9.2 File Names

jed takes every file name and “expands it” according to a set of rules which vary according to the Operating System. For concreteness, consider jed running under MS-DOS. Suppose the user reads a new file into the editor via the find_file command which emacs binds to Ctrl-X Ctrl-F. Then the following might be displayed in the mini-buffer:

      Find File: C:\JED\SLANG\

Here jed is prompting for a file name in the directory \JED\SLANG on disk C:. However, suppose the user wants to get the file C:\JED\SRC\VIDEO.C. Then the following responses produce equivalent filenames when jed expands them internally:

      Find File: C:\JED\src\video.c
      Find File: C:\JED\SLANG\..\src\video.c
      Find File: C:\JED\SLANG\../src/video.c

Note that the on MS-DOS systems, jed replaces the / with a \ and that case is not important. Now suppose you wish to get the file VIDEO.C from disk A:. The following are also valid:

      Find File: A:\video.c
      Find File: A:video.c
      Find File: C:\JED\SLANG\a:\video.c

In the last case, jed is smart enough to figure out what is really meant. Although the above examples are for MS-DOS systems, the rules also apply to Unix and VMS systems as well. The only change is the file name syntax. For example, on VMS

      sys$manager:[misc]dev$user:[davis.jed]vms.c
      dev$user:[davis.jed]vms.c

become equivalent filenames upon expansion. For unix, the following are equivalent:

      /user1/users/davis/jed/unix.c
      /usr/local/src//user1/users/davis/jed/unix.c
      /usr/local/src/~/jed/unix.c

Note the last example: the tilde character ~ always expands into the users HOME directory, in this case to /user1/users/davis.

When jed writes a buffer out to a file, it usually prompts for a file name in the minibuffer displaying the directory associated with the current buffer. At this point a name can be appended to the directory string to form a valid file name or the user may simply hit the RET key. If the latter alternative is chosen, jed simply writes the buffer to the file already associated with the buffer. Once the buffer is written to a file, the buffer becomes attached to that file.

9.3 Buffer Name and File Name Completion

When jed prompts for a file name or a buffer name, the space bar and the Tab keys are special. Hitting the Tab key will complete the name that is currently in the minibuffer up until it is no longer unique. At that point, you can either enter more characters to complete the name or hit the space bar to cycle among the possible completions. The spacebar must be pressed at least twice to cycle among the completions.

On MSDOS and VMS, it is possible to use wildcard characters in the file name for completion purposes. For example, entering *.c and hitting the space bar will cycle among file names matching *.c. Unfortunately, this feature is not available on unix systems.


Previous Up Next