Next: Routine Source, Previous: Online Help, Up: The IDLWAVE Major Mode

### 4.4 Completion

IDLWAVE offers completion for class names, routine names, keywords, system variables, system variable tags, class structure tags, regular structure tags and file names. As in many programming modes, completion is bound to `M-<TAB>` (or simply `<TAB>` in the IDLWAVE Shell — see Using the Shell). Completion uses exactly the same internal information as routine info, so when necessary (rarely) it can be updated with `C-c C-i` (`idlwave-update-routine-info`).

The completion function is context sensitive and figures out what to complete based on the location of the point. Here are example lines and what `M-<TAB>` would try to complete when the cursor is on the position marked with a ‘`_`’:

         plo_                    Procedure
         x = a_                  Function
         plot,xra_               Keyword of plot procedure
         plot,x,y,/x_            Keyword of plot procedure
         plot,min(_              Keyword of min function
         obj -> a_               Object method (procedure)
         a[2,3] = obj -> a_      Object method (function)
         x = obj_new('IDL_       Class name
         x = obj_new('MyCl',a_   Keyword to Init method in class MyCl
         pro A_                  Class name
         pro _                   Fill in Class:: of first method in this file
         !v_                     System variable
         !version.t_             Structure tag of system variable
         self.g_                 Class structure tag in methods
         state.w_                Structure tag, if tag completion enabled
         name = 'a_              File name (default inside quotes)

The only place where completion is ambiguous is procedure/function keywords versus functions. After ‘`plot,x,_`’, IDLWAVE will always assume a keyword to ‘`plot`’. However, a function is also a possible completion here. You can force completion of a function name at such a location by using a prefix arg: `C-u M-<TAB>`.

Giving two prefix arguments (`C-u C-u M-<TAB>`) prompts for a regular expression to search among the commands to be completed. As an example, completing a blank line in this way will allow you to search for a procedure matching a regexp.

If the list of completions is too long to fit in the `*Completions*` window, the window can be scrolled by pressing `M-<TAB>` repeatedly. Online help (if installed) for each possible completion is available by clicking with `Mouse-3` on the item. Items for which system online help (from the IDL manual) is available will be emphasized (e.g. colored blue). For other items, the corresponding source code or DocLib header will be used as the help text.

Completion is not a blocking operation — you are free to continue editing, enter commands, or simply ignore the `*Completions*` buffer during a completion operation. If, however, the most recent command was a completion, `C-g` will remove the buffer and restore the window configuration. You can also remove the buffer at any time with no negative consequences.

— User Option: idlwave-keyword-completion-adds-equal (`t`)

> Non-`nil` means completion automatically adds ‘`=`’ after completed keywords.

— User Option: idlwave-function-completion-adds-paren (`t`)

> Non-`nil` means completion automatically adds ‘`(`’ after completed function. A value of `2' means also add the closing parenthesis and position the cursor between the two.

— User Option: idlwave-completion-restore-window-configuration (`t`)

> Non-`nil` means restore window configuration after successful completion.

— User Option: idlwave-highlight-help-links-in-completion (`t`)

> Non-`nil` means highlight completions for which system help is available.