Use dircategory `Emacs'.
[bpt/emacs.git] / man / idlwave.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename ../info/idlwave
4 @settitle IDLWAVE User Manual
5 @dircategory Emacs
6 @direntry
7 * IDLWAVE: (idlwave). Major mode and shell for IDL and WAVE/CL files.
8 @end direntry
9 @synindex ky cp
10 @syncodeindex vr cp
11 @syncodeindex fn cp
12 @set VERSION 4.2
13 @set EDITION 4.2
14 @set IDLVERSION 5.3
15 @set NSYSROUTINES 1251
16 @set NSYSKEYWORDS 5287
17 @set DATE June 2000
18 @set AUTHOR Carsten Dominik
19 @set AUTHOR-EMAIL dominik@@astro.uva.nl
20 @set MAINTAINER Carsten Dominik
21 @set MAINTAINER-EMAIL dominik@@astro.uva.nl
22 @set IDLWAVE-HOMEPAGE http://www.strw.leidenuniv.nl/~dominik/Tools/idlwave
23 @c %**end of header
24 @finalout
25
26 @ifinfo
27 This file documents IDLWAVE, a major mode for editing IDL and
28 WAVE/CL files with Emacs. It also implements a shell for running IDL as
29 a subprocess.
30
31 This is edition @value{EDITION} of the IDLWAVE User Manual for
32 IDLWAVE @value{VERSION}
33
34 Copyright (c) 1999, 2000 Free Software Foundation, Inc.
35
36 Permission is granted to make and distribute verbatim
37 copies of this manual provided the copyright notice and
38 this permission notice are preserved on all copies.
39
40 @ignore
41 Permission is granted to process this file through TeX
42 and print the results, provided the printed document
43 carries a copying permission notice identical to this
44 one except for the removal of this paragraph (this
45 paragraph not being relevant to the printed manual).
46
47 @end ignore
48 Permission is granted to copy and distribute modified
49 versions of this manual under the conditions for
50 verbatim copying, provided that the entire resulting
51 derived work is distributed under the terms of a permission
52 notice identical to this one.
53
54 Permission is granted to copy and distribute
55 translations of this manual into another language,
56 under the above conditions for modified versions,
57 except that this permission notice may be stated in a
58 translation approved by the Free Software Foundation.
59 @end ifinfo
60
61 @titlepage
62 @title IDLWAVE User Manual
63 @subtitle Major Emacs mode and shell for IDL and WAVE/CL files
64 @subtitle Edition @value{EDITION}, @value{DATE}
65
66 @author by Carsten Dominik
67 @page
68 Copyright @copyright{} 1999, 2000 Free Software Foundation, Inc.
69
70 @sp 2
71 This is edition @value{EDITION} of the @cite{IDLWAVE User Manual} for
72 IDLWAVE version @value{VERSION}, @value{DATE}.
73
74 @sp 2
75
76 @cindex Copyright, of IDLWAVE
77 Permission is granted to make and distribute verbatim
78 copies of this manual provided the copyright notice and
79 this permission notice are preserved on all copies.
80
81 Permission is granted to copy and distribute modified
82 versions of this manual under the conditions for
83 verbatim copying, provided that the entire resulting
84 derive work is distributed under the terms of a permission
85 notice identical to this one.
86
87 Permission is granted to copy and distribute
88 translations of this manual into another language,
89 under the above conditions for modified versions,
90 except that this permission notice may be stated in a
91 translation approved by the Free Software Foundation.
92
93 @end titlepage
94 @contents
95
96 @page
97
98 @ifnottex
99
100 @node Top, Introduction, (dir), (dir)
101
102 IDLWAVE is a package to support editing command files for the
103 Interactive Data Language (IDL), and for running IDL as an inferior
104 shell.
105
106 @end ifnottex
107
108 @menu
109 * Introduction:: What IDLWAVE is and what not
110 * IDLWAVE in a Nutshell:: One page quick-start guide
111 * The IDLWAVE Major Mode:: The mode to edit IDL programs
112 * The IDLWAVE Shell:: The mode to run IDL as inferior program
113 * Installation:: How to Install or Upgrade
114 * Acknowledgement:: Who helped
115 * Sources of Routine Info:: How does IDLWAVE know about routine XYZ
116 * Configuration Examples:: The user is king...
117 * Index:: Fast access
118
119 @detailmenu --- The Detailed Node Listing ---
120
121 The IDLWAVE Major Mode
122
123 * Code Formatting:: Making code look nice
124 * Routine Info:: Calling Sequence and Keyword List
125 * Online Help:: One key press from source to help
126 * Completion:: Completing routine names and Keywords
127 * Routine Source:: How to visit the source file of routine XYZ
128 * Resolving Routines:: Force the Shell to compile a routine
129 * Code Templates:: Abbreviations for frequent constructs
130 * Actions:: Changing case, Padding, End checking
131 * Doc Header:: Inserting a standard header
132 * Motion Commands:: Moving through the structure of a program
133 * Misc Options:: Things that fit nowhere else
134
135 Code Formatting
136
137 * Code Indentation:: Reflecting the logical structure
138 * Comment Indentation:: Special indentation for comment lines
139 * Continuation Lines:: Splitting statements over lines
140 * Syntax Highlighting:: Font-lock support
141
142 Actions
143
144 * Block Boundary Check:: Is the END correct
145 * Padding Operators:: Enforcing space around `=' etc
146 * Case Changes:: Enforcing upper case keywords
147
148 The IDLWAVE Shell
149
150 * Starting the Shell:: How to launch IDL as a subprocess
151 * Using the Shell:: Interactively working with the Shell
152 * Debugging IDL Programs:: Compilation/Debugging
153
154 Debugging IDL Programs
155
156 * Compiling Programs:: Compiling buffers under the shell
157 * Breakpoints and Stepping:: Deciding where to stop and look
158 * Examining Variables:: What is the value now?
159
160 Installation
161
162 * Installing IDLWAVE:: How to install the distribution
163 * Installing Online Help:: Where to get the additional files needed
164 * Upgrading from idl.el:: Necessary configuration changes
165
166 Sources of Routine Info
167
168 * Routine Definitions:: Where IDL Routines are defined.
169 * Routine Information Sources:: So how does IDLWAVE know about...
170 * Library Scan:: Scanning the Libraries for Routine Info
171 * Load-Path Shadows:: Routines defined in several places
172 * Documentation Scan:: Scanning the IDL Manuals
173
174 @end detailmenu
175 @end menu
176
177 @node Introduction, IDLWAVE in a Nutshell, Top, Top
178 @chapter Introduction
179 @cindex Introduction
180 @cindex CORBA (Common Object Request Broker Architecture)
181 @cindex Interface Definition Language
182 @cindex Interactive Data Language
183 @cindex cc-mode.el
184 @cindex @file{idl.el}
185 @cindex @file{idl-shell.el}
186 @cindex Feature overview
187
188 IDLWAVE is a package to support editing command files for the
189 Interactive Data Language (IDL), and for running IDL as an inferior
190 shell. It also can be used for WAVE/CL command files, but the support
191 for these is limited. Note that this package has nothing to do with the
192 Interface Definition Language as part of the Common Object Request
193 Broker Architecture (CORBA).
194
195 IDLWAVE is the successor to the @file{idl.el} and @file{idl-shell.el}
196 files written by Chris Chase. The modes and files had to be renamed
197 because of a name space conflict with CORBAs @code{idl-mode}, defined in
198 Emacs in the file @file{cc-mode.el}. If you have been using the old
199 files, check @ref{Upgrading from idl.el} for information on how to
200 switch.
201
202 IDLWAVE consists of two parts: A major mode for editing command files
203 (@code{idlwave-mode}) and a mode to allow running the IDL program as an
204 inferior shell (@code{idlwave-shell-mode}). Both modes work closely
205 together and form a complete development environment.
206
207 Here is a brief summary of what IDLWAVE does.
208
209 @itemize @bullet
210 @item
211 Code indentation and formatting.
212 @item
213 Font-lock support on three levels.
214 @item
215 Display of calling sequence and keywords of more than 1000 IDL
216 routines routines and any routines in your local IDL library.
217 @item
218 Name space conflict search.
219 @item
220 Fast context-sensitive online help.
221 @item
222 Context sensitive completion of routine names and keywords.
223 @item
224 Insertion of code templates.
225 @item
226 Actions to enforce coding standards during typing.
227 @item
228 Block structure check.
229 @item
230 Support for @file{imenu} (Emacs) and @file{func-menu} (XEmacs).
231 @item
232 Documentation support.
233 @item
234 Running IDL as inferior process.
235 @item
236 Shell with history search, command line editing and completion.
237 @item
238 Compilation, execution and debugging of programs directly from the source
239 buffer.
240 @item
241 Examining expressions with a mouse click.
242 @end itemize
243
244 @ifnottex
245 @cindex Screenshots
246 Here are a number of screenshots showing IDLWAVE in action.
247
248 @itemize @bullet
249 @item
250 @uref{http://www.strw.leidenuniv.nl/~dominik/Tools/idlwave/font-lock.gif,
251 XEmacs 21.1 with formatted and fontified code}
252 @item
253 @uref{http://www.strw.leidenuniv.nl/~dominik/Tools/idlwave/rinfo.gif,
254 XEmacs 21.1 displaying routine info}
255 @item
256 @uref{http://www.strw.leidenuniv.nl/~dominik/Tools/idlwave/complete.gif,
257 XEmacs 21.1 completing a keyword}
258 @item
259 @uref{http://www.strw.leidenuniv.nl/~dominik/Tools/idlwave/shell.gif,
260 XEmacs 21.1 with debugging toolbar; execution stopped at a breakpoint}
261 @end itemize
262 @end ifnottex
263
264 In this manual, each section contains a list of user options related to
265 the subject. Don't be confused by the shear number of options available
266 -- in most cases the default settings are just fine. The variables are
267 listed here to make sure you know where to look if you want to change
268 things. For a full description of what a particular variable does and
269 how to configure it, see the documentation string of that variable.
270 Some configuration examples are also given in the appendix.
271
272 @node IDLWAVE in a Nutshell, The IDLWAVE Major Mode, Introduction, Top
273 @chapter IDLWAVE in a Nutshell
274 @cindex Quick-Start
275 @cindex Getting Started
276 @cindex Summary of important commands
277 @cindex IDLWAVE in a Nutshell
278 @cindex Nutshell, IDLWAVE in a
279
280 @subheading Editing IDL Programs
281
282 @multitable @columnfractions .15 .85
283 @item @key{TAB}
284 @tab Indent the current line relative to context.
285 @item @kbd{M-C-\}
286 @tab Re-indent all lines in the current region.
287 @item @kbd{M-@key{RET}}
288 @tab Start a continuation line. Or split the current line at point.
289 @item @kbd{M-q}
290 @tab Fill the current comment paragraph.
291 @item @kbd{C-c ?}
292 @tab Display calling sequence, keywords of the procedure/function call
293 at point.
294 @item @kbd{M-?}
295 @tab Context sensitive online help.
296 @item @kbd{M-@key{TAB}}
297 @tab Complete a procedure name, function name or keyword in the buffer.
298 @item @kbd{C-c C-i}
299 @tab Update IDLWAVE's knowledge about functions and procedures.
300 @item @kbd{C-c C-v}
301 @tab Find the source code of a procedure/function.
302 @item @kbd{C-c C-h}
303 @tab Insert a standard documentation header.
304 @item @kbd{C-c C-m}
305 @tab Insert a new timestamp and history item in the documentation header.
306 @end multitable
307
308 @subheading Running the IDLWAVE Shell, Debugging Programs
309
310 @multitable @columnfractions .15 .85
311 @item @kbd{C-c C-s}
312 @tab Start IDL as a subprocess and/or switch to the interaction buffer.
313 @item @kbd{M-p}
314 @tab Cycle back through IDL command history matching command line input.
315 @item @kbd{M-n}
316 @tab Cycle forward.
317 @item @kbd{M-@key{TAB}}
318 @tab Complete a procedure name, function name or keyword in the shell buffer.
319 @item @kbd{C-c C-d C-c}
320 @tab Save and compile the source file in the current buffer.
321 @item @kbd{C-c C-d C-x}
322 @tab Goto next syntax error.
323 @item @kbd{C-c C-d C-b}
324 @tab Set a breakpoint at the current source line.
325 @item @kbd{C-c C-d C-d}
326 @tab Clear the current breakpoint.
327 @item @kbd{C-c C-d C-p}
328 @tab Ask IDL to print the value of the expression near point.
329 @end multitable
330
331 @subheading Commonly used Settings in @file{.emacs}
332 @lisp
333 ;; Change the indentation preferences
334 (setq idlwave-main-block-indent 2 ; default 0
335 idlwave-block-indent 2 ; default 4
336 idlwave-end-offset -2) ; default -4
337 ;; Pad some operators with spaces
338 (setq idlwave-do-actions t
339 idlwave-surround-by-blank t)
340 ;; Automatically expand END to ENDIF, ENDELSE, ...
341 (setq idlwave-expand-generic-end t)
342 ;; Syntax Highlighting
343 (add-hook 'idlwave-mode-hook 'turn-on-font-lock)
344 ;; Automatically start the shell when needed, in dedicated frame
345 (setq idlwave-shell-automatic-start t
346 idlwave-shell-use-dedicated-frame t)
347 ;; Where are the online help files?
348 (setq idlwave-help-directory "~/.idlwave")
349 @end lisp
350
351 @node The IDLWAVE Major Mode, The IDLWAVE Shell, IDLWAVE in a Nutshell, Top
352 @chapter The IDLWAVE Major Mode
353 @cindex IDLWAVE major mode
354 @cindex Major mode, @code{idlwave-mode}
355
356 The IDLWAVE major mode supports editing IDL and WAVE/CL command files.
357 In this chapter we describe the main features of the mode and how to
358 customize them.
359
360 @menu
361 * Code Formatting:: Making code look nice
362 * Routine Info:: Calling Sequence and Keyword List
363 * Online Help:: One key press from source to help
364 * Completion:: Completing routine names and Keywords
365 * Routine Source:: How to visit the source file of routine XYZ
366 * Resolving Routines:: Force the Shell to compile a routine
367 * Code Templates:: Abbreviations for frequent constructs
368 * Actions:: Changing case, Padding, End checking
369 * Doc Header:: Inserting a standard header
370 * Motion Commands:: Moving through the structure of a program
371 * Misc Options:: Things that fit nowhere else
372 @end menu
373
374 @node Code Formatting, Routine Info, The IDLWAVE Major Mode, The IDLWAVE Major Mode
375 @section Code Formatting
376 @cindex Code formatting
377 @cindex Formatting, of code
378
379 @menu
380 * Code Indentation:: Reflecting the logical structure
381 * Comment Indentation:: Special indentation for comment lines
382 * Continuation Lines:: Splitting statements over lines
383 * Syntax Highlighting:: Font-lock support
384 @end menu
385
386 @node Code Indentation, Comment Indentation, Code Formatting, Code Formatting
387 @subsection Code Indentation
388 @cindex Code indentation
389 @cindex Indentation
390
391 Like all Emacs programming modes, IDLWAVE performs code indentation.
392 The @key{TAB} key indents the current line relative to context.
393 @key{LFD} insert a newline and indents the new line. The indentation is
394 governed by a number of variables.
395
396 @cindex Foreign code, adapting
397 @cindex Indentation, of foreign code
398 @kindex M-C-\
399 To re-indent a larger portion of code (e.g. when working with foreign code
400 written with different conventions), use @kbd{M-C-\}
401 (@code{indent-region}) after marking the relevant code. Useful marking
402 commands are @kbd{C-x h} (the entire file) or @kbd{M-C-h} (the
403 current subprogram). @xref{Actions}, for information how to impose
404 additional formatting conventions on foreign code.
405
406 @defopt idlwave-main-block-indent (@code{0})
407 Extra indentation for the main block of code. That is the block between
408 the FUNCTION/PRO statement and the END statement for that program
409 unit.
410 @end defopt
411
412 @defopt idlwave-block-indent (@code{5})
413 Extra indentation applied to block lines. If you change this, you
414 probably also want to change @code{idlwave-end-offset}.
415 @end defopt
416
417 @defopt idlwave-end-offset (@code{-4})
418 Extra indentation applied to block END lines. A value equal to negative
419 @code{idlwave-block-indent} will make END lines line up with the block
420 BEGIN lines.
421 @end defopt
422
423 @defopt idlwave-continuation-indent (@code{2})
424 Extra indentation applied to continuation lines and inside unbalanced
425 parenthesis.
426 @end defopt
427
428 @node Comment Indentation, Continuation Lines, Code Indentation, Code Formatting
429 @subsection Comment Indentation
430 @cindex Comment indentation
431 @cindex Hanging paragraphs
432 @cindex Paragraphs, filling
433 @cindex Paragraphs, hanging
434
435 In IDL, lines starting with a @samp{;} are called @emph{comment lines}.
436 Comment lines are indented as follows:
437
438 @multitable @columnfractions .1 .90
439 @item @code{;;;}
440 @tab The indentation of lines starting with three semicolons remains
441 unchanged.
442 @item @code{;;}
443 @tab Lines starting with two semicolons are indented like the surrounding code.
444 @item @code{;}
445 @tab Lines starting with a single semicolon are indent to a minimum column.
446 @end multitable
447
448 @noindent
449 The indentation of comments starting in column 0 is never changed.
450
451 @defopt idlwave-no-change-comment
452 The indentation of a comment starting with this regexp will not be changed.
453 @end defopt
454
455 @defopt idlwave-begin-line-comment
456 A comment anchored at the beginning of line.
457 @end defopt
458
459 @defopt idlwave-code-comment
460 A comment that starts with this regexp is indented as if it is a part of
461 IDL code.
462 @end defopt
463
464 @node Continuation Lines, Syntax Highlighting, Comment Indentation, Code Formatting
465 @subsection Continuation Lines and Filling
466 @cindex Continuation lines
467 @cindex Line splitting
468 @cindex String splitting
469 @cindex Splitting, of lines
470
471 @kindex M-@key{RET}
472 In IDL, a newline character terminates a statement unless preceded by a
473 @samp{$}. If you would like to start a continuation line, use
474 @kbd{M-@key{RET}} which calls the command @code{idlwave-split-line}. It
475 inserts a @samp{$} to indicate that the following line is a continuation
476 of the current line, terminates the line with a newline and indents the
477 new line. The command @kbd{M-@key{RET}} can also be used in the middle
478 of a line to split the line at that point. When used inside a long
479 string constant, the string is split with the @samp{+} concatenation
480 operator.
481
482 @cindex Filling
483 @cindex @code{auto-fill-mode}
484 @cindex Hanging paragraphs
485 When filling comment paragraphs, IDLWAVE overloads the normal filling
486 functions and uses a function which creates hanging paragraphs as they
487 are customary in the IDL routine headers. When @code{auto-fill-mode} is
488 turned on (toggle with @kbd{C-c C-a}), comments will be auto-filled. If
489 the first line of a paragraph is matched by
490 @code{idlwave-hang-indent-regexp}, subsequent lines are indented to
491 after the position of this match, as in the following example.
492
493 @example
494 ; INPUTS:
495 ; x - an array containing
496 ; lots of interesting numbers.
497 ;
498 ; y - another variable where
499 ; a hanging paragraph is used
500 ; to describe it.
501 @end example
502
503 @kindex M-q
504 You also refill a comment paragraph with @kbd{M-q}.
505
506 @defopt idlwave-fill-comment-line-only (@code{t})
507 Non-@code{nil} means auto fill will only operate on comment lines.
508 @end defopt
509
510 @defopt idlwave-auto-fill-split-string (@code{t})
511 Non-@code{nil} means auto fill will split strings with the IDL @samp{+}
512 operator.
513 @end defopt
514
515 @defopt idlwave-split-line-string (@code{t})
516 Non-@code{nil} means @code{idlwave-split-line} will split strings with
517 @samp{+}.
518 @end defopt
519
520 @defopt idlwave-hanging-indent (@code{t})
521 Non-@code{nil} means comment paragraphs are indented under the hanging
522 indent given by @code{idlwave-hang-indent-regexp} match in the first
523 line of the paragraph.
524 @end defopt
525
526 @defopt idlwave-hang-indent-regexp
527 Regular expression matching the position of the hanging indent
528 in the first line of a comment paragraph.
529 @end defopt
530
531 @defopt idlwave-use-last-hang-indent (@code{nil})
532 Non-@code{nil} means use last match on line for
533 @code{idlwave-indent-regexp}.
534 @end defopt
535
536 @node Syntax Highlighting, , Continuation Lines, Code Formatting
537 @subsection Syntax Highlighting
538 @cindex Syntax highlighting
539 @cindex Highlighting of syntax
540 @cindex Font lock
541
542 Highlighting of keywords, comments, strings etc. can be accomplished
543 with @code{font-lock}. If you are using @code{global-font-lock-mode}
544 (on Emacs), or have @code{font-lock} turned on in any other buffer in
545 XEmacs, it should also automatically work in IDLWAVE buffers. If not,
546 you can enforce it with the following line in your @file{.emacs}
547
548 @lisp
549 (add-hook 'idlwave-mode-hook 'turn-on-font-lock)
550 @end lisp
551
552 IDLWAVE supports 3 levels of syntax highlighting. The variable
553 @code{font-lock-maximum-decoration} determines which level is selected.
554
555 @defopt idlwave-default-font-lock-items
556 Items which should be fontified on the default fontification level
557 2.
558 @end defopt
559
560 @node Routine Info, Online Help, Code Formatting, The IDLWAVE Major Mode
561 @section Routine Info
562 @cindex Routine info
563 @cindex Updating routine info
564 @cindex Scanning buffers for routine info
565 @cindex Buffers, scanning for routine info
566 @cindex Shell, querying for routine info
567
568 @kindex C-c C-i
569 IDL defines more than one thousand procedures, functions and object
570 methods. This large command set makes it difficult to remember the
571 calling sequence and keywords of a command. IDLWAVE contains a list of
572 all builtin routines with calling sequences and keywords@footnote{This
573 list was created by scanning the IDL manual and might contain (very few)
574 errors. Please report any detected errors to the maintainer, so that
575 they can be fixed.}. It also scans Emacs buffers and library files for
576 routine definitions and queries the IDLWAVE-Shell for the properties of
577 modules currently compiled under the shell. This information is updated
578 automatically. If you think the information is not up-to-date, use
579 @kbd{C-c C-i} (@code{idlwave-update-routine-info}) to enforce a global
580 update.
581
582 @kindex C-c ?
583 To display the information about a routine, press @kbd{C-c ?} which
584 calls the command @code{idlwave-routine-info}. When the current cursor
585 position is on the name or in the argument list of a procedure or
586 function, information will be displayed about the routine. For example,
587 consider the cursor positions in the following line
588
589 @example
590 plot,x,alog(x+5*sin(x) + 2),
591 1 2 3 4 5 6 7 8
592 @end example
593
594 @cindex Default routine, for info and help
595 On positions 1,2 and 8, information about the @samp{plot} procedure will
596 be shown. On positions 3,4, and 7, the @samp{alog} function will be
597 described, while positions 5 and 6 will select the @samp{sin} function.
598 When you ask for routine information about an object method, and the
599 method exists in several classes, IDLWAVE queries for the class of the
600 object.
601
602 @cindex Calling sequences
603 @cindex Keywords of a routine
604 @cindex Routine source information
605 The description displayed contains the calling sequence, the list of
606 keywords and the source location of this routine. It looks like this:
607
608 @example
609 Usage: XMANAGER, NAME, ID
610 Keywords: BACKGROUND CATCH CLEANUP EVENT_HANDLER GROUP_LEADER
611 JUST_REG MODAL NO_BLOCK
612 Source: SystemLib [CSB] /soft1/idl53/lib/xmanager.pro
613 @end example
614
615 @cindex Categories, of routines
616 @cindex Load-path shadows
617 @cindex Shadows, load-path
618 @cindex IDL variable @code{!PATH}
619 @cindex @code{!PATH}, IDL variable
620 @cindex IDL variable @code{!DIR}
621 @cindex @code{!DIR}, IDL variable
622
623 If a definition of this routine exists in several files accessible to
624 IDLWAVE, several @samp{Source} lines will point to the different files.
625 This may indicate that your routine is shadowing a library routine,
626 which may or may not be what you want (@pxref{Load-Path Shadows}). The
627 information about the calling sequence and the keywords is derived from
628 the first source listed. Library routines can only be supported if you
629 have scanned the local IDL library (@pxref{Library Scan}). The source
630 entry consists of a @emph{source category}, a set of @emph{flags} and
631 the path to the @emph{source file}. The following categories
632 exist:
633
634 @multitable @columnfractions .15 .85
635 @item @i{System}
636 @tab A system routine, but we do not know if it is @i{Builtin} or
637 @i{SystemLib}. When the system library has bee scanned
638 (@pxref{Library Scan}), this category will automatically split into the
639 next two.
640 @item @i{Builtin}
641 @tab A builtin routine with no source code available.
642 @item @i{SystemLib}
643 @tab A library routine in the official lib directory @file{!DIR/lib}.
644 @item @i{Obsolete}
645 @tab A library routine in the official lib directory @file{!DIR/lib/obsolete}.
646 @item @i{Library}
647 @tab A file on IDL's search path @code{!PATH}.
648 @item @i{Other}
649 @tab Any other file not known to be on the search path.
650 @item @i{Unresolved}
651 @tab The shell lists this routine as unresolved.
652 @end multitable
653
654 You can define additional categories based on the file name and path
655 with the variable @code{idlwave-special-lib-alist}.
656
657 @cindex Flags, in routine info
658 @cindex Duplicate routines
659 @cindex Multiply defined routines
660 @cindex Routine definitions, multiple
661 The flags @code{[CSB]} indicate if the file is known to IDLWAVE from the
662 library catalog (@w{@code{[C--]}}, @pxref{Library Scan}), from the Shell
663 (@w{@code{[-S-]}}) or from an Emacs buffer (@w{@code{[--B]}}).
664 Combinations are possible. If a file contains multiple definitions of
665 the same routine, the file name will be prefixed with @samp{(Nx)} where
666 @samp{N} is the number of definitions.
667
668 @cindex Online Help from the routine info buffer
669 @cindex Active text, in routine info
670 @cindex Inserting keywords, from routine info
671 @cindex Source file, access from routine info
672 Some of the text in the @file{*Help*} buffer will be active (it
673 highlights when you move the mouse over it). Clicking on these items
674 will have the following effects:
675
676 @multitable @columnfractions 0.15 0.85
677 @item @i{Usage}
678 @tab If online help is installed, a click with the @emph{right} mouse
679 button on the @i{Usage:} line will access the help for the
680 routine (@pxref{Online Help}).
681 @item @i{Keyword}
682 @tab Online help about keywords is also available with the
683 @emph{right} mouse button. Clicking on a keyword with the @emph{middle}
684 mouse button will insert this keyword in the buffer from where
685 @code{idlwave-routine-info} was called. Holding down @key{SHIFT} while
686 clicking also adds the initial @samp{/}.
687 @item @i{Source}
688 @tab Clicking with the @emph{middle} mouse button on a @samp{Source} line
689 finds the source file of the routine and visits it in another window.
690 Another click on the same line switches back to the buffer from which
691 @kbd{C-c ?} was called. If you use the @emph{right} mouse button, the
692 source will not be visited by a buffer, but displayed in the online help
693 window.
694 @end multitable
695
696 @defopt idlwave-resize-routine-help-window (@code{t})
697 Non-@code{nil} means, resize the Routine-info @file{*Help*} window to
698 fit the content.
699 @end defopt
700
701 @defopt idlwave-special-lib-alist
702 Alist of regular expressions matching special library directories.
703 @end defopt
704
705 @defopt idlwave-rinfo-max-source-lines (@code{5})
706 Maximum number of source files displayed in the Routine Info window.
707 @end defopt
708
709 @page
710
711 @node Online Help, Completion, Routine Info, The IDLWAVE Major Mode
712 @section Online Help
713
714 @cindex Online Help
715 @cindex @file{idlw-help.txt}
716 @cindex @file{idlw-help.el}
717 @cindex IDL manual, ASCII version
718 @cindex Installing online help
719 @cindex Online Help, Installation
720 @cindex Speed, of online help
721 For IDL system routines, RSI provides extensive documentation. IDLWAVE
722 can access an ASCII version of this documentation very quickly and
723 accurately. This is @emph{much} faster than using the IDL online help
724 application, also because usually IDLWAVE gets you to the right place in
725 the docs directly, without additional browsing and scrolling. For this
726 online help to work, you need an ASCII version of the IDL documentation
727 which is not part of the standard IDLWAVE distribution. The required
728 files can be downloaded from @uref{@value{IDLWAVE-HOMEPAGE}, the
729 maintainers webpage}. As the text is extracted from PDF files, the
730 formatting of the help text is good for normal text, but graphics and
731 multiline equations will not be well represented. See also
732 @ref{Documentation Scan}.
733
734 @cindex Source code, as online help
735 @cindex DocLib header, as online help
736 For routines which are not documented in the IDL manual (for example
737 your own routines), the source code is used as help text. If the
738 requested information can be found in a (more or less) standard DocLib
739 file header, IDLWAVE shows the header. Otherwise the routine definition
740 statement (@code{pro}/@code{function}) is shown.
741
742 @kindex M-?
743 In any IDL program, press @kbd{M-?} (@code{idlwave-context-help}) or
744 click with @kbd{S-mouse-3} to access context sensitive online help. The
745 following locations are recognized as context:
746
747 @cindex Context, for online help
748 @multitable @columnfractions .25 .75
749 @item @i{Routine name}
750 @tab The name of a routine (function, procedure, method).
751 @item @i{Keyword Parameter}
752 @tab Keyword parameter of a routine.
753 @item @i{System Variable}
754 @tab System variable like @code{!DPI}.
755 @item @i{IDL Statement}
756 @tab Like @code{PRO}, @code{REPEAT}, or @code{COMPILE_OPT}.
757 @item @i{Class name}
758 @tab Class name in @code{OBJ_NEW} call.
759 @item @i{Executive Command}
760 @tab Executive command like @code{.RUN}. Mostly useful in the shell.
761 @item @i{Default}
762 @tab The routine that would be selected for routine info display.
763 @end multitable
764
765 @cindex @code{OBJ_NEW}, special online help
766 Note that the @code{OBJ_NEW} function is special in that the help
767 displayed depends on the cursor position: If the cursor is on the
768 @samp{OBJ_NEW}, this function is described. If it is on the class name
769 inside the quotes, the documentation for the class is pulled up. If the
770 cursor is @emph{after} the class name, anywhere in the argument list,
771 the documentation for the corresponding @code{Init} method and its
772 keywords is targeted.
773
774 @noindent Apart from source buffers, there are two more places from
775 which online help can be accessed.
776
777 @itemize @bullet
778 @item
779 Online help for routines and keywords can be accessed through the
780 Routine Info display. Click with @kbd{mouse-3} on an item to see the
781 corresponding help (@pxref{Routine Info}).
782 @item
783 When using completion and Emacs pops up a window with possible
784 completions, clicking with @kbd{mouse-3} on a completion item invokes
785 help on that item (@pxref{Completion}).
786 @end itemize
787 @noindent
788 In both cases, a blue face indicates that the item is documented in the
789 IDL manual.
790
791 @page
792
793 @cindex Help application, keybindings
794 @cindex Keybindings, in help application
795 The help window is normally displayed in a separate frame. The
796 following commands can be used to navigate inside the help system.
797
798 @multitable @columnfractions .15 .85
799 @item @kbd{@key{SPACE}}
800 @tab Scroll forward one page.
801 @item @kbd{@key{RET}}
802 @tab Scroll forward one line.
803 @item @kbd{@key{DEL}}
804 @tab Scroll back one page.
805 @item @kbd{n, p}
806 @tab Browse to the next or previous topic (in physical sequence).
807 @item @kbd{b, f}
808 @tab Move back and forward through the help topic history.
809 @item @kbd{c}
810 @tab Clear the history.
811 @item @kbd{mouse-2}
812 @tab Follow a link. Active links are displayed in a different font.
813 Items under @i{See Also} are active, and classes have links to their
814 methods and back.
815 @item @kbd{o}
816 @tab Open a topic. The topic can be selected with completion.
817 @item @kbd{*}
818 @tab Load the whole help file into Emacs, for global text searches.
819 @item @kbd{q}
820 @tab Kill the help window.
821 @end multitable
822
823 @sp 1
824 @noindent When the help text is a source file, the following commands
825 are also available.
826 @multitable @columnfractions .15 .85
827 @item @kbd{h}
828 @tab Jump to DocLib Header of the routine whose source is displayed
829 as help.
830 @item @kbd{H}
831 @tab Jump to the first DocLib Header in the file.
832 @item @kbd{.} @r{(Dot)}
833 @tab Jump back and forth between the routine definition (the
834 @code{pro}/@code{function} statement) and the description of the help
835 item in the DocLib header.
836 @item @kbd{F}
837 @tab Fontify the buffer like source code. See the variable @code{idlwave-help-fontify-source-code}.
838 @end multitable
839
840 @defopt idlwave-help-directory
841 The directory where idlw-help.txt and idlw-help.el are stored.
842 @end defopt
843
844 @defopt idlwave-help-use-dedicated-frame (@code{t})
845 Non-nil means, use a separate frame for Online Help if possible.
846 @end defopt
847
848 @defopt idlwave-help-frame-parameters
849 The frame parameters for the special Online Help frame.
850 @end defopt
851
852 @defopt idlwave-max-popup-menu-items (@code{20})
853 Maximum number of items per pane in popup menus.
854 @end defopt
855
856 @defopt idlwave-extra-help-function
857 Function to call for help if the normal help fails.
858 @end defopt
859
860 @defopt idlwave-help-fontify-source-code (@code{nil})
861 Non-nil means, fontify source code displayed as help.
862 @end defopt
863
864 @defopt idlwave-help-source-try-header (@code{t})
865 Non-nil means, try to find help in routine header when displaying source
866 file.
867 @end defopt
868
869 @defopt idlwave-help-link-face
870 The face for links to IDLWAVE online help.
871 @end defopt
872
873 @node Completion, Routine Source, Online Help, The IDLWAVE Major Mode
874 @section Completion
875 @cindex Completion
876 @cindex Keyword completion
877 @cindex Method completion
878 @cindex Object method completion
879 @cindex Class name completion
880 @cindex Function name completion
881 @cindex Procedure name completion
882
883 @kindex M-@key{TAB}
884 @kindex C-c C-i
885 IDLWAVE offers completion for class names, routine names and keywords.
886 As in many programming modes, completion is bound to @kbd{M-@key{TAB}}.
887 Completion uses the same internal information as routine info, so when
888 necessary it can be updated with @kbd{C-c C-i}
889 (@code{idlwave-update-routine-info}).
890
891 The completion function is context sensitive and figures out what to
892 complete at point. Here are example lines and what @kbd{M-@key{TAB}}
893 would try to complete when the cursor is on the position marked with a
894 @samp{*}.
895
896 @example
897 plo* @r{Procedure}
898 x = a* @r{Function}
899 plot,xra* @r{Keyword of @code{plot} procedure}
900 plot,x,y,/x* @r{Keyword of @code{plot} procedure}
901 plot,min(* @r{Keyword of @code{min} function}
902 obj -> a* @r{Object method (procedure)}
903 a(2,3) = obj -> a* @r{Object method (function)}
904 x = obj_new('IDL* @r{Class name}
905 x = obj_new('MyCl',a* @r{Keyword to @code{Init} method in class @code{MyCl}}
906 pro A* @r{Class name}
907 pro * @r{Fill in @code{Class::} of first method in this file}
908 @end example
909
910 @cindex Scrolling the @file{*Completions*} window
911 @cindex Completion, scrolling
912 @cindex Completion, Online Help
913 @cindex Online Help in @file{*Completions*} buffer
914 If the list of completions is too long to fit in the
915 @file{*Completions*} window, the window can be scrolled by pressing
916 @kbd{M-@key{TAB}} repeatedly. Online help (if installed) for each
917 possible completion is available by clicking with @kbd{mouse-3} on the
918 item. Items for which system online help (from the IDL manual) is
919 available will be displayed in a different font. For other items, the
920 corresponding source code or DocLib header is available as help text.
921
922 @cindex Case of completed words
923 @cindex Mixed case completion
924 The case of the completed words is determined by what is already in the
925 buffer. When the partial word being completed is all lower case, the
926 completion will be lower case as well. If at least one character is
927 upper case, the string will be completed in upper case or mixed case.
928 The default is to use upper case for procedures, functions and keywords,
929 and mixed case for object class names and methods, similar to the
930 conventions in the IDL manuals. These defaults can be changed with the
931 variable @code{idlwave-completion-case}.
932
933 @defopt idlwave-completion-case
934 Association list setting the case (UPPER/lower/Capitalized/...) of completed
935 words.
936 @end defopt
937
938 @defopt idlwave-completion-force-default-case (@code{nil})
939 Non-@code{nil} means, completion will always honor the settings in
940 @code{idlwave-completion-case}. When nil (the default), lower case
941 strings will be completed to lower case.
942 @end defopt
943
944 @defopt idlwave-complete-empty-string-as-lower-case (@code{nil})
945 Non-@code{nil} means, the empty string is considered lower case for
946 completion.
947 @end defopt
948
949 @defopt idlwave-keyword-completion-adds-equal (@code{t})
950 Non-@code{nil} means, completion automatically adds @samp{=} after
951 completed keywords.
952 @end defopt
953
954 @defopt idlwave-function-completion-adds-paren (@code{t})
955 Non-@code{nil} means, completion automatically adds @samp{(} after
956 completed function. A value of `2' means, also add the closing
957 parenthesis and position cursor between the two.
958 @end defopt
959
960 @defopt idlwave-completion-restore-window-configuration (@code{t})
961 Non-@code{nil} means, restore window configuration after successful
962 completion.
963 @end defopt
964
965 @defopt idlwave-highlight-help-links-in-completion (@code{t})
966 Non-nil means, highlight completions for which system help is available.
967 @end defopt
968
969 @subsubheading Object Method Completion and Class Ambiguity
970 @cindex Object methods
971 @cindex Class ambiguity
972 @cindex @code{self} object, default class
973 An object method is not uniquely determined without the object's class.
974 Since the class part is usually omitted in the source code, IDLWAVE
975 considers all available methods in all classes as possible completions
976 of an object method name. For keywords, the combined keywords of the
977 current method in all available classes will be considered. In the
978 @file{*Completions*} buffer, the classes allowed for each completion
979 will be shown next to the item (see option
980 @code{idlwave-completion-show-classes}). As a special case, the class
981 of an object called @samp{self} object is always the class of the
982 current routine.
983
984 @cindex Forcing class query.
985 @cindex Class query, forcing
986 You can also call @code{idlwave-complete} with a prefix arg: @kbd{C-u
987 M-@key{TAB}}. IDLWAVE will then prompt you for the class in order to
988 narrow down the number of possible completions. The variable
989 @code{idlwave-query-class} can be configured to make this behavior the
990 default (not recommended). After you have specified the class
991 for a particular statement (e.g. when completing the method), IDLWAVE
992 can remember it for the rest of the editing session. Subsequent
993 completions in the same statement (e.g. keywords) can then reuse this
994 class information. Remembering the class works by placing a text
995 property in the object operator @samp{->}. This is not enabled by
996 default - the variable @code{idlwave-store-inquired-class} can be used
997 to turn it on.
998
999 @defopt idlwave-completion-show-classes (@code{1})
1000 Non-@code{nil} means, show classes in @file{*Completions*} buffer when
1001 completing object methods and keywords.
1002 @end defopt
1003
1004 @defopt idlwave-completion-fontify-classes (@code{t})
1005 Non-@code{nil} means, fontify the classes in completions buffer.
1006 @end defopt
1007
1008 @defopt idlwave-query-class (@code{nil})
1009 Association list governing query for object classes during completion.
1010 @end defopt
1011
1012 @defopt idlwave-store-inquired-class (@code{nil})
1013 Non-@code{nil} means, store class of a method call as text property on
1014 @samp{->}.
1015 @end defopt
1016
1017 @defopt idlwave-class-arrow-face
1018 Face to highlight object operator arrows @samp{->} which carry a class
1019 text property.
1020 @end defopt
1021
1022 @node Routine Source, Resolving Routines, Completion, The IDLWAVE Major Mode
1023
1024 @section Routine Source
1025 @cindex Routine source file
1026 @cindex Module source file
1027 @cindex Source file, of a routine
1028 @kindex C-c C-v
1029 Apart from clicking on a @i{Source:} line in the routine info window,
1030 there is also another way to find the source file of a routine. The
1031 command @kbd{C-c C-v} (@code{idlwave-find-module}) asks for a module
1032 name, offering the same default as @code{idlwave-routine-info} would
1033 have used. In the minibuffer, specify a complete routine name
1034 (including the class part). IDLWAVE will display the source file in
1035 another window.
1036
1037 @cindex Buffers, killing
1038 @cindex Killing autoloaded buffers
1039 Since getting the source of a routine into a buffer is so easy with
1040 IDLWAVE, too many buffers visiting different IDL source files are
1041 sometimes created. The special command @kbd{C-c C-k}
1042 (@code{idlwave-kill-autoloaded-buffers}) can be used to remove these
1043 buffers.
1044
1045 @node Resolving Routines, Code Templates, Routine Source, The IDLWAVE Major Mode
1046 @section Resolving Routines
1047 @cindex @code{RESOLVE_ROUTINE}
1048 @cindex Compiling library modules
1049 @cindex Routines, resolving
1050
1051 The key sequence @kbd{C-c =} calls the command @code{idlwave-resolve}
1052 and sends the line @samp{RESOLVE_ROUTINE, '@var{routine_name}'} to IDL
1053 in order to resolve (compile) it. The default routine to be resolved is
1054 taken from context, but you get a chance to edit it.
1055
1056 @code{idlwave-resolve} is one way to get a library module within reach
1057 of IDLWAVE's routine info collecting functions. A better way is to
1058 scan (parts of) the library (@pxref{Library Scan}). Routine info on
1059 library modules will then be available without the need to compile the
1060 modules first, and even without a running shell.
1061
1062 @xref{Sources of Routine Info}, for in-depth information where IDLWAVE
1063 collects data about routines, and how to update this information.
1064
1065
1066 @node Code Templates, Actions, Resolving Routines, The IDLWAVE Major Mode
1067 @section Code Templates
1068 @cindex Code templates
1069 @cindex Abbreviations
1070 @cindex Templates
1071
1072 IDLWAVE can insert IDL code templates into the buffer. For a few
1073 templates, this is done with direct keybindings:
1074
1075 @multitable @columnfractions .15 .85
1076 @item @kbd{C-c C-c}
1077 @tab @code{CASE} statement template
1078 @item @kbd{C-c C-f}
1079 @tab @code{FOR} loop template
1080 @item @kbd{C-c C-r}
1081 @tab @code{REPEAT} loop template
1082 @item @kbd{C-c C-w}
1083 @tab @code{WHILE} loop template
1084 @end multitable
1085
1086 Otherwise, special abbreviations are used. Emacs abbreviations are
1087 expanded by typing text into the buffer and pressing @key{SPC} or
1088 @key{RET}. The special abbreviations used to insert code templates all
1089 start with a @samp{\} (the backslash). Here are a few examples of
1090 predefined abbreviations. For a full list, use @kbd{M-x
1091 idlwave-list-abbrevs}.
1092
1093 @multitable @columnfractions .15 .85
1094 @item @code{\pr}
1095 @tab @code{PROCEDURE} template
1096 @item @code{\fu}
1097 @tab @code{FUNCTION} template
1098 @item @code{\c}
1099 @tab @code{CASE} statement template
1100 @item @code{\f}
1101 @tab @code{FOR} loop template
1102 @item @code{\r}
1103 @tab @code{REPEAT} loop template
1104 @item @code{\w}
1105 @tab @code{WHILE} loop template
1106 @item @code{\i}
1107 @tab @code{IF} statement template
1108 @item @code{\elif}
1109 @tab @code{IF-ELSE} statement template
1110 @item @code{\b}
1111 @tab @code{BEGIN}
1112 @end multitable
1113
1114 The templates are expanded in upper or lower case, depending upon the
1115 variables @code{idlwave-abbrev-change-case} and
1116 @code{idlwave-reserved-word-upcase}.
1117
1118 @defopt idlwave-abbrev-start-char
1119 A single character string used to start abbreviations in abbrev
1120 mode.
1121 @end defopt
1122
1123 @defopt idlwave-abbrev-move (@code{t})
1124 Non-@code{nil} means the abbrev hook can move point, e.g. to end up
1125 between the parenthesis of a function call.
1126 @end defopt
1127
1128 @node Actions, Doc Header, Code Templates, The IDLWAVE Major Mode
1129 @section Actions
1130 @cindex Actions
1131 @cindex Coding standards, enforcing
1132
1133 @emph{Actions} are special commands which are executed automatically
1134 while you write code in order to check the structure of the program or
1135 to enforce coding standards. Most actions which have been implemented
1136 in IDLWAVE are turned off by default, assuming that the average user
1137 wants her code the way she writes it. But if you are a lazy typist and
1138 want your code to adhere to certain standards, they can be
1139 helpful.
1140
1141 Action can be applied in three ways:
1142
1143 @itemize @bullet
1144 @item
1145 Some actions are applied directly while typing. For example, pressing
1146 @samp{=} can run a check to make sure that this operator is surrounded
1147 by spaces and insert these spaces if necessary. Pressing @key{SPC}
1148 after a reserved word can call a command to change the word to upper
1149 case.
1150 @item
1151 When a line is re-indented with @key{TAB}, actions can be applied to the
1152 entire line. To enable this, the variable @code{idlwave-do-actions}
1153 must be non-@code{nil}.
1154 @item
1155 @cindex Foreign code, adapting
1156 @cindex Actions, applied to foreign code
1157 Action can also be applied to a larger piece of code, e.g. in order to
1158 convert foreign code to your own style. To do this, mark the relevant
1159 part of the code and execute @kbd{M-x expand-region-abbrevs}. Useful
1160 marking commands are @kbd{C-x h} (the entire file) or @kbd{M-C-h} (the
1161 current subprogram). @xref{Code Indentation}, for information how to
1162 adjust the indentation of the code.
1163 @end itemize
1164
1165 @defopt idlwave-do-actions (@code{nil})
1166 Non-@code{nil} means performs actions when indenting.
1167 @end defopt
1168
1169 @menu
1170 * Block Boundary Check:: Is the END correct
1171 * Padding Operators:: Enforcing space around `=' etc
1172 * Case Changes:: Enforcing upper case keywords
1173 @end menu
1174
1175 @node Block Boundary Check, Padding Operators, Actions, Actions
1176 @subsection Block Boundary Check
1177 @cindex Block boundary check
1178 @cindex @code{END} type checking
1179 @cindex @code{END}, automatic insertion
1180 @cindex @code{END}, expanding
1181 @cindex Block, closing
1182 @cindex Closing a block
1183
1184 Whenever you type an @code{END} statement, IDLWAVE finds the
1185 corresponding start of the block and the cursor blinks back to that
1186 location for a second. If you have typed a specific @code{END}, like
1187 @code{ENDIF} or @code{ENDCASE}, you get a warning if that kind of END
1188 does not match the type of block it terminates.
1189
1190 Set the variable @code{idlwave-expand-generic-end} in order to have all
1191 generic @code{END} statements automatically expanded to a specific type.
1192 You can also type @kbd{C-c ]} to close the current block by inserting
1193 the appropriate @code{END} statement.
1194
1195 @defopt idlwave-show-block (@code{t})
1196 Non-@code{nil} means point blinks to block beginning for
1197 @code{idlwave-show-begin}.
1198 @end defopt
1199
1200 @defopt idlwave-expand-generic-end (@code{nil})
1201 Non-@code{nil} means expand generic END to ENDIF/ENDELSE/ENDWHILE etc.
1202 @end defopt
1203
1204 @defopt idlwave-reindent-end (@code{t})
1205 Non-nil means re-indent line after END was typed.
1206 @end defopt
1207
1208 @node Padding Operators, Case Changes, Block Boundary Check, Actions
1209 @subsection Padding Operators
1210 @cindex Padding operators with spaces
1211 @cindex Operators, padding with spaces
1212 @cindex Space, around operators
1213
1214 Some operators can be automatically surrounded by spaces. This can
1215 happen when the operator is typed, or also later when the line is
1216 indented. IDLWAVE contains this setting for the operators @samp{&},
1217 @samp{<}, @samp{>}, @samp{,}, @samp{=}, and @samp{->}@footnote{Operators
1218 longer than one character can only be padded during line indentation.},
1219 but the feature is turned off by default. If you want to turn it on,
1220 customize the variables @code{idlwave-surround-by-blank} and
1221 @code{idlwave-do-actions}. You can also define similar actions for
1222 other operators by using the function @code{idlwave-action-and-binding}
1223 in the mode hook. For example, to enforce space padding of the @samp{+}
1224 and @samp{*} operators, try this in @file{.emacs}
1225
1226 @lisp
1227 (add-hook 'idlwave-mode-hook
1228 (lambda ()
1229 (setq idlwave-surround-by-blank t) ; Turn this type of actions on
1230 (idlwave-action-and-binding "*" '(idlwave-surround 1 1))
1231 (idlwave-action-and-binding "+" '(idlwave-surround 1 1))))
1232 @end lisp
1233
1234 @defopt idlwave-surround-by-blank (@code{nil})
1235 Non-@code{nil} means, enable @code{idlwave-surround}. If non-nil,
1236 @samp{=}, @samp{<}, @samp{>}, @samp{&}, @samp{,}, @samp{->} are
1237 surrounded with spaces by @code{idlwave-surround}.
1238 @end defopt
1239
1240 @defopt idlwave-pad-keyword (@code{t})
1241 Non-@code{nil} means pad @samp{=} for keywords like assignments.
1242 @end defopt
1243
1244 @node Case Changes, , Padding Operators, Actions
1245 @subsection Case Changes
1246 @cindex Case changes
1247 @cindex Upcase, enforcing for reserved words
1248 @cindex Downcase, enforcing for reserved words
1249
1250 Actions can be used to change the case of reserved words or expanded
1251 abbreviations by customizing the variables
1252 @code{idlwave-abbrev-change-case} and
1253 @code{idlwave-reserved-word-upcase}. If you want to change the case of
1254 additional words automatically, put something like the following into
1255 your @file{.emacs} file:
1256
1257 @lisp
1258 (add-hook 'idlwave-mode-hook
1259 (lambda ()
1260 ;; Capitalize system vars
1261 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)
1262 ;; Capitalize procedure name
1263 (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
1264 '(capitalize-word 1) t)
1265 ;; Capitalize common block name
1266 (idlwave-action-and-binding "\\<common\\>[ \t]+\\<"
1267 '(capitalize-word 1) t)))
1268 @end lisp
1269
1270 For more information, see the documentation string for the function
1271 @code{idlwave-action-and-binding}.
1272
1273 @defopt idlwave-abbrev-change-case (@code{nil})
1274 Non-@code{nil} means all abbrevs will be forced to either upper or lower
1275 case. Legal values are @code{nil}, @code{t}, and @code{down}.
1276 @end defopt
1277
1278 @defopt idlwave-reserved-word-upcase (@code{nil})
1279 Non-@code{nil} means, reserved words will be made upper case via abbrev
1280 expansion.
1281 @end defopt
1282
1283
1284 @node Doc Header, Motion Commands, Actions, The IDLWAVE Major Mode
1285 @section Documentation Header
1286 @cindex Documentation header
1287 @cindex DocLib header
1288 @cindex Modification timestamp
1289 @cindex Header, for file documentation
1290 @cindex Timestamp, in doc header.
1291 @cindex Changelog, in doc header.
1292
1293 @kindex C-c C-h
1294 @kindex C-c C-m
1295 The command @kbd{C-c C-h} inserts a standard routine header into the
1296 buffer, with the usual fields for documentation. One of the keywords is
1297 @samp{MODIFICATION HISTORY} under which the changes to a routine can be
1298 recorded. The command @kbd{C-c C-m} jumps to the @samp{MODIFICATION
1299 HISTORY} of the current routine or file and inserts the user
1300 name with a timestamp.
1301
1302 @defopt idlwave-file-header
1303 The doc-header template or a path to a file containing it.
1304 @end defopt
1305
1306 @defopt idlwave-timestamp-hook
1307 The hook function used to update the timestamp of a function.
1308 @end defopt
1309
1310 @defopt idlwave-doc-modifications-keyword
1311 The modifications keyword to use with the log documentation commands.
1312 @end defopt
1313
1314 @defopt idlwave-doclib-start
1315 Regexp matching the start of a document library header.
1316 @end defopt
1317
1318 @defopt idlwave-doclib-end
1319 Regexp matching the start of a document library header.
1320 @end defopt
1321
1322 @node Motion Commands, Misc Options, Doc Header, The IDLWAVE Major Mode
1323 @section Motion Commands
1324 @cindex Motion commands
1325 @cindex Program structure, moving through
1326 @cindex Code structure, moving through
1327 @cindex @file{Func-menu}, XEmacs package
1328 @cindex @file{Imenu}, Emacs package
1329 @cindex Function definitions, jumping to
1330 @cindex Procedure definitions, jumping to
1331
1332 IDLWAVE supports both @file{Imenu} and @file{Func-menu}, two packages
1333 which make it easy to jump to the definitions of functions and
1334 procedures in the current file.
1335
1336 Several commands allow to move quickly through the structure of an IDL
1337 program. These are
1338
1339 @multitable @columnfractions .15 .85
1340 @item @kbd{C-M-a}
1341 @tab Beginning of subprogram
1342 @item @kbd{C-M-e}
1343 @tab End of subprogram
1344 @item @kbd{C-c @{}
1345 @tab Beginning of block (stay inside the block)
1346 @item @kbd{C-c @}}
1347 @tab End of block (stay inside the block)
1348 @item @kbd{M-C-n}
1349 @tab Forward block (on same level)
1350 @item @kbd{M-C-p}
1351 @tab Backward block (on same level)
1352 @item @kbd{M-C-d}
1353 @tab Down block (enters a block)
1354 @item @kbd{M-C-u}
1355 @tab Backward up block (leaves a block)
1356 @item @kbd{C-c C-n}
1357 @tab Next Statement
1358 @end multitable
1359
1360
1361 @node Misc Options, , Motion Commands, The IDLWAVE Major Mode
1362 @section Miscellaneous Options
1363 @cindex Hooks
1364
1365 @defopt idlwave-help-application
1366 The external application providing reference help for programming.
1367 @end defopt
1368
1369 @defopt idlwave-startup-message (@code{t})
1370 Non-@code{nil} means display a startup message when @code{idlwave-mode}'
1371 is first called.
1372 @end defopt
1373
1374 @defopt idlwave-mode-hook
1375 Normal hook. Executed when a buffer is put into @code{idlwave-mode}.
1376 @end defopt
1377
1378 @defopt idlwave-load-hook
1379 Normal hook. Executed when @file{idlwave.el} is loaded.
1380 @end defopt
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397 @node The IDLWAVE Shell, Installation, The IDLWAVE Major Mode, Top
1398 @chapter The IDLWAVE Shell
1399 @cindex IDLWAVE shell
1400 @cindex Major mode, @code{idlwave-shell-mode}
1401 @cindex IDL, as Emacs subprocess
1402 @cindex Subprocess of Emacs, IDL
1403 @cindex Comint, Emacs package
1404 @cindex Windows
1405 @cindex MacOS
1406 @cindex Unix
1407
1408 The IDLWAVE shell is an Emacs major mode which allows to run the IDL
1409 program as an inferior process of Emacs. It can be used to work with
1410 IDL interactively, to compile and run IDL programs in Emacs buffers and
1411 to debug these programs. The IDLWAVE shell uses @file{comint}, an Emacs
1412 packages which handles the communication with the IDL program.
1413 Unfortunately IDL for Windows and MacOS does not allow the interaction
1414 with Emacs@footnote{Please inform the maintainer if you come up with a way
1415 to make the IDLWAVE shell work on these systems.} - so the IDLWAVE shell
1416 only works under Unix.
1417
1418 @menu
1419 * Starting the Shell:: How to launch IDL as a subprocess
1420 * Using the Shell:: Interactively working with the Shell
1421 * Debugging IDL Programs:: Compilation/Debugging
1422 @end menu
1423
1424 @node Starting the Shell, Using the Shell, The IDLWAVE Shell, The IDLWAVE Shell
1425 @section Starting the Shell
1426 @cindex Starting the shell
1427 @cindex Shell, starting
1428 @cindex Dedicated frame, for shell buffer
1429 @cindex Frame, for shell buffer
1430 @cindex Subprocess of Emacs, IDL
1431
1432 @kindex C-c C-s
1433 The IDLWAVE shell can be started with the command @kbd{M-x
1434 idlwave-shell}. In @code{idlwave-mode} the function is bound to
1435 @kbd{C-c C-s}. It creates a buffer @file{*idl*} which is used to
1436 interact with the shell. If the shell is already running, @kbd{C-c C-s}
1437 will simple switch to the shell buffer. The command @kbd{C-c C-l}
1438 (@code{idlwave-shell-recenter-shell-window}) displays the
1439 shell window without selecting it.
1440
1441 In order to create a separate frame for the IDLWAVE shell buffer, call
1442 @code{idlwave-shell} with a prefix argument: @kbd{C-u C-c C-s} or
1443 @kbd{C-u C-c C-l}. If you always want a dedicated frame for the shell
1444 window, configure the variable
1445 @code{idlwave-shell-use-dedicated-frame}.
1446
1447 The shell can also be started automatically when another command tries
1448 to send a command to it. To enable auto start, set the variable
1449 @code{idlwave-shell-automatic-start} to @code{t}.
1450
1451 @defopt idlwave-shell-explicit-file-name
1452 This is the command to run IDL.
1453 @end defopt
1454
1455 @defopt idlwave-shell-command-line-options
1456 A list of command line options for calling the IDL program.
1457 @end defopt
1458
1459 @defopt idlwave-shell-prompt-pattern
1460 Regexp to match IDL prompt at beginning of a line.
1461 @end defopt
1462
1463 @defopt idlwave-shell-process-name
1464 Name to be associated with the IDL process.
1465 @end defopt
1466
1467 @defopt idlwave-shell-automatic-start
1468 Non-@code{nil} means attempt to invoke idlwave-shell if not already
1469 running.
1470 @end defopt
1471
1472 @defopt idlwave-shell-initial-commands
1473 Initial commands, separated by newlines, to send to IDL.
1474 @end defopt
1475
1476 @defopt idlwave-shell-use-dedicated-frame (@code{nil})
1477 Non-@code{nil} means, IDLWAVE should use a special frame to display
1478 shell buffer.
1479 @end defopt
1480
1481 @defopt idlwave-shell-frame-parameters
1482 The frame parameters for a dedicated idlwave-shell frame.
1483 @end defopt
1484
1485 @defopt idlwave-shell-temp-pro-prefix
1486 The prefix for temporary IDL files used when compiling regions.
1487 @end defopt
1488
1489 @cindex Hooks
1490 @defopt idlwave-shell-mode-hook
1491 Hook for customizing @code{idlwave-shell-mode}.
1492 @end defopt
1493
1494 @node Using the Shell, Debugging IDL Programs, Starting the Shell, The IDLWAVE Shell
1495 @section Using the Shell
1496 @cindex Comint
1497 @cindex Shell, basic commands
1498
1499 The IDLWAVE shell works in the same fashion as other shell modes in
1500 Emacs. It provides command history, command line editing and job
1501 control. Here is a list of commonly used commands.
1502
1503 @multitable @columnfractions .12 .88
1504 @item @kbd{M-p}
1505 @tab Cycle backwards in input history matching input
1506 @item @kbd{M-n}
1507 @tab Cycle forwards
1508 @item @kbd{M-r}
1509 @tab Previous input matching a regexp
1510 @item @kbd{M-s}
1511 @tab Next input that matches a regexp
1512 @item @kbd{return}
1513 @tab Send input or copy line to current prompt
1514 @item @kbd{C-c C-a}
1515 @tab Beginning of line; skip prompt
1516 @item @kbd{C-c C-u}
1517 @tab Kill input to beginning of line
1518 @item @kbd{C-c C-w}
1519 @tab Kill word before cursor
1520 @item @kbd{C-c C-c}
1521 @tab Send ^C
1522 @item @kbd{C-c C-z}
1523 @tab Send ^Z
1524 @item @kbd{C-c C-\}
1525 @tab Send ^\
1526 @item @kbd{C-c C-o}
1527 @tab Delete last batch of process output
1528 @item @kbd{C-c C-r}
1529 @tab Show last batch of process output
1530 @item @kbd{C-c C-l}
1531 @tab List input history
1532 @end multitable
1533
1534 In addition to these standard @file{comint} commands,
1535 @code{idlwave-shell-mode} provides many of the commands which simplify
1536 writing IDL code, including abbreviations, online help, and completion.
1537 See @ref{Routine Info} and @ref{Online Help} and @ref{Completion} for more
1538 information on these commands.
1539
1540 @cindex Completion, in the shell
1541 @cindex Routine info, in the shell
1542 @cindex Online Help, in the shell
1543 @multitable @columnfractions .12 .88
1544 @item @kbd{@key{TAB}}
1545 @tab Completion of file names, routine names and keywords
1546 (@code{idlwave-shell-complete})
1547 @item @kbd{M-@key{TAB}}
1548 @tab Same as @key{TAB}
1549 @item @kbd{C-c ?}
1550 @tab Routine Info display (@code{idlwave-routine-info})
1551 @item @kbd{M-?}
1552 @tab IDL online help on routine (@code{idlwave-routine-info-from-idlhelp})
1553 @item @kbd{C-c C-i}
1554 @tab Update routine info from buffers and shell
1555 (@code{idlwave-update-routine-info})
1556 @item @kbd{C-c C-v}
1557 @tab Find the source file of a routine (@code{idlwave-find-module})
1558 @item @kbd{C-c =}
1559 @tab Compile a library routine (@code{idlwave-resolve})
1560 @end multitable
1561
1562 @defopt idlwave-shell-file-name-chars
1563 The characters allowed in file names, as a string. Used for file name
1564 completion.
1565 @end defopt
1566
1567 @page
1568 @cindex Input mode
1569 @cindex Character input mode (Shell)
1570 @cindex Line input mode (Shell)
1571 @cindex Magic spells, for input mode
1572 @cindex Spells, magic
1573 IDLWAVE works in line input mode: You compose a full command line, using
1574 all the power Emacs gives you to do this. When you press @key{RET}, the
1575 whole line is sent to IDL. Sometimes it is necessary to send single
1576 characters (without a newline), for example when an IDL program is
1577 waiting for single character input with the @code{GET_KBRD} function.
1578 You can send a single character to IDL with the command @kbd{C-c C-x}
1579 (@code{idlwave-shell-send-char}). When you press @kbd{C-c C-y}
1580 (@code{idlwave-shell-char-mode-loop}), IDLWAVE runs a blocking loop
1581 which accepts characters and immediately sends them to IDL. The loop
1582 can be exited with @kbd{C-g}. It terminates also automatically when the
1583 current IDL command is finished. Check the documentation of the two
1584 variables described below for a way to make IDL programs trigger
1585 automatic switches of the input mode.
1586
1587 @defopt idlwave-shell-use-input-mode-magic (@code{nil})
1588 Non-nil means, IDLWAVE should check for input mode spells in output.
1589 @end defopt
1590
1591 @defopt idlwave-shell-input-mode-spells
1592 The three regular expressions which match the magic spells for input
1593 modes.
1594 @end defopt
1595
1596 @node Debugging IDL Programs, , Using the Shell, The IDLWAVE Shell
1597 @section Debugging IDL Programs
1598 @cindex Debugging
1599 @cindex Keybindings for debugging
1600 @cindex Toolbar
1601
1602 @kindex C-c C-d
1603 Programs can be compiled, run, and debugged directly from the source
1604 buffer in Emacs. The IDLWAVE shell installs keybindings both in the
1605 shell buffer and in all IDL code buffers of the current Emacs session.
1606 On Emacs versions which support this, it also installs a debugging
1607 toolbar. The display of the toolbar can be toggled with @kbd{C-c C-d
1608 C-t} (@code{idlwave-shell-toggle-toolbar}).
1609
1610 The debugging keybindings are by default on the prefix key @kbd{C-c
1611 C-d}, so for example setting a breakpoint is done with @kbd{C-c C-d
1612 C-b}. If you find this too much work and your ALT key is still
1613 available, turn on the variable
1614 @code{idlwave-shell-activate-alt-keybindings} in order to get breakpoint
1615 setting on @kbd{A-b}. In the remainder of this chapter we will assume
1616 that the @kbd{C-c C-d} bindings are active.
1617
1618 @defopt idlwave-shell-prefix-key (@kbd{C-c C-d})
1619 The prefix key for the debugging map
1620 @code{idlwave-shell-mode-prefix-map}.
1621 @end defopt
1622
1623 @defopt idlwave-shell-activate-prefix-keybindings (@code{t})
1624 Non-@code{nil} means, debug commands will be bound to the prefix
1625 key, like @kbd{C-c C-d C-b}.
1626 @end defopt
1627
1628 @defopt idlwave-shell-activate-alt-keybindings (@code{nil})
1629 Non-@code{nil} means, debug commands will be bound to alternate
1630 keys, like @kbd{A-b}.
1631 @end defopt
1632
1633 @defopt idlwave-shell-use-toolbar (@code{t})
1634 Non-@code{nil} means, use the debugging toolbar in all IDL related
1635 buffers.
1636 @end defopt
1637
1638
1639 @menu
1640 * Compiling Programs:: Compiling buffers under the shell
1641 * Breakpoints and Stepping:: Deciding where to stop and look
1642 * Examining Variables:: What is the value now?
1643 @end menu
1644
1645 @node Compiling Programs, Breakpoints and Stepping, Debugging IDL Programs, Debugging IDL Programs
1646 @subsection Compiling Programs
1647 @cindex Compiling programs
1648 @cindex Programs, compiling
1649 @cindex Default command line, executing
1650 @cindex Executing a default command line
1651
1652 @kindex C-c C-d C-c
1653 In order to compile the current buffer under the IDLWAVE shell, press
1654 @kbd{C-c C-d C-c} (@code{idlwave-save-and-run}). This first saves the
1655 current buffer and then send the command @samp{.run path/to/file} to the
1656 shell. You can also execute @kbd{C-c C-d C-c} from the shell buffer, in
1657 which case the most recently compiled buffer will be saved and
1658 re-compiled.
1659
1660 When developing or debugging a program, it is often necessary to execute
1661 the same command line many times. A convenient way to do this is
1662 @kbd{C-c C-d C-y} (@code{idlwave-shell-execute-default-command-line}).
1663 This command first resets IDL from a state of interrupted execution by
1664 closing all files and returning to the main interpreter level. Then a
1665 default command line is send to the shell. To edit the default command
1666 line, call @code{idlwave-shell-execute-default-command-line} with a
1667 prefix argument: @kbd{C-u C-c C-d C-y}.
1668
1669 @defopt idlwave-shell-mark-stop-line (@code{t})
1670 Non-@code{nil} means, mark the source code line where IDL is currently
1671 stopped. The value decides about the preferred method. Legal values
1672 are @code{nil}, @code{t}, @code{arrow}, and @code{face}.
1673 @end defopt
1674
1675 @defopt idlwave-shell-overlay-arrow (@code{">"})
1676 The overlay arrow to display at source lines where execution
1677 halts.
1678 @end defopt
1679
1680 @defopt idlwave-shell-stop-line-face
1681 The face which highlights the source line where IDL is
1682 stopped.
1683 @end defopt
1684
1685 @node Breakpoints and Stepping, Examining Variables, Compiling Programs, Debugging IDL Programs
1686 @subsection Breakpoints and Stepping
1687 @cindex Breakpoints
1688 @cindex Stepping
1689 @cindex Execution, controlled
1690
1691 @kindex C-c C-d C-b
1692 @kindex C-c C-d C-b
1693 You can set breakpoints and step through a program with IDLWAVE.
1694 Setting a breakpoint in the current line of the source buffer is done
1695 with @kbd{C-c C-d C-b} (@code{idlwave-shell-break-here}). With a prefix
1696 arg of 1, the breakpoint gets a @code{/ONCE} keyword, meaning that it
1697 will be deleted after first use. With a numeric prefix greater than
1698 one, the breakpoint will only be active the @code{nth} time it is hit.
1699 To clear the breakpoint in the current line, use @kbd{C-c C-d C-d}
1700 (@code{idlwave-clear-current-bp}). To clear all breakpoints, use
1701 @kbd{C-c C-d C-a} (@code{idlwave-clear-all-bp}). Breakpoint lines are
1702 highlighted in the source code.
1703
1704 Once the program has stopped somewhere, you can step through it. Here
1705 is a summary of the breakpoint and stepping commands:
1706
1707 @multitable @columnfractions .23 .77
1708 @item @kbd{C-c C-d C-b}
1709 @tab Set breakpoint (@code{idlwave-shell-break-here})
1710 @item @kbd{C-c C-d C-i}
1711 @tab Set breakpoint in function named here (@code{idlwave-shell-break-in})
1712 @item @kbd{C-c C-d C-d}
1713 @tab Clear current breakpoint (@code{idlwave-shell-clear-current-bp})
1714 @item @kbd{C-c C-d C-a}
1715 @tab Clear all breakpoints (@code{idlwave-shell-clear-all-bp})
1716 @item @kbd{C-c C-d C-s}
1717 @tab Step, into function calls (@code{idlwave-shell-step})
1718 @item @kbd{C-c C-d C-n}
1719 @tab Step, over function calls (@code{idlwave-shell-stepover})
1720 @item @kbd{C-c C-d C-k}
1721 @tab Skip one statement (@code{idlwave-shell-skip})
1722 @item @kbd{C-c C-d C-u}
1723 @tab Continue to end of block (@code{idlwave-shell-up})
1724 @item @kbd{C-c C-d C-m}
1725 @tab Continue to end of function (@code{idlwave-shell-return})
1726 @item @kbd{C-c C-d C-o}
1727 @tab Continue past end of function (@code{idlwave-shell-out})
1728 @item @kbd{C-c C-d C-h}
1729 @tab Continue to line at cursor position (@code{idlwave-shell-to-here})
1730 @item @kbd{C-c C-d C-r}
1731 @tab Continue execution to next breakpoint (@code{idlwave-shell-cont})
1732 @item @kbd{C-c C-d C-up}
1733 @tab Show higher level in calling stack (@code{idlwave-shell-stack-up})
1734 @item @kbd{C-c C-d C-down}
1735 @tab Show lower level in calling stack (@code{idlwave-shell-stack-down})
1736 @end multitable
1737
1738 @defopt idlwave-shell-mark-breakpoints (@code{t})
1739 Non-@code{nil} means, mark breakpoints in the source file buffers. The
1740 value indicates the preferred method. Legal values are @code{nil},
1741 @code{t}, @code{face}, and @code{glyph}.
1742 @end defopt
1743
1744 @defopt idlwave-shell-breakpoint-face
1745 The face for breakpoint lines in the source code if
1746 @code{idlwave-shell-mark-breakpoints} has the value @code{face}.
1747 @end defopt
1748
1749 @node Examining Variables, , Breakpoints and Stepping, Debugging IDL Programs
1750 @subsection Examining Variables
1751 @cindex @code{PRINT} expressions
1752 @cindex @code{HELP}, on expressions
1753 @cindex Expressions, printing
1754 @cindex Expressions, help
1755 @cindex Mouse binding to print expressions
1756
1757 @kindex C-c C-d C-p
1758 When execution is stopped you can examine the values of variables. The
1759 command @kbd{C-c C-d C-p} prints the expression at point, while @kbd{C-c
1760 C-d ?} shows help on this expression. The expression at point is an
1761 array expression or a function call, or the contents of a pair of
1762 parenthesis. The selected expression becomes highlighted in the source
1763 code for a short time. Calling the above commands with a prefix
1764 argument will prompt for an expression instead of using the one at
1765 point.
1766
1767 It is very convenient to click with the mouse on expressions to retrieve
1768 their value. Expression printing is also bound to @kbd{S-mouse-2} and
1769 expression help to @kbd{C-S-mouse-2}. I.e. you need to hold down
1770 @key{SHIFT} and @key{CONTROL} while clicking with the mouse.
1771
1772 @cindex Calling stack, motion
1773 @cindex Printing expressions, on calling stack
1774 @cindex Restrictions for expression printing
1775 Printing of expressions also works on higher levels of the calling
1776 stack. This means that you can examine the values of variables and
1777 expressions inside the routine which called the current routine etc.
1778 Use the commands @kbd{C-c C-d C-@key{UP}}
1779 (@code{idlwave-shell-stack-up}) and @kbd{C-c C-d C-@key{DOWN}}
1780 (@code{idlwave-shell-stack-down}) or the corresponding toolbar buttons
1781 to move through the calling stack. The mode line of the shell window
1782 will indicate the routine and the calling stack level which define the
1783 context for printing expressions. The following restrictions apply for
1784 all levels except the current:
1785
1786 @itemize @bullet
1787 @item
1788 Array expressions must use the @samp{[ ]} index delimiters. Identifiers
1789 with a @samp{( )} will be interpreted as function calls.
1790 @item
1791 @cindex ROUTINE_NAMES, IDL procedure
1792 Printing values of expressions on higher levels of the calling stack
1793 uses the @emph{unsupported} IDL routine @code{ROUTINE_NAMES}, which may
1794 or may not be available in future versions of IDL.
1795 @end itemize
1796
1797 @defopt idlwave-shell-expression-face
1798 The face for @code{idlwave-shell-expression-overlay}.
1799 Allows you to choose the font, color and other properties for
1800 the expression printed by IDL.
1801 @end defopt
1802
1803 @defopt idlwave-shell-print-expression-function (@code{nil})
1804 A function to handle special display of evaluated expressions.
1805 @end defopt
1806
1807 @node Installation, Acknowledgement, The IDLWAVE Shell, Top
1808 @chapter Installation
1809 @cindex Installation
1810
1811 @menu
1812 * Installing IDLWAVE:: How to install the distribution
1813 * Installing Online Help:: Where to get the additional files needed
1814 * Upgrading from idl.el:: Necessary configuration changes
1815 @end menu
1816
1817 @node Installing IDLWAVE, Installing Online Help, Installation, Installation
1818 @section Installing IDLWAVE
1819
1820 @cindex FTP site
1821 @cindex URL, homepage for IDLWAVE
1822 @cindex Homepage for IDLWAVE
1823 @cindex IDLWAVE, homepage
1824 @cindex XEmacs package IDLWAVE
1825 @cindex Emacs, distributed with IDLWAVE
1826 @cindex Copyright, of IDL manual
1827 IDLWAVE is part of Emacs 21.1 and later. It is also an XEmacs package
1828 and can be installed from
1829 @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,the XEmacs ftp site}
1830 with the normal package management system on XEmacs 21. These
1831 pre-installed versions should work out-of-the-box. However, the files
1832 needed for online help are not distributed with XEmacs/Emacs and have to
1833 be installed separately@footnote{Due to copyright reasons, the ASCII
1834 version of the IDL manual cannot be distributed under the GPL.}
1835 (@pxref{Installing Online Help}).
1836
1837 You can also download IDLWAVE and install it yourself from
1838 @uref{@value{IDLWAVE-HOMEPAGE}, the maintainers webpage}. Follow the
1839 instructions in the INSTALL file.
1840
1841 @node Installing Online Help, Upgrading from idl.el , Installing IDLWAVE, Installation
1842 @section Installing Online Help
1843 @cindex Installing online help
1844 @cindex Online Help, Installation
1845
1846 If you want to use the online help display, two additional files (an
1847 ASCII version of the IDL documentation and a topics/code file) must be
1848 installed. These files can also be downloaded from
1849 @uref{@value{IDLWAVE-HOMEPAGE}, the maintainers webpage}. You need to
1850 place the files somewhere on your system and tell IDLWAVE where they are
1851 with
1852
1853 @lisp
1854 (setq idlwave-help-directory "/path/to/help/files/")
1855 @end lisp
1856
1857 @node Upgrading from idl.el, , Installing Online Help, Installation
1858 @section Upgrading from the old @b{@file{idl.el}} file
1859 @cindex Upgrading from old @b{@file{idl.el}}
1860 @cindex Renaming old variables
1861 @cindex Old variables, renaming
1862 @kindex M-@key{TAB}
1863
1864 If you have been using the old @file{idl.el} and @file{idl-shell.el}
1865 files and would like to use IDLWAVE, you need to update your
1866 customization in @file{.emacs}.
1867
1868 @enumerate
1869 @item
1870 Change all variable and function prefixes from @samp{idl-} to @samp{idlwave-}.
1871 @item
1872 Remove the now invalid @code{autoload} and @code{auto-mode-alist} forms
1873 pointing to the @file{idl.el} and @file{idl-shell.el} files. Install
1874 the new autoload forms.
1875 @item
1876 If you have been using the hook function recommended in earlier versions
1877 to get a separate frame for the IDL shell, remove that command from your
1878 @code{idlwave-shell-mode-hook}. Instead, set the variable
1879 @code{idlwave-shell-use-dedicated-frame} with
1880 @lisp
1881 (setq idlwave-shell-use-dedicated-frame t)
1882 @end lisp
1883 @item
1884 The key sequence @kbd{M-@key{TAB}} no longer inserts a TAB character.
1885 Like in in many other Emacs modes, @kbd{M-@key{TAB}} now does
1886 completion. Inserting a TAB has therefore been moved to
1887 @kbd{C-@key{TAB}}. On a character based terminal you can also use
1888 @kbd{C-c @key{SPC}}.
1889 @end enumerate
1890
1891 @node Acknowledgement, Sources of Routine Info, Installation, Top
1892 @chapter Acknowledgement
1893 @cindex Acknowledgement
1894 @cindex Maintainer, of IDLWAVE
1895 @cindex Authors, of IDLWAVE
1896 @cindex Contributors, to IDLWAVE
1897 @cindex Email address, of Maintainer
1898 @cindex Thanks
1899
1900 @noindent
1901 The main contributors to the IDLWAVE package have been:
1902
1903 @itemize @minus
1904 @item
1905 @uref{mailto:chase@@att.com, @b{Chris Chase}} wrote
1906 @file{idl.el} and @file{idl-shell.el} and maintained them for several
1907 years.
1908
1909 @item
1910 @uref{mailto:dominik@@astro.uva.nl, @b{Carsten Dominik}} has been in
1911 charge of the package since version 3.0. He renamed the package to
1912 IDLWAVE, rewrote and added large parts and is the current maintainer.
1913
1914 @item
1915 @uref{mailto:jdsmith@@astrosun.tn.cornell.edu, @b{J.D. Smith}} has
1916 shaped Object method completion and most new features in version 4.0
1917 with his ideas, bug reports, and patient explanations of IDL internals.
1918 @end itemize
1919
1920 @noindent
1921 The following people have also contributed to the development of IDLWAVE
1922 with patches, ideas, bug reports and suggestions.
1923
1924 @itemize @minus
1925 @item
1926 Ulrik Dickow <dickow@@nbi.dk>
1927 @item
1928 Eric E. Dors <edors@@lanl.gov>
1929 @item
1930 Stein Vidar H. Haugan <s.v.h.haugan@@astro.uio.no>
1931 @item
1932 David Huenemoerder <dph@@space.mit.edu>
1933 @item
1934 Kevin Ivory <Kevin.Ivory@@linmpi.mpg.de>
1935 @item
1936 Xuyong Liu <liu@@stsci.edu>
1937 @item
1938 Simon Marshall <Simon.Marshall@@esrin.esa.it>
1939 @item
1940 Laurent Mugnier <mugnier@@onera.fr>
1941 @item
1942 Lubos Pochman <lubos@@rsinc.com>
1943 @item
1944 Patrick M. Ryan <pat@@jaameri.gsfc.nasa.gov>
1945 @item
1946 Marty Ryba <ryba@@ll.mit.edu>
1947 @item
1948 Phil Williams <williams@@irc.chmcc.org>
1949 @item
1950 Phil Sterne <sterne@@dublin.llnl.gov>
1951 @end itemize
1952
1953 @noindent
1954 Thanks to everyone!
1955
1956 @node Sources of Routine Info, Configuration Examples, Acknowledgement, Top
1957 @appendix Sources of Routine Info
1958
1959 @cindex Sources of routine information
1960 In @ref{Routine Info} and @ref{Completion} it was shown how IDLWAVE
1961 displays the calling sequence and keywords of routines, and how it
1962 completes routine names and keywords. For these features to work,
1963 IDLWAVE must know about the accessible routines.
1964
1965 @menu
1966 * Routine Definitions:: Where IDL Routines are defined.
1967 * Routine Information Sources:: So how does IDLWAVE know about...
1968 * Library Scan:: Scanning the Libraries for Routine Info
1969 * Load-Path Shadows:: Routines defined in several places
1970 * Documentation Scan:: Scanning the IDL Manuals
1971 @end menu
1972
1973 @node Routine Definitions, Routine Information Sources, Sources of Routine Info, Sources of Routine Info
1974 @section Routine Definitions
1975 @cindex Routine definitions
1976 @cindex IDL variable @code{!PATH}
1977 @cindex @code{!PATH}, IDL variable
1978 @cindex @code{CALL_EXTERNAL}, IDL routine
1979 @cindex @code{LINKIMAGE}, IDL routine
1980 @cindex External routines
1981
1982 Routines which can be used in an IDL program can be defined in several
1983 places:
1984
1985 @enumerate
1986 @item
1987 @emph{Builtin routines} are defined inside IDL itself. The source
1988 code of such routines is not accessible to the user.
1989 @item
1990 Routines @emph{part of the current program} are defined in a file which
1991 is explicitly compiled by the user. This file may or may not be located
1992 on the IDL search path.
1993 @item
1994 @emph{Library routines} are defined in special files which are located
1995 somewhere on IDL's search path. When a library routine is called for
1996 the first time, IDL will find the source file and compile it
1997 dynamically.
1998 @item
1999 External routines written in other languages (like Fortran or C) can be
2000 called with @code{CALL_EXTERNAL}, linked into IDL via @code{LINKIMAGE},
2001 or included as dynamically loaded modules (DLMs). Currently IDLWAVE
2002 cannot provide routine info and completion for external
2003 routines.
2004 @end enumerate
2005
2006 @node Routine Information Sources, Library Scan, Routine Definitions, Sources of Routine Info
2007 @section Routine Information Sources
2008 @cindex Routine info sources
2009 @cindex Builtin list of routines
2010 @cindex Updating routine info
2011 @cindex Scanning buffers for routine info
2012 @cindex Buffers, scanning for routine info
2013 @cindex Shell, querying for routine info
2014
2015 In oder to know about as many routines as possible, IDLWAVE will do the
2016 following to collect information:
2017
2018 @enumerate
2019
2020 @item
2021 It has a @emph{builtin list} with the properties of the builtin IDL
2022 routines. IDLWAVE @value{VERSION} is distributed with a list of
2023 @value{NSYSROUTINES} routines and @value{NSYSKEYWORDS} keywords,
2024 reflecting IDL version @value{IDLVERSION}. This list has been created
2025 by scanning the IDL manuals and is stored in the file
2026 @file{idlw-rinfo.el}. @xref{Documentation Scan}, for
2027 information how to regenerate this file for new versions of IDL.
2028
2029 @item
2030 It @emph{scans} all @emph{buffers} of the current Emacs session for
2031 routine definitions. This is done automatically when routine
2032 information or completion is first requested by the user. Each new
2033 buffer and each buffer which is saved after making changes is also
2034 scanned. The command @kbd{C-c C-i} (@code{idlwave-update-routine-info})
2035 can be used at any time to rescan all buffers.
2036
2037 @item
2038 If you have an IDLWAVE-Shell running as inferior process of the current
2039 Emacs session, IDLWAVE will @emph{query the shell} for compiled routines
2040 and their arguments. This happens automatically when routine
2041 information or completion is first requested by the user, and each time
2042 an Emacs buffer is compiled with @kbd{C-c C-d C-c}. The command
2043 @kbd{C-c C-i} (@code{idlwave-update-routine-info}) can be used to ask
2044 the shell again at any time.
2045
2046 @item
2047 IDLWAVE can scan all or selected library files and store the result in a
2048 file which will be automatically loaded just like
2049 @file{idlw-rinfo.el}. @xref{Library Scan}, for information how to
2050 scan library files.
2051 @end enumerate
2052
2053 @defopt idlwave-scan-all-buffers-for-routine-info (@code{t})
2054 Non-@code{nil} means, scan all buffers for IDL programs when updating
2055 info.
2056 @end defopt
2057
2058 @defopt idlwave-query-shell-for-routine-info (@code{t})
2059 Non-@code{nil} means query the shell for info about compiled routines.
2060 @end defopt
2061
2062 @defopt idlwave-auto-routine-info-updates
2063 Controls under what circumstances routine info is updated automatically.
2064 @end defopt
2065
2066 @node Library Scan, Load-Path Shadows, Routine Information Sources, Sources of Routine Info
2067 @section Library Scan
2068 @cindex Library scan
2069 @cindex IDL library routine info
2070 @cindex Windows
2071 @cindex MacOS
2072 @cindex Unix
2073 @cindex IDL variable @code{!DIR}
2074 @cindex @code{!DIR}, IDL variable
2075
2076
2077 IDLWAVE can extract routine information from library modules and store
2078 that information in a file. To do this, the variable
2079 @code{idlwave-libinfo-file} needs to contain the path to a file in an
2080 existing directory (the default is @code{"~/.idlcat.el"}). Since the
2081 file will contain lisp code, its name should end in @file{.el}. Under
2082 Windows and MacOS, you also need to specify the search path for IDL
2083 library files in the variable @code{idlwave-library-path}, and the
2084 location of the IDL directory (the value of the @code{!DIR} system
2085 variable) in the variable @code{idlwave-system-directory}. Under UNIX,
2086 these values will be automatically inferred from an IDLWAVE
2087 shell.
2088
2089 The command @kbd{M-x idlwave-create-libinfo-file} can then be used to
2090 scan library files. It brings up a widget in which you can select some
2091 or all directories on the search path. If you only want to have routine
2092 and completion info of some libraries, it is sufficient to scan those
2093 directories. However, if you want IDLWAVE to detect possible name
2094 conflicts with routines defined in other libraries, the whole pass
2095 should be scanned.
2096
2097 After selecting directories, click on the @w{@samp{[Scan & Save]}}
2098 button in the widget to scan all files in the selected directories and
2099 write the resulting routine information into the file
2100 @code{idlwave-libinfo-file}. In order to update the library information
2101 from the same directories, call the command
2102 @code{idlwave-update-routine-info} with a double prefix argument:
2103 @w{@kbd{C-u C-u C-c C-i}}. This will rescan files in the previously
2104 selected directories, write an updated version of the libinfo file and
2105 rebuild IDLWAVEs internal lists.
2106
2107 A note of caution: Depending on your local installation, the IDL
2108 library can be very large. Parsing it for routine information will take
2109 time and loading this information into Emacs can require a
2110 significant amount of memory. However, having this information
2111 available will be a great help.
2112
2113 @defopt idlwave-libinfo-file
2114 File for routine information of the IDL library.
2115 @end defopt
2116
2117 @defopt idlwave-library-path
2118 IDL library path for Windows and MacOS. Not needed under Unix.
2119 @end defopt
2120
2121 @defopt idlwave-system-directory
2122 The IDL system directory for Windows and MacOS. Not needed under UNIX.
2123 @end defopt
2124
2125 @defopt idlwave-special-lib-alist
2126 Alist of regular expressions matching special library directories.
2127 @end defopt
2128
2129 @node Load-Path Shadows, Documentation Scan, Library Scan, Sources of Routine Info
2130 @section Load-Path Shadows
2131 @cindex Load-path shadows
2132 @cindex Shadows, load-path
2133 @cindex Duplicate routines
2134 @cindex Multiply defined routines
2135 @cindex Routine definitions, multiple
2136 @cindex Application, testing for shadowing
2137 @cindex Buffer, testing for shadowing
2138
2139 IDLWAVE can compile a list of routines which are defined in several
2140 different files. Since one definition will hide (shadow) the others
2141 depending on which file is compiled first, such multiple definitions are
2142 called "load-path shadows". IDLWAVE has several routines to scan for
2143 load path shadows. The output is placed into s special buffer
2144 @file{*Shadows*}. The format of the output is identical to the source
2145 section of the routine info buffer (@pxref{Routine Info}). Before
2146 calling these routines, you should make sure that routine info is
2147 up-to-date by pressing @kbd{C-c C-i}. Here are the different routines:
2148
2149 @table @asis
2150 @item @kbd{M-x idlwave-list-buffer-load-path-shadows}
2151 This commands checks the names of all routines defined in the current
2152 buffer for shadowing conflicts with other routines accessible to
2153 IDLWAVE. The command also has a key binding: @kbd{C-c C-b}
2154 @item @kbd{M-x idlwave-list-shell-load-path-shadows}.
2155 Checks all routines compiled under the shell for shadowing. This is
2156 very useful when you have written a complete application. Just compile
2157 the application, use @code{RESOLVE_ALL} to compile any routines used by
2158 your code, update the routine info inside IDLWAVE with @kbd{C-c C-i} and
2159 then check for shadowing.
2160 @item @kbd{M-x idlwave-list-all-load-path-shadows}
2161 This command finally checks all routines accessible to IDLWAVE for
2162 shadowing conflicts.
2163 @end table
2164
2165 For these commands to work properly you should have scanned the entire
2166 load path, not just selected directories. Also, IDLWAVE should be able to
2167 distinguish between the system library files (normally installed in
2168 @file{/usr/local/rsi/idl/lib}) and any site specific or user specific
2169 files. Therefore, such local files should not be installed
2170 inside the @file{lib} directory of the IDL directory. This is of course
2171 also advisable for many other reasons.
2172
2173 @cindex Windows
2174 @cindex MacOS
2175 @cindex IDL variable @code{!DIR}
2176 @cindex @code{!DIR}, IDL variable
2177 Users of Windows and MacOS also must set the variable
2178 @code{idlwave-system-directory} to the value of the @code{!DIR} system
2179 variable in IDL. IDLWAVE appends @file{lib} to the value of this
2180 variable and assumes that all files found on that path are system
2181 routines.
2182
2183 Another way to find out if a specific routine has multiple definitions
2184 on the load path is routine info display (@pxref{Routine Info}).
2185
2186 @node Documentation Scan, , Load-Path Shadows, Sources of Routine Info
2187 @section Documentation Scan
2188 @cindex @file{get_rinfo}
2189 @cindex @file{idlw-rinfo.el}
2190 @cindex @file{idlw-help.txt}
2191 @cindex @file{idlw-help.el}
2192 @cindex Scanning the documentation
2193 @cindex Perl program, to create @file{idlw-rinfo.el}
2194
2195 IDLWAVE derives it knowledge about system routines from the IDL
2196 manuals. The file @file{idlw-rinfo.el} contains the routine information
2197 for the IDL system routines. The Online Help feature of IDLWAVE
2198 requires ASCII versions of some IDL manuals to be available in a
2199 specific format (@file{idlw-help.txt}), along with an Emacs-Lisp file
2200 @file{idlw-help.el} with supporting code and pointers to the ASCII file.
2201
2202 All 3 files can be derived from the IDL documentation. If you are
2203 lucky, the maintainer of IDLWAVE will always have access to the newest
2204 version of IDL and provide updates. The IDLWAVE distribution also
2205 contains the Perl program @file{get_rinfo} which constructs these files
2206 by scanning selected files from the IDL documentation. Instructions on
2207 how to use @file{get_rinfo} are in the program itself.
2208
2209 @node Configuration Examples, Index, Sources of Routine Info, Top
2210 @appendix Configuration Examples
2211 @cindex Configuration examples
2212 @cindex Example configuration
2213 @cindex @file{.emacs}
2214 @cindex Default settings, of options
2215 @cindex Interview, with the maintainer
2216
2217 @noindent
2218 @b{Question:} So now you have all these complicated configuration
2219 options in your package, but which ones do @emph{you} as the maintainer
2220 actually set in your own configuration?
2221
2222 @noindent
2223 @b{Answer:} Hardly any. As the maintainer, I set the default of most
2224 options to what I think is best. However, the default settings do not
2225 turn on features which
2226
2227 @itemize @minus
2228 @item
2229 are not self-evident (i.e. too magic) when used by an unsuspecting user
2230 @item
2231 are too intrusive
2232 @item
2233 will not work properly on all Emacs installations out there
2234 @item
2235 break with widely used standards.
2236 @end itemize
2237
2238 @noindent To see what I mean, here is the @emph{entire} configuration I
2239 have in my @file{.emacs}:
2240
2241 @lisp
2242 (setq idlwave-shell-activate-alt-keybindings t
2243 idlwave-expand-generic-end t
2244 idlwave-store-inquired-class t
2245 idlwave-shell-automatic-start t
2246 idlwave-main-block-indent 2
2247 idlwave-help-dir "~/lib/emacs/idlwave"
2248 idlwave-special-lib-alist '(("/idl-astro/" . "AstroLib")
2249 ("/jhuapl/" . "JHUAPL-Lib")
2250 ("/dominik/lib/idl/" . "MyLib")))
2251 @end lisp
2252
2253 However, if you are an Emacs power-user and want IDLWAVE to work
2254 completely differently, the options allow you to change almost every
2255 aspect of it. Here is an example of a much more extensive configuration
2256 of IDLWAVE. To say it again - this is not what I recommend, but the
2257 user is King!
2258
2259 @example
2260 ;;; Settings for IDLWAVE mode
2261
2262 (setq idlwave-block-indent 3) ; Indentation settings
2263 (setq idlwave-main-block-indent 3)
2264 (setq idlwave-end-offset -3)
2265 (setq idlwave-continuation-indent 1)
2266 (setq idlwave-begin-line-comment "^;[^;]") ; Leave ";" but not ";;"
2267 ; anchored at start of line.
2268 (setq idlwave-surround-by-blank t) ; Turn on padding ops =,<,>
2269 (setq idlwave-pad-keyword nil) ; Remove spaces for keyword '='
2270 (setq idlwave-expand-generic-end t) ; convert END to ENDIF etc...
2271 (setq idlwave-reserved-word-upcase t) ; Make reserved words upper case
2272 ; (with abbrevs only)
2273 (setq idlwave-abbrev-change-case nil) ; Don't force case of expansions
2274 (setq idlwave-hang-indent-regexp ": ") ; Change from "- " for auto-fill
2275 (setq idlwave-show-block nil) ; Turn off blinking to begin
2276 (setq idlwave-abbrev-move t) ; Allow abbrevs to move point
2277
2278 ;; Some setting can only be done from a mode hook. Here is an example:
2279
2280 (add-hook 'idlwave-mode-hook
2281 (lambda ()
2282 (setq abbrev-mode 1) ; Turn on abbrevs (-1 for off)
2283 (setq case-fold-search nil) ; Make searches case sensitive
2284 ;; Run other functions here
2285 (font-lock-mode 1) ; Turn on font-lock mode
2286 (idlwave-auto-fill-mode 0) ; Turn off auto filling
2287 ;;
2288 ;; Pad with with 1 space (if -n is used then make the
2289 ;; padding a minimum of n spaces.) The defaults use -1
2290 ;; instead of 1.
2291 (idlwave-action-and-binding "=" '(idlwave-expand-equal 1 1))
2292 (idlwave-action-and-binding "<" '(idlwave-surround 1 1))
2293 (idlwave-action-and-binding ">" '(idlwave-surround 1 1 '(?-)))
2294 (idlwave-action-and-binding "&" '(idlwave-surround 1 1))
2295 ;;
2296 ;; Only pad after comma and with exactly 1 space
2297 (idlwave-action-and-binding "," '(idlwave-surround nil 1))
2298 (idlwave-action-and-binding "&" '(idlwave-surround 1 1))
2299 ;;
2300 ;; Pad only after `->', remove any space before the arrow
2301 (idlwave-action-and-binding "->" '(idlwave-surround 0 -1 nil 2))
2302 ;;;
2303 ;; Set some personal bindings
2304 ;; (In this case, makes `,' have the normal self-insert behavior.)
2305 (local-set-key "," 'self-insert-command)
2306 ;; Create a newline, indenting the original and new line.
2307 ;; A similar function that does _not_ reindent the original
2308 ;; line is on "\C-j" (The default for emacs programming modes).
2309 (local-set-key "\n" 'idlwave-newline)
2310 ;; (local-set-key "\C-j" 'idlwave-newline) ; My preference.
2311 ))
2312
2313 ;;; Settings for IDLWAVE SHELL mode
2314
2315 (setq idlwave-shell-overlay-arrow "=>") ; default is ">"
2316 (setq idlwave-shell-use-dedicated-frame t) ; Make a dedicated frame
2317 (setq idlwave-shell-prompt-pattern "^WAVE> ") ; default is "^IDL> "
2318 (setq idlwave-shell-explicit-file-name "wave")
2319 (setq idlwave-shell-process-name "wave")
2320 (setq idlwave-shell-use-toolbar nil) ; No toolbar
2321 @end example
2322
2323 @node Index, , Configuration Examples, Top
2324 @unnumbered Index
2325 @printindex cp
2326
2327 @bye
2328