[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The IDLWAVE major mode supports editing IDL source files. In this chapter we describe the main features of the mode and how to customize them.
4.1 Code Formatting | Making code look nice | |
4.2 Routine Info | Calling Sequence and Keyword List | |
4.3 Online Help | One key press from source to help | |
4.4 Completion | Completing routine names and Keywords | |
4.5 Routine Source | Finding routines, the easy way | |
4.6 Resolving Routines | Force the Shell to compile a routine | |
4.7 Code Templates | Frequent code constructs | |
4.8 Abbreviations | Abbreviations for common commands | |
4.9 Actions | Changing case, Padding, End checking | |
4.10 Documentation Header | Inserting a standard header | |
4.11 Motion Commands | Moving through the structure of a program | |
4.12 Miscellaneous Options | Things that fit nowhere else |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.1.1 Code Indentation | Reflecting the logical structure | |
4.1.2 Continued Statement Indentation | ||
4.1.3 Comment Indentation | Special indentation for comment lines | |
4.1.4 Continuation Lines and Filling | Splitting statements over lines | |
4.1.5 Syntax Highlighting | Font-lock support | |
4.1.6 Octals and Highlighting | Why "123 causes problems |
The IDL language, with its early roots in FORTRAN, modern implementation in C, and liberal borrowing of features of many vector languages along its 25+ year history, has inherited an unusual mix of syntax elements. Left to his or her own devices, a novice IDL programmer will often conjure code which is very difficult to read and impossible to adapt. Much can be gleaned from studying available IDL code libraries for coding style pointers, but, due to the variety of IDL syntax elements, replicating this style can be challenging at best. Luckily, IDLWAVE understands the structure of IDL code very well, and takes care of almost all formatting issues for you. After configuring it to match your coding standards, you can rely on it to help keep your code neat and organized.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Like all Emacs programming modes, IDLWAVE performs code indentation.
The TAB key indents the current line relative to context.
LFD insert a newline and indents the new line. The indentation is
governed by a number of variables. IDLWAVE indents blocks (between
PRO
/FUNCTION
/BEGIN
and END
), and
continuation lines.
To re-indent a larger portion of code (e.g. when working with foreign code
written with different conventions), use C-M-\
(indent-region
) after marking the relevant code. Useful marking
commands are C-x h (the entire file) or C-M-h (the
current subprogram). See section 4.9 Actions, for information how to impose
additional formatting conventions on foreign code.
0
)
4
)
idlwave-end-offset
.
-4
)
idlwave-block-indent
will make END lines line up with the block
BEGIN lines.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
$
) can receive a
fixed indentation offset from the main level, but in several situations
IDLWAVE can use a special form of indentation which aligns continued
statements more naturally. Special indentation is calculated for
continued routine definition statements and calls, enclosing parentheses
(like function calls, structure/class definitions, explicit structures
or lists, etc.), and continued assignments. An attempt is made to line
up with the first non-whitespace character after the relevant opening
punctuation mark (,
,(
,{
,[
,=
). For
lines without any non-comment characters on the line with the opening
punctuation, the continued line(s) are aligned just past the
punctuation. An example:
function foo, a, b, $ c, d bar = sin( a + b + $ c + d) end |
The only drawback to this special continued statement indentation is that it consumes more space, e.g., for long function names or left hand sides of an assignment:
function thisfunctionnameisverylongsoitwillleavelittleroom, a, b, $ c, d |
You can instruct IDLWAVE when to avoid using this special continuation
indentation by setting the variable
idlwave-max-extra-continuation-indent
, which specifies the
maximum additional indentation beyond the basic indent to be
tolerated, otherwise defaulting to a fixed-offset from the enclosing
indent (the size of which offset is set in
idlwave-continuation-indent
). As a special case, continuations
of routine calls without any arguments or keywords will not
align the continued line, under the assumption that you continued
because you needed the space.
Also, since the indentation level can be somewhat dynamic in continued
statements with special continuation indentation, especially if
idlwave-max-extra-continuation-indent
is small, the key
C-u TAB will re-indent all lines in the current statement.
Note that idlwave-indent-to-open-paren
, if non-nil, overrides
the idlwave-max-extra-continuation-indent
limit, for
parentheses only, forcing them always to line up.
2
)
20
)
0
. To enable it
constantly, set to a large number (like 100
). Note that the
indentation in a long continued statement never decreases from line to
line, outside of nested parentheses statements.
t
)
nil
means indent continuation lines to innermost open
parenthesis, regardless of whether the
idlwave-max-extra-continuation-indent
limit is satisfied.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In IDL, lines starting with a `;' are called comment lines. Comment lines are indented as follows:
;;; |
The indentation of lines starting with three semicolons remains unchanged. |
;; |
Lines starting with two semicolons are indented like the surrounding code. |
; |
Lines starting with a single semicolon are indented to a minimum column. |
The indentation of comments starting in column 0 is never changed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In IDL, a newline character terminates a statement unless preceded by a
`$'. If you would like to start a continuation line, use
M-RET, which calls the command idlwave-split-line
.
It inserts the continuation character `$', terminates the line and
indents the new line. The command M-RET can also be invoked
inside a string to split it at that point, in which case the `+'
concatenation operator is used.
When filling comment paragraphs, IDLWAVE overloads the normal filling
functions and uses a function which creates the hanging paragraphs
customary in IDL routine headers. When auto-fill-mode
is turned
on (toggle with C-c C-a), comments will be auto-filled. If the
first line of a paragraph contains a match for
idlwave-hang-indent-regexp
(a dash-space by default), subsequent
lines are positioned to line up after it, as in the following example.
;================================= ; x - an array containing ; lots of interesting numbers. ; ; y - another variable where ; a hanging paragraph is used ; to describe it. ;================================= |
You can also refill a comment at any time paragraph with M-q. Comment delimiting lines as in the above example, consisting of one or more `;' followed by one or more of the characters `+=-_*', are kept in place, as is.
t
)
nil
means auto fill will only operate on comment lines.
t
)
nil
means auto fill will split strings with the IDL `+'
operator.
t
)
nil
means idlwave-split-line
will split strings with
`+'.
t
)
nil
means comment paragraphs are indented under the hanging
indent given by idlwave-hang-indent-regexp
match in the first
line of the paragraph.
"- "
)
nil
)
nil
means use last match on line for
idlwave-indent-regexp
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Highlighting of keywords, comments, strings etc. can be accomplished
with font-lock
. If you are using global-font-lock-mode
(in Emacs), or have font-lock
turned on in any other buffer in
XEmacs, it should also automatically work in IDLWAVE buffers. If you'd
prefer invoking font-lock individually by mode, you can enforce it in
idlwave-mode
with the following line in your `.emacs':
(add-hook 'idlwave-mode-hook 'turn-on-font-lock) |
IDLWAVE supports 3 increasing levels of syntax highlighting.
The variable font-lock-maximum-decoration
determines which level
is selected. Individual categories of special tokens can be selected
for highlighting using the variable
idlwave-default-font-lock-items
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A rare syntax highlighting problem results from an extremely unfortunate
notation for octal numbers in IDL: "123
. This unpaired quotation
mark is very difficult to parse, given that it can be mixed on a single
line with any number of strings. Emacs will incorrectly identify this
as a string, and the highlighting of following lines of code can be
distorted, since the string is never terminated.
One solution to this involves terminating the mistakenly identified string yourself by providing a closing quotation mark in a comment:
string("305B) + $ ;" <--- for font-lock ' is an Angstrom.' |
A far better solution is to abandon this notation for octals altogether, and use the more sensible alternative IDL provides:
string('305'OB) + ' is an Angstrom.' |
This simultaneously solves the font-lock problem and is more
consistent with the notation for hexadecimal numbers, e.g. 'C5'XB
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
IDL comes bundled with more than one thousand procedures, functions
and object methods, and large libraries typically contain hundreds or
even thousands more (each with a few to tens of keywords and
arguments). This large command set can make it difficult to remember
the calling sequence and keywords for the routines you use, but
IDLWAVE can help. It builds up routine information from a wide
variety of sources; IDLWAVE in fact knows far more about the
`.pro' routines on your system than IDL itself! It maintains a
list of all built-in routines, with calling sequences and
keywords(4). It also scans Emacs buffers
for routine definitions, queries the IDLWAVE-Shell for information
about routines currently compiled there, and automatically locates
library and user-created catalogs. This information is updated
automatically, and so should usually be current. To force a global
update and refresh the routine information, use C-c C-i
(idlwave-update-routine-info
).
To display the information about a routine, press C-c ?, which
calls the command idlwave-routine-info
. When the current cursor
position is on the name or in the argument list of a procedure or
function, information will be displayed about the routine. For example,
consider the indicated cursor positions in the following line:
plot,x,alog(x+5*sin(x) + 2), | | | | | | | | 1 2 3 4 5 6 7 8 |
On positions 1,2 and 8, information about the `plot' procedure will be shown. On positions 3,4, and 7, the `alog' function will be described, while positions 5 and 6 will investigate the `sin' function.
When you ask for routine information about an object method, and the
method exists in several classes, IDLWAVE queries for the class of the
object, unless the class is already known through a text property on the
`->' operator (see section 4.4.2 Object Method Completion and Class Ambiguity), or by having been explicity included in the call
(e.g. a->myclass::Foo
).
The description displayed contains the calling sequence, the list of keywords and the source location of this routine. It looks like this:
Usage: XMANAGER, NAME, ID Keywords: BACKGROUND CATCH CLEANUP EVENT_HANDLER GROUP_LEADER JUST_REG MODAL NO_BLOCK Source: SystemLib [LCSB] /soft1/idl53/lib/xmanager.pro |
If a definition of this routine exists in several files accessible to IDLWAVE, several `Source' lines will point to the different files. This may indicate that your routine is shadowing a system library routine, which may or may not be what you want (see section A.4 Load-Path Shadows). The information about the calling sequence and keywords is derived from the first source listed. Library routines are available only if you have scanned your local IDL directories or are using pre-scanned libraries (see section A.3 Catalogs). The source entry consists of a source category, a set of flags and the path to the source file. The following default categories exist:
System | A system routine of unknown origin. When the system library has been scanned as part of a catalog (see section A.3 Catalogs), this category will automatically split into the next two. |
Builtin | A builtin system routine with no source code available. |
SystemLib | A library system routine in the official lib directory `!DIR/lib'. |
Obsolete | A library routine in the official lib directory `!DIR/lib/obsolete'. |
Library | A routine in a file on IDL's search path !PATH .
|
Other | Any other routine with a file not known to be on the search path. |
Unresolved | An otherwise unkown routine the shell lists as unresolved (referenced, but not compiled). |
Any routines discovered in library catalogs (see section A.3.1 Library Catalogs), will display the category assigned during creation,
e.g. `NasaLib'. For routines not discovered in this way, you can
create additional categories based on the routine's filename using the
variable idlwave-special-lib-alist
.
The flags [LCSB]
indicate the source of the information IDLWAVE
has regarding the file: from a library catalog ([L---]
),
from a user catalog ([-C--]
, from the IDL Shell
([--S-]
) or from an Emacs buffer ([---B]
).
Combinations are possible (a compiled library routine visited in a
buffer might read [L-SB]
). If a file contains multiple
definitions of the same routine, the file name will be prefixed with
`(Nx)' where `N' is the number of definitions.
Some of the text in the `*Help*' routine info buffer will be active (it is highlighted when the mouse moves over it). Typically, clicking with the right mouse button invokes online help lookup, and clicking with the middle mouse button inserts keywords or visits files:
Usage | If online help is installed, a click with the right mouse button on the Usage: line will access the help for the routine (see section 4.3 Online Help). |
Keyword | Online help about keywords is also available with the
right mouse button. Clicking on a keyword with the middle
mouse button will insert this keyword in the buffer from where
idlwave-routine-info was called. Holding down SHIFT while
clicking also adds the initial `/'.
|
Source | Clicking with the middle mouse button on a `Source' line finds the source file of the routine and visits it in another window. Another click on the same line switches back to the buffer from which C-c ? was called. If you use the right mouse button, the source will not be visited by a buffer, but displayed in the online help window. |
Classes | The Classes line is only included in the routine info window if the current class inherits from other classes. You can click with the middle mouse button to display routine info about the current method in other classes on the inheritance chain, if such a method exists there. |
t
)
nil
means resize the Routine-info `*Help*' window to
fit the content.
5
)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For IDL system routines, RSI provides extensive documentation. IDLWAVE can access an HTML version of this documentation very quickly and accurately. This is much faster than using the IDL online help application, because IDLWAVE usually gets you to the right place in the documentation directly -- e.g. a specific keyword of a routine --- without any additional browsing and scrolling. For this online help to work, an HTML version of the IDL documentation, which is not part of the standalone IDLWAVE distribution, is required. The necessary files can be downloaded from the maintainers webpage. There are a variety of options for displaying the HTML help: see below. Help for routines without HTML documentation is also available, using the routine documentation header and/or source.
In any IDL program (or, as with most IDLWAVE commands, in the IDL
Shell), press M-? (idlwave-context-help
), or click with
S-Mouse-3 to access context sensitive online help. The following
locations are recognized context for help:
Routine name | The name of a routine (function, procedure, method). |
Keyword Parameter | A keyword parameter of a routine. |
System Variable | System variables like !DPI .
|
System Variable Tags | System variables tags like !D.X_SIZE .
|
IDL Statement | Statements like PRO , REPEAT , COMPILE_OPT , etc.
|
Class name | A class name in an OBJ_NEW call.
|
Class Init | Beyond the class name in an OBJ_NEW call.
|
Executive Command | An executive command like .RUN . Mostly useful in the shell.
|
Structure Tags | Structure tags like state.xsize
|
Class Tags | Class tags like self.value .
|
Default | The routine that would be selected for routine info display. |
Note that the OBJ_NEW
function is special in that the help
displayed depends on the cursor position. If the cursor is on the
`OBJ_NEW', this function is described. If it is on the class
name inside the quotes, the documentation for the class is pulled up.
If the cursor is after the class name, anywhere in the argument
list, the documentation for the corresponding Init
method and
its keywords is targeted.
Apart from an IDLWAVE buffer or shell, there are two more places from which online help can be accessed.
4.3.1 Help with HTML Documentation | ||
4.3.2 Help with Source |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Help using the HTML documentation is invoked with the built-in Emacs
command browse-url
, which displays the relevant help topic in a
browser of your choosing. There are many possible browsers to choose
among, with differing advantages and disadvantages. The variable
idlwave-help-browser-function
controls which browser help is
sent to. This function is used to set the variable
browse-url-browser-function
locally for IDLWAVE help only.
Customize this variable to see what choices of browsers your system
offers.
Certain browsers like w3
(bundled with many versions of Emacs)
and w3m
(http://emacs-w3m.namazu.org/, the author's help
browser of choice) are run within Emacs, and use Emacs buffers to
display the HTML help. This can be convenient, especially on small
displays, and images can even be displayed in-line on new Emacs
versions. However, better formatting results are often achieved with
external browsers, like Mozilla. IDLWAVE assumes any browser function
containing "w3" is displayed in a local buffer. If you are using
another Emacs-local browser for which this is not true, set the
variable idlwave-help-browser-is-local
.
N.B. For Windows users: IDLWAVE can bring up RSI help directly
in the Microsoft HTMLHelp documentation supplied with IDL: no
additional help files are needed. Be sure to set
idlwave-system-directory
and the help file will be found
automatically (or, alternatively, specify its location directly with
idlwave-html-help-location
). The variable
idlwave-help-use-hh
controls whether HTMLHelp is used, and
which application is called to invoke it (HH
is the default).
The free helper application KEYHH
(http://www.keyworks.net/keyhh.htm) can be used instead, and is
preferrable, as it permits loading new help topics into the same help
window. KEYHH
must be downloaded and installed separately.
See section B. HTML Help Browser Tips, for more information on selecting and configuring a browser for use with IDL's HTML help system.
nil
'hh
or 'keyhh
, use Windows native HTMLHelp
with the specified help application.
browse-url-browser-function
, which see.
idlwave-help-browser-function
run in a
local Emacs buffer? Defaults to t
if the function contains
"-w3".
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For routines which are not documented in an HTML manual (for example
personal or library routines), the source code itself is used as help
text. If the requested information can be found in a (more or less)
standard DocLib file header, IDLWAVE shows the header (scrolling down to
a keyword, if appropriate). Otherwise the routine definition statement
(pro
/function
) is shown. The doclib header sections which
are searched for include `NAME' and `KEYWORDS'. Localization
support can be added by customizing the idlwave-help-doclib-name
and idlwave-help-doclib-keyword
variables.
Help is also available for class structure tags (self.TAG
), and
generic structure tags, if structure tag completion is enabled
(see section 4.4.5 Structure Tag Completion). This is implemented by visiting the
tag within the class or structure definition source itself. Help is not
available on built-in system class tags.
The help window is normally displayed in the same frame, but can be popped-up in a separate frame. The following commands can be used to navigate inside the help system for source files:
SPACE | Scroll forward one page. |
RET | Scroll forward one line. |
DEL | Scroll back one page. |
h | Jump to DocLib Header of the routine whose source is displayed as help. |
H | Jump to the first DocLib Header in the file. |
. (Dot) | Jump back and forth between the routine definition (the
pro /function statement) and the description of the help
item in the DocLib header.
|
F | Fontify the buffer like source code. See the variable idlwave-help-fontify-source-code .
|
q | Kill the help window. |
nil
)
nil
means use a separate frame for Online Help if possible.
20
)
nil
)
nil
means fontify source code displayed as help.
t
)
nil
means try to find help in routine header when
displaying source file.
"name"
)
"\\(name\\|nom\\)"
.
"KEYWORD"
)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 TAB in the
IDLWAVE Shell -- see section 5.2 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 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 |
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.
t
)
nil
means completion automatically adds `=' after
completed keywords.
t
)
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.
t
)
nil
means restore window configuration after successful
completion.
t
)
nil
means highlight completions for which system help is
available.
4.4.1 Case of Completed Words | CaseOFcomPletedWords | |
4.4.2 Object Method Completion and Class Ambiguity | obj->Method, what? | |
4.4.3 Object Method Completion in the Shell | ||
4.4.4 Class and Keyword Inheritance | obj->Method, _EXTRA=e | |
4.4.5 Structure Tag Completion | Completing state.Tag |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
idlwave-completion-case
. The default is to use upper
case for procedures, functions and keywords, and mixed case for object
class names and methods, similar to the conventions in the IDL
manuals. For instance, to enable mixed-case completion for routines
in addition to classes and methods, you need an entry such as
(routine . preserve)
in that variable. To enable total control
over the case of completed items, independent of buffer context, set
idlwave-completion-force-default-case
to non-nil
.
nil
)
nil
means completion will always honor the settings in
idlwave-completion-case
. When nil (the default), entirely lower
case strings will always be completed to lower case, no matter what the
settings in idlwave-completion-case
.
nil
)
nil
means the empty string is considered lower case for
completion.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
idlwave-completion-show-classes
). As a special case, the class
of an object called `self' is always taken to be the class of the
current routine. All classes it inherits from are considered as well
where appropriate.
You can also call idlwave-complete
with a prefix arg: C-u
M-TAB. IDLWAVE will then prompt you for the class in order to
narrow down the number of possible completions. The variable
idlwave-query-class
can be configured to make such prompting the
default for all methods (not recommended), or selectively for very
common methods for which the number of completing keywords would be too
large (e.g. Init
).
After you have specified the class for a particular statement (e.g. when
completing the method), IDLWAVE can remember it for the rest of the
editing session. Subsequent completions in the same statement
(e.g. keywords) can then reuse this class information. This works by
placing a text property on the method invocation operator `->',
after which the operator will be shown in a different face. This is not
enabled by default -- the variable idlwave-store-inquired-class
can be used to turn it on.
1
)
nil
means show classes in `*Completions*' buffer when
completing object methods and keywords.
t
)
nil
means fontify the classes in completions buffer.
nil
)
nil
)
nil
means store class of a method call as text property on
`->'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
obj_class()
function). In the Shell, when attempting completion,
routine info, or online help within a method routine, a query is sent to
determine the class of the object. If this query is successful, the
class found will be used to select appropriate completions, routine
info, or help. If unsuccessful, information from all known classes will
be used (as in the buffer). Setting the variable
idlwave-store-inquired-class
can eliminate unnecessary repetitive
queries for the object's class, and speed up completion.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Class inheritance affects which methods are called in IDL. An object of
a class which inherits methods from one or more superclasses can
override that method by defining its own method of the same name, extend
the method by calling the method(s) of its superclass(es) in its
version, or inherit the method directly by making no modifications.
IDLWAVE examines class definitions during completion and routine
information display, and records all inheritance information it finds.
This information is displayed if appropriate with the calling sequence
for methods (see section 4.2 Routine Info), as long as variable
idlwave-support-inheritance
is non-nil
.
In many class methods, keyword inheritance (_EXTRA
and
_REF_EXTRA
) is used hand-in-hand with class inheritance and
method overriding. E.g., in a SetProperty
method, this technique
allows a single call obj->SetProperty
to set properties up the
entire class inheritance chain. This is often referred to as
chaining, and is characterized by chained method calls like
self->MySuperClass::SetProperty,_EXTRA=e
.
IDLWAVE can accomodate this special synergy between class and keyword
inheritance: if _EXTRA
or _REF_EXTRA
is detected among a
method's keyword parameters, all keywords of superclass versions of
the method being considered can be included in completion. There is
of course no guarantee that this type of keyword chaining actually
occurrs, but for some methods it's a very convenient assumption. The
variable idlwave-keyword-class-inheritance
can be used to
configure which methods have keyword inheritance treated in this
simple, class-driven way. By default, only Init
and
(Get|Set)Property
are. The completion buffer will label
keywords based on their originating class.
t
)
nil
means consider inheritance during completion, online help etc.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section 4.4.2 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 section 4.3 Online Help).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
idlwave-find-module
) asks
for a module name, offering the same default as
idlwave-routine-info
would have used, taken from nearby buffer
contents. In the minibuffer, specify a complete routine name (including
any class part). IDLWAVE will display the source file in another
window, positioned at the routine in question.
Since getting the source of a routine into a buffer is so easy with
IDLWAVE, too many buffers visiting different IDL source files are
sometimes created. The special command C-c C-k
(idlwave-kill-autoloaded-buffers
) can be used to easily remove
these buffers.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The key sequence C-c = calls the command idlwave-resolve
and sends the line `RESOLVE_ROUTINE, 'routine_name'' to IDL
in order to resolve (compile) it. The default routine to be resolved is
taken from context, but you get a chance to edit it.
idlwave-resolve
is one way to get a library module within reach
of IDLWAVE's routine info collecting functions. A better way is to
keep routine information available in catalogs (see section A.3 Catalogs).
Routine info on modules will then be available without the need to
compile the modules first, and even without a running shell.
See section A. Sources of Routine Info, for more information on the ways IDLWAVE collects data about routines, and how to update this information.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
IDLWAVE can insert IDL code templates into the buffer. For a few templates, this is done with direct key bindings:
C-c C-c | CASE statement template
|
C-c C-f | FOR loop template
|
C-c C-r | REPEAT loop template
|
C-c C-w | WHILE loop template
|
All code templates are also available as abbreviations (see section 4.8 Abbreviations).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Special abbreviations exist to enable rapid entry of commonly used
commands. Emacs abbreviations are expanded by typing text into the
buffer and pressing SPC or RET. The special abbreviations
used to insert code templates all start with a `\' (the backslash),
or, optionally, any other character set in
idlwave-abbrev-start-char
. IDLWAVE ensures that abbreviations are
only expanded where they should be (i.e., not in a string or comment),
and permits the point to be moved after an abbreviation expansion ---
very useful for positioning the mark inside of parentheses, etc.
Special abbreviations are pre-defined for code templates and other useful items. To visit the full list of abbreviations, use M-x idlwave-list-abbrevs.
Template abbreviations:
\pr |
PROCEDURE template
|
\fu |
FUNCTION template
|
\c |
CASE statement template
|
\f |
FOR loop template
|
\r |
REPEAT loop template
|
\w |
WHILE loop template
|
\i |
IF statement template
|
\elif |
IF-ELSE statement template
|
String abbreviations:
\ap |
arg_present()
|
\b |
begin
|
\cb |
byte()
|
\cc |
complex()
|
\cd |
double()
|
\cf |
float()
|
\cl |
long()
|
\co |
common
|
\cs |
string()
|
\cx |
fix()
|
\e |
else
|
\ec |
endcase
|
\ee |
endelse
|
\ef |
endfor
|
\ei |
endif else if
|
\el |
endif else
|
\en |
endif
|
\er |
endrep
|
\es |
endswitch
|
\ew |
endwhile
|
\g |
goto,
|
\h |
help,
|
\ik |
if keyword_set() then
|
\iap |
if arg_present() then
|
\ine |
if n_elements() eq 0 then
|
\inn |
if n_elements() ne 0 then
|
\k |
keyword_set()
|
\n |
n_elements()
|
\np |
n_params()
|
\oi |
on_ioerror,
|
\or |
openr,
|
\ou |
openu,
|
\ow |
openw,
|
\p |
print,
|
\pt |
plot,
|
\re |
read,
|
\rf |
readf,
|
\rt |
return
|
\ru |
readu,
|
\s |
size()
|
\sc |
strcompress()
|
\sl |
strlowcase()
|
\sm |
strmid()
|
\sn |
strlen()
|
\sp |
strpos()
|
\sr |
strtrim()
|
\st |
strput()
|
\su |
strupcase()
|
\t |
then
|
\u |
until
|
\wc |
widget_control,
|
\wi |
widget_info()
|
\wu |
writeu,
|
You can easily add your own abbreviations or override existing
abbrevs with define-abbrev
in your mode hook, using the
convenience function idlwave-define-abbrev
:
(add-hook 'idlwave-mode-hook (lambda () (idlwave-define-abbrev "wb" "widget_base()" (idlwave-keyword-abbrev 1)) (idlwave-define-abbrev "ine" "IF N_Elements() EQ 0 THEN" (idlwave-keyword-abbrev 11)))) |
Notice how the abbreviation (here wb) and its expansion
(widget_base()) are given as arguments, and the single argument to
idlwave-keyword-abbrev
(here 1) specifies how far back to
move the point upon expansion (in this example, to put it between the
parentheses).
The abbreviations are expanded in upper or lower case, depending upon
the variables idlwave-abbrev-change-case
and, for reserved word
templates, idlwave-reserved-word-upcase
(see section 4.9.3 Case Changes).
"\"
)
t
)
nil
means the abbrev hook can move point, e.g. to end up
between the parentheses of a function call.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Actions are special formatting commands which are executed automatically while you write code in order to check the structure of the program or to enforce coding standards. Most actions which have been implemented in IDLWAVE are turned off by default, assuming that the average user wants her code the way she writes it. But if you are a lazy typist and want your code to adhere to certain standards, actions can be helpful.
Actions can be applied in three ways:
idlwave-do-actions
must be non-nil
.
nil
)
nil
means performs actions when indenting. Individual action
settings are described below and set separately.
4.9.1 Block Boundary Check | Is the END statement correct? | |
4.9.2 Padding Operators | Enforcing space around `=' etc | |
4.9.3 Case Changes | Enforcing upper case keywords |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Whenever you type an END
statement, IDLWAVE finds the
corresponding start of the block and the cursor blinks back to that
location for a second. If you have typed a specific END
, like
ENDIF
or ENDCASE
, you get a warning if that terminator
does not match the type of block it terminates.
Set the variable idlwave-expand-generic-end
in order to have all
generic END
statements automatically expanded to the appropriate
type. You can also type C-c ] to close the current block by
inserting the appropriate END
statement.
t
)
nil
means point blinks to block beginning for
idlwave-show-begin
.
t
)
nil
means expand generic END to ENDIF/ENDELSE/ENDWHILE etc.
t
)
nil
means re-indent line after END was typed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some operators can be automatically surrounded by spaces. This can
happen when the operator is typed, or later when the line is indented.
IDLWAVE can pad the operators `&', `<', `>', `,',
`=', and `->', but this feature is turned off by default. If
you want to turn it on, customize the variables
idlwave-surround-by-blank
and idlwave-do-actions
. You can
also define similar actions for other operators by using the function
idlwave-action-and-binding
in the mode hook. For example, to
enforce space padding of the `+' and `*' operators, try this
in `.emacs'
(add-hook 'idlwave-mode-hook (lambda () (setq idlwave-surround-by-blank t) ; Turn this type of actions on (idlwave-action-and-binding "*" '(idlwave-surround 1 1)) (idlwave-action-and-binding "+" '(idlwave-surround 1 1)))) |
nil
)
nil
means enable idlwave-surround
. If non-nil
,
`=', `<', `>', `&', `,', `->' are
surrounded with spaces by idlwave-surround
.
t
)
nil
means pad `=' for keywords like assignments.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Actions can be used to change the case of reserved words or expanded
abbreviations by customizing the variables
idlwave-abbrev-change-case
and
idlwave-reserved-word-upcase
. If you want to change the case of
additional words automatically, put something like the following into
your `.emacs' file:
(add-hook 'idlwave-mode-hook (lambda () ;; Capitalize system vars (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t) ;; Capitalize procedure name (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<" '(capitalize-word 1) t) ;; Capitalize common block name (idlwave-action-and-binding "\\<common\\>[ \t]+\\<" '(capitalize-word 1) t))) |
For more information, see the documentation string for the function
idlwave-action-and-binding
. For information on controlling the
case of routines, keywords, classes, and methods as they are completed, see
4.4 Completion.
nil
)
nil
means all abbrevs will be forced to either upper or lower
case. Legal values are nil
, t
, and down
.
nil
)
nil
means reserved words will be made upper case via abbrev
expansion.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The command C-c C-h inserts a standard routine header into the
buffer, with the usual fields for documentation (a different header can
be specified with idlwave-file-header
). One of the keywords is
`MODIFICATION HISTORY' under which the changes to a routine can be
recorded. The command C-c C-m jumps to the `MODIFICATION
HISTORY' of the current routine or file and inserts the user name with a
timestamp.
nil
)
nil
means the documentation header will always be at start
of file.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
IDLWAVE supports both `Imenu' and `Func-menu', two packages which make it easy to jump to the definitions of functions and procedures in the current file with a pop-up selection. To bind `Imenu' to a mouse-press, use in your `.emacs':
(define-key global-map [S-down-mouse-3] 'imenu) |
In addition, `Speedbar' support allows convenient navigation of a
source tree of IDL routine files, quickly stepping to routine
definitions. See Tools->Display Speedbar
.
Several commands allow you to move quickly through the structure of an IDL program:
C-M-a | Beginning of subprogram |
C-M-e | End of subprogram |
C-c { | Beginning of block (stay inside the block) |
C-c } | End of block (stay inside the block) |
C-M-n | Forward block (on same level) |
C-M-p | Backward block (on same level) |
C-M-d | Down block (enters a block) |
C-M-u | Backward up block (leaves a block) |
C-c C-n | Next Statement |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
t
)
nil
means display a startup message when idlwave-mode
'
is first called.
idlwave-mode
.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by XEmacs shared group account on December, 19 2009
using texi2html 1.65.