Previous: Class and Keyword Inheritance, Up: Completion

4.4.5 Structure Tag Completion

In many programs, especially those involving widgets, large structures (e.g., the ‘state’ structure) are used to communicate among routines. It is very convenient to be able to complete structure tags, in the same way as for instance variables (tags) of the ‘self’ object (see Object Method Completion and Class Ambiguity). Add-in code for structure tag completion is available in the form of a loadable completion module: idlw-complete-structtag.el. Tag completion in structures is highly ambiguous (much more so than ‘self’ completion), so idlw-complete-structtag makes an unusual and very specific assumption: the exact same variable name is used to refer to the structure in all parts of the program. This is entirely unenforced by the IDL language, but is a typical convention. If you consistently refer to the same structure with the same variable name (e.g., ‘state’), structure tags which are read from its definition in the same file can be used for completion.

Structure tag completion is not enabled by default. To enable it, simply add the following to your .emacs:

        (add-hook 'idlwave-load-hook
                  (lambda () (require 'idlw-complete-structtag)))

Once enabled, you'll also be able to access online help on the structure tags, using the usual methods (see Online Help). In addition, structure variables in the shell will be queried for tag names, similar to the way object variables in the shell are queried for method names. So, e.g.:

     IDL> st.[Tab]

will complete with all structure fields of the structure st.