]> code.delx.au - gnu-emacs/blob - man/idlwave.texi
9e04d43b01297fe5c45a28c2dfc0c81685974fbf
[gnu-emacs] / 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 files.
8 @end direntry
9 @synindex ky cp
10 @syncodeindex vr cp
11 @syncodeindex fn cp
12 @set VERSION 4.14
13 @set EDITION 4.14
14 @set IDLVERSION 5.5
15 @set NSYSROUTINES 1322
16 @set NSYSKEYWORDS 5952
17 @set DATE June 2002
18 @set AUTHOR J.D. Smith & Carsten Dominik
19 @set AUTHOR-EMAIL dominik@@astro.uva.nl
20 @set MAINTAINER J.D. Smith
21 @set MAINTAINER-EMAIL jdsmith@@as.arizona.edu
22 @set IDLWAVE-HOMEPAGE http://idlwave.org/
23 @c %**end of header
24 @finalout
25
26 @ifinfo
27 This file documents IDLWAVE, a major mode for editing IDL files with
28 Emacs, and interacting with an IDL shell run as a subprocess.
29
30 This is edition @value{EDITION} of the IDLWAVE User Manual for IDLWAVE
31 @value{VERSION}
32
33 Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation,
34 Inc.
35
36 Permission is granted to copy, distribute and/or modify this document
37 under the terms of the GNU Free Documentation License, Version 1.1 or
38 any later version published by the Free Software Foundation; with no
39 Invariant Sections, with the Front-Cover texts being ``A GNU
40 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
41 license is included in the section entitled ``GNU Free Documentation
42 License'' in the Emacs manual.
43
44 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
45 this GNU Manual, like GNU software. Copies published by the Free
46 Software Foundation raise funds for GNU development.''
47
48 This document is part of a collection distributed under the GNU Free
49 Documentation License. If you want to distribute this document
50 separately from the collection, you can do so by adding a copy of the
51 license to the document, as described in section 6 of the license.
52 @end ifinfo
53
54 @titlepage
55 @title IDLWAVE User Manual
56 @subtitle Emacs major mode and shell for IDL
57 @subtitle Edition @value{EDITION}, @value{DATE}
58
59 @author by Carsten Dominik & J.D. Smith
60 @page
61 This is edition @value{EDITION} of the @cite{IDLWAVE User Manual} for
62 IDLWAVE version @value{VERSION}, @value{DATE}.
63 @sp 2
64 Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
65 @sp 2
66 @cindex Copyright, of IDLWAVE
67 Permission is granted to copy, distribute and/or modify this document
68 under the terms of the GNU Free Documentation License, Version 1.1 or
69 any later version published by the Free Software Foundation; with no
70 Invariant Sections, with the Front-Cover texts being ``A GNU
71 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
72 license is included in the section entitled ``GNU Free Documentation
73 License'' in the Emacs manual.
74
75 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
76 this GNU Manual, like GNU software. Copies published by the Free
77 Software Foundation raise funds for GNU development.''
78
79 This document is part of a collection distributed under the GNU Free
80 Documentation License. If you want to distribute this document
81 separately from the collection, you can do so by adding a copy of the
82 license to the document, as described in section 6 of the license.
83 @end titlepage
84 @contents
85
86 @page
87
88 @ifnottex
89
90 @node Top, Introduction, (dir), (dir)
91
92 IDLWAVE is a package which supports editing source for the
93 Interactive Data Language (IDL), and running IDL as an inferior
94 shell.
95
96 @end ifnottex
97
98 @menu
99 * Introduction:: What IDLWAVE is and what it's not
100 * IDLWAVE in a Nutshell:: One page quick-start guide
101 * Getting Started:: Tutorial
102 * The IDLWAVE Major Mode:: The mode to edit IDL programs
103 * The IDLWAVE Shell:: The mode to run IDL as an inferior program
104 * Installation:: How to Install or Upgrade
105 * Acknowledgements:: Who did what
106 * Sources of Routine Info:: How does IDLWAVE know about routine XYZ
107 * Configuration Examples:: The user is king...
108 * Windows and MacOS:: What still works, and how
109 * Index:: Fast access
110
111 @detailmenu
112 --- The Detailed Node Listing ---
113
114 Getting Started (Tutorial)
115
116 * Lesson I -- Development Cycle::
117 * Lesson II -- Customization::
118 * Lesson III -- Library Catalog::
119
120 The IDLWAVE Major Mode
121
122 * Code Formatting:: Making code look nice
123 * Routine Info:: Calling Sequence and Keyword List
124 * Online Help:: One key press from source to help
125 * Completion:: Completing routine names and Keywords
126 * Routine Source:: Finding routines, the easy way
127 * Resolving Routines:: Force the Shell to compile a routine
128 * Code Templates:: Frequent code constructs
129 * Abbreviations:: Abbreviations for common commands
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 * Continued Statement Indentation::
139 * Comment Indentation:: Special indentation for comment lines
140 * Continuation Lines:: Splitting statements over lines
141 * Syntax Highlighting:: Font-lock support
142 * Octals and Highlighting:: Why "123 causes problems
143
144 Completion
145
146 * Case of Completed Words:: CaseOFcomPletedWords
147 * Object Method Completion and Class Ambiguity:: obj->Method, what?
148 * Class and Keyword Inheritance:: obj->Method, _EXTRA=e
149 * Structure Tag Completion:: Completing state.Tag
150
151 Actions
152
153 * Block Boundary Check:: Is the END correct
154 * Padding Operators:: Enforcing space around `=' etc
155 * Case Changes:: Enforcing upper case keywords
156
157 The IDLWAVE Shell
158
159 * Starting the Shell:: How to launch IDL as a subprocess
160 * Using the Shell:: Interactively working with the Shell
161 * Debugging IDL Programs:: Compilation/Debugging
162 * Examining Variables::
163 * Custom Expression Examination::
164
165 Debugging IDL Programs
166
167 * Compiling Programs:: Compiling buffers under the shell
168 * Breakpoints and Stepping:: Deciding where to stop and look
169 * Walking the Calling Stack:: From where was this routine called?
170
171 Installation
172
173 * Installing IDLWAVE:: How to install the distribution
174 * Installing Online Help:: Where to get the additional files needed
175 * Upgrading from idl.el:: Necessary configuration changes
176
177 Sources of Routine Info
178
179 * Routine Definitions:: Where IDL Routines are defined.
180 * Routine Information Sources:: So how does IDLWAVE know about...
181 * Library Catalog:: Scanning the Libraries for Routine Info
182 * Load-Path Shadows:: Routines defined in several places
183 * Documentation Scan:: Scanning the IDL Manuals
184
185 @end detailmenu
186 @end menu
187
188 @node Introduction, IDLWAVE in a Nutshell, Top, Top
189 @chapter Introduction
190 @cindex Introduction
191 @cindex CORBA (Common Object Request Broker Architecture)
192 @cindex Interface Definition Language
193 @cindex Interactive Data Language
194 @cindex cc-mode.el
195 @cindex @file{idl.el}
196 @cindex @file{idl-shell.el}
197 @cindex Feature overview
198
199 IDLWAVE is a package which supports editing source files for the
200 Interactive Data Language (IDL@footnote{IDL is a registered trademark of
201 Research Systems, Inc., a Kodak Company}), and for running IDL as an
202 inferior shell@footnote{Note that this package has nothing to do with
203 the Interface Definition Language, part of the Common Object Request
204 Broker Architecture (CORBA)}. It can also be used for editing source
205 files for the related WAVE/CL language, but with only limited
206 support. Note that this package has nothing to do with the Interface
207 Definition Language, part of the Common Object Request Broker
208 Architecture (CORBA).
209
210 IDLWAVE consists of two main parts: a major mode for editing IDL source
211 files files (@code{idlwave-mode}) and a mode for running the IDL program
212 as an inferior shell (@code{idlwave-shell-mode}). Although one mode can
213 be used without the other, both work together closely to form a complete
214 development environment. Here is a brief summary of what IDLWAVE does:
215
216 @itemize @bullet
217 @item
218 Code indentation and formatting.
219 @item
220 Three level syntax highlighting support.
221 @item
222 Context-sensitive display of calling sequences and keywords for more
223 than 1000 native IDL routines, extendible to any number of additional
224 routines in your local IDL libraries.
225 @item
226 Name space conflict search, with likelihood ranking.
227 @item
228 Fast, context-sensitive online help.
229 @item
230 Context sensitive completion of routine names and keywords.
231 @item
232 Easy insertion of code templates.
233 @item
234 Automatic corrections to enforce a variety of customizable coding
235 standards.
236 @item
237 Integrity checks and auto-termination of logical blocks.
238 @item
239 Support for @file{imenu} (Emacs) and @file{func-menu} (XEmacs).
240 @item
241 Documentation support.
242 @item
243 Running IDL as an inferior Shell with history search, command line
244 editing and all the completion and routine info capabilities present in
245 IDL source buffers.
246 @item
247 Compilation, execution and interactive debugging of programs directly
248 from the source buffer.
249 @item
250 Quick, source-guided navigation of the calling stack, with variable
251 inspection, etc.
252 @item
253 Examining variables and expressions with a mouse click.
254 @item
255 And much, much more...
256 @end itemize
257
258 @ifnottex
259 @cindex Screenshots
260 Here are a number of screenshots showing IDLWAVE in action:
261
262 @itemize @bullet
263 @item
264 @uref{http://idlwave.org/screenshots/emacs_21_nav.gif,An IDLWAVE buffer}
265 @item
266 @uref{http://idlwave.org/screenshots/emacs_21_keys.gif,A keyword being completed}
267 @item
268 @uref{http://idlwave.org/screenshots/emacs_21_help.gif,Online help text.}
269 @item
270 @uref{http://idlwave.org/screenshots/emacs_21_ri.gif,Routine information displayed}
271 @item
272 @uref{http://idlwave.org/screenshots/emacs_21_bp.gif,Debugging code
273 stopped at a breakpoint}
274 @end itemize
275 @end ifnottex
276
277 IDLWAVE is the successor to the @file{idl.el} and @file{idl-shell.el}
278 files written by Chris Chase. The modes and files had to be renamed
279 because of a name space conflict with CORBA's @code{idl-mode}, defined in
280 Emacs in the file @file{cc-mode.el}. If you have been using the old
281 files, check @ref{Upgrading from idl.el} for information on how to
282 switch.
283
284 In this manual, each section ends with a list of related user options.
285 Don't be confused by the sheer number of options available --- in most
286 cases the default settings are just fine. The variables are listed here
287 to make sure you know where to look if you want to change anything. For
288 a full description of what a particular variable does and how to
289 configure it, see the documentation string of that variable (available
290 with @kbd{C-h v}). Some configuration examples are also given in the
291 appendix.
292
293 @node IDLWAVE in a Nutshell, Getting Started, Introduction, Top
294 @chapter IDLWAVE in a Nutshell
295 @cindex Summary of important commands
296 @cindex IDLWAVE in a Nutshell
297 @cindex Nutshell, IDLWAVE in a
298
299 @subheading Editing IDL Programs
300
301 @multitable @columnfractions .15 .85
302 @item @key{TAB}
303 @tab Indent the current line relative to context.
304 @item @kbd{C-M-\}
305 @tab Re-indent all lines in the current region.
306 @item @kbd{C-u @key{TAB}}
307 @tab Re-indent all lines in the current statement.
308 @item @kbd{M-@key{RET}}
309 @tab Start a continuation line, or split the current line at point.
310 @item @kbd{M-q}
311 @tab Fill the current comment paragraph.
312 @item @kbd{C-c ?}
313 @tab Display calling sequence and keywords for the procedure or function call
314 at point.
315 @item @kbd{M-?}
316 @tab Load context sensitive online help for nearby routine, keyword, etc.
317 @item @kbd{M-@key{TAB}}
318 @tab Complete a procedure name, function name or keyword in the buffer.
319 @item @kbd{C-c C-i}
320 @tab Update IDLWAVE's knowledge about functions and procedures.
321 @item @kbd{C-c C-v}
322 @tab Visit the source code of a procedure/function.
323 @item @kbd{C-c C-h}
324 @tab Insert a standard documentation header.
325 @item @kbd{C-c @key{RET}}
326 @tab Insert a new timestamp and history item in the documentation header.
327 @end multitable
328
329 @subheading Running the IDLWAVE Shell, Debugging Programs
330
331 @multitable @columnfractions .15 .85
332 @item @kbd{C-c C-s}
333 @tab Start IDL as a subprocess and/or switch to the interaction buffer.
334 @item @kbd{M-p}
335 @tab Cycle back through IDL command history.
336 @item @kbd{M-n}
337 @tab Cycle forward.
338 @item @kbd{M-@key{TAB}}
339 @tab Complete a procedure name, function name or keyword in the shell buffer.
340 @item @kbd{C-c C-d C-c}
341 @tab Save and compile the source file in the current buffer.
342 @item @kbd{C-c C-d C-x}
343 @tab Goto next syntax error.
344 @item @kbd{C-c C-d C-b}
345 @tab Set a breakpoint at the nearest viable source line.
346 @item @kbd{C-c C-d C-d}
347 @tab Clear the nearest breakpoint.
348 @item @kbd{C-c C-d C-p}
349 @tab Print the value of the expression near point in IDL.
350 @end multitable
351
352 @subheading Commonly used Settings in @file{.emacs}
353 @lisp
354 ;; Change the indentation preferences
355 (setq idlwave-main-block-indent 2 ; default 0
356 idlwave-block-indent 2 ; default 4
357 idlwave-end-offset -2) ; default -4
358 ;; Start autoloading routine info after 2 idle seconds
359 (setq idlwave-init-rinfo-when-idle-after 2)
360 ;; Pad some operators with spaces
361 (setq idlwave-do-actions t
362 idlwave-surround-by-blank t)
363 ;; Syntax Highlighting
364 (add-hook 'idlwave-mode-hook 'turn-on-font-lock)
365 ;; Automatically start the shell when needed
366 (setq idlwave-shell-automatic-start t)
367 ;; Bind debugging commands with CONTROL and SHIFT modifiers
368 (setq idlwave-shell-debug-modifiers '(control shift))
369 ;; Specify the online help files' location.
370 (setq idlwave-help-directory "~/.idlwave")
371 @end lisp
372
373 @node Getting Started, The IDLWAVE Major Mode, IDLWAVE in a Nutshell, Top
374 @chapter Getting Started (Tutorial)
375 @cindex Quick-Start
376 @cindex Tutorial
377 @cindex Getting Started
378
379 @menu
380 * Lesson I -- Development Cycle::
381 * Lesson II -- Customization::
382 * Lesson III -- Library Catalog::
383 @end menu
384
385 @node Lesson I -- Development Cycle, Lesson II -- Customization, Getting Started, Getting Started
386 @section Lesson I: Development Cycle
387
388 The purpose of this tutorial is to guide you through a very basic
389 development cycle using IDLWAVE. We will paste a simple program into a
390 buffer and use the shell to compile, debug and run it. On the way we
391 will use many of the important IDLWAVE commands. Note however that
392 there are many more capabilities in IDLWAVE than covered here, which can
393 be discovered by reading the entire manual.
394
395 It is assumed that you have access to Emacs or XEmacs with the full
396 IDLWAVE package including online help (@pxref{Installation}). We also
397 assume that you are familiar with Emacs and can read the nomenclature of
398 key presses in Emacs (in particular, @kbd{C} stands for @key{CONTROL}
399 and @kbd{M} for @key{META} (often the @key{ALT} key carries this
400 functionality)).
401
402 Open a new source file by typing:
403
404 @example
405 @kbd{C-x C-f tutorial.pro @key{RET}}
406 @end example
407
408 A buffer for this file will pop up, and it should be in IDLWAVE mode, as
409 shown in the mode line just below the editing window. Also, the menu
410 bar should contain entries @samp{IDLWAVE} and @samp{Debug}.
411
412 Now cut-and-paste the following code, also available as
413 @file{tutorial.pro} in the IDLWAVE distribution.
414
415 @example
416 function daynr,d,m,y
417 ;; compute a sequence number for a date
418 ;; works 1901-2099.
419 if y lt 100 then y = y+1900
420 if m le 2 then delta = 1 else delta = 0
421 m1 = m + delta*12 + 1
422 y1 = y * delta
423 return, d + floor(m1*30.6)+floor(y1*365.25)+5
424 end
425
426 function weekday,day,month,year
427 ;; compute weekday number for date
428 nr = daynr(day,month,year)
429 return, nr mod 7
430 end
431
432 pro plot_wday,day,month
433 ;; Plot the weekday of a date in the first 10 years of this century.
434 years = 2000,+indgen(10)
435 wdays = intarr(10)
436 for i=0,n_elements(wdays)-1 do begin
437 wdays[i] = weekday(day,month,years[i])
438 end
439 plot,years,wdays,YS=2,YT="Wday (0=Sunday)"
440 end
441 @end example
442
443 The indentation probably looks funny, since it's different from the
444 settings you use, so use the @key{TAB} key in each line to automatically
445 line it up (or more quickly @emph{select} the entire buffer with
446 @kbd{C-x h}, and indent the whole region with @kbd{C-M-\}). Notice how
447 different syntactical elements are highlighted in different colors, if
448 you have set up support for font-lock.
449
450 Let's check out two particular editing features of IDLWAVE. Place the
451 cursor after the @code{end} statement of the @code{for} loop and press
452 @key{SPC}. IDLWAVE blinks back to the beginning of the block and
453 changes the generic @code{end} to the specific @code{endfor}
454 automatically. Now place the cursor in any line you would like to split
455 and press @kbd{M-@key{RET}}. The line is split at the cursor position,
456 with the continuation @samp{$} and indentation all taken care of. Use
457 @kbd{C-/} to undo the last change.
458
459 The procedure @code{plot_wday} is supposed to plot the weekday of a
460 given date for the first 10 years of the 21st century. As in most code,
461 there are a few bugs, which we are going to use IDLWAVE to help us fix.
462
463 First, let's launch the IDLWAVE shell. You do this with the command
464 @kbd{C-c C-s}. The Emacs window will split and display IDL running in a
465 shell interaction buffer. Type a few commands like @code{print,!PI} to
466 convince yourself that you can work there just as well as in a terminal,
467 or the IDLDE. Use the arrow keys to cycle through your command history.
468 Are we having fun now?
469
470 Now go back to the source window and type @kbd{C-c C-d C-c} to compile
471 the program. If you watch the shell buffer, you see that IDLWAVE types
472 @samp{.run tutorial.pro} for you. But the compilation fails because
473 there is a comma in the line @samp{years=...}. The line with the error
474 is highlighted and the cursor positioned at the error, so remove the
475 comma (you should only need to hit @kbd{Delete}!). Compile again, using
476 the same keystrokes as before. Notice that the file is automatically
477 saved for you. This time everything should work fine, and you should
478 see the three routines compile.
479
480 Now we want to use the command to plot the day of the week on January
481 1st. We could type the full command ourselves, but why do that? Go
482 back to the shell window, type @samp{plot_} and hit @key{TAB}. After a
483 bit of a delay (while IDLWAVE initializes its routine info database, if
484 necessary), the window will split to show all procedures it knows
485 starting with that string, and @w{@code{plot_wday}} should be one of
486 them. Saving the buffer alerted IDLWAVE about this new routine. Click
487 with the middle mouse button on @code{plot_wday} and it will be copied
488 to the shell buffer, or if you prefer, add @samp{w} to @samp{plot_} to
489 make it unambiguous, hit @key{TAB} again, and the full routine name will
490 be completed. Now provide the two arguments:
491
492 @example
493 plot_wday,1,1
494 @end example
495
496 and press @key{RET}. This fails with an error message telling you the
497 @code{YT} keyword to plot is ambiguous. What are the allowed keywords
498 again? Go back to the source window and put the cursor into the `plot'
499 line, and press @kbd{C-c ?}. This shows the routine info window for the
500 plot routine, which contains a list of keywords, along with the argument
501 list. Oh, we wanted @code{YTITLE}. Fix that up. Recompile with
502 @kbd{C-c C-d C-c}. Jump back into the shell with @kbd{C-c C-s}, press
503 the @key{UP} arrow to recall the previous command and execute again.
504
505 This time we get a plot, but it is pretty ugly --- the points are all
506 connected with a line. Hmm, isn't there a way for @code{plot} to use
507 symbols instead? What was that keyword? Position the cursor on the
508 plot line after a comma (where you'd normally type a keyword), and hit
509 @kbd{M-@key{Tab}}. A long list of plot's keywords appears. Aha, there
510 it is, @code{PSYM}. Middle click to insert it. An @samp{=} sign is
511 included for you too. Now what were the values of @code{PSYM} supposed
512 to be? With the cursor on or after the keyword, press @kbd{M-?} for
513 online help (alternatively, you could have right clicked on the colored
514 keyword itself in the completion list). The online help window will pop
515 up showing the documentation for the @code{PYSM} keyword. OK, let's use
516 diamonds=4. Fix this, recompile (you know the command by now: @kbd{C-c
517 C-d C-c}, go back to the shell (if it's vanished, you know the command
518 to recall it by now: @kbd{C-c C-s}) and execute again. Now things look
519 pretty good.
520
521 Let's try a different day --- how about April fool's day?
522
523 @example
524 plot_wday,1,4
525 @end example
526
527 Oops, this looks very wrong. All April fool's days cannot be Fridays!
528 We've got a bug in the program, perhaps in the @code{daynr} function.
529 Let's put a breakpoint on the last line there. Position the cursor on
530 the @samp{return, d+...} line and press @kbd{C-c C-d C-b}. IDL sets a
531 breakpoint (as you see in the shell window), and the line is highlighted
532 in some way. Back to the shell buffer, re-execute the previous command.
533 IDL stops at the line with the breakpoint. Now hold down the SHIFT key
534 and click with the middle mouse button on a few variables there:
535 @samp{d}, @samp{y}, @samp{m}, @samp{y1}, etc. Maybe @code{d} isn't the
536 correct type. CONTROL-SHIFT middle-click on it for help. Well, it's an
537 integer, so that's not the problem. Aha, @samp{y1} is zero, but it
538 should be the year, depending on delta. Shift click @samp{delta} to see
539 that it's 0. Below, we see the offending line: @samp{y1=y*delta...} the
540 multiplication should have been a minus sign! So fix the line to read:
541
542 @example
543 y1 = y - delta
544 @end example
545
546 Now remove all breakpoints: @kbd{C-c C-d C-a}. Recompile and rerun the
547 command. Everything should now work fine. How about those leap years?
548 Change the code to plot 100 years and see that every 28 years, the
549 sequence of weekdays repeats.
550
551 @node Lesson II -- Customization, Lesson III -- Library Catalog, Lesson I -- Development Cycle, Getting Started
552 @section Lesson II: Customization
553
554 Emacs is probably the most customizable piece of software available, and
555 it would be a shame if you did not make use of this and adapt IDLWAVE to
556 your own preferences. Customizing Emacs or IDLWAVE is accomplished by
557 setting Lisp variables in the @file{.emacs} file in your home directory
558 --- but do not be dismayed; for the most part, you can just copy and work
559 from the examples given here.
560
561 Let's first use a boolean variable. These are variables which you turn
562 on or off, much like a checkbox. A value of @samp{t} means on, a value
563 of @samp{nil} means off. Copy the following line into your
564 @file{.emacs} file, exit and restart Emacs.
565
566 @lisp
567 (setq idlwave-reserved-word-upcase t)
568 @end lisp
569
570 When this option is turned on, each reserved word you type into an IDL
571 source buffer will be converted to upper case when you press @key{SPC}
572 or @key{RET} right after the word. Try it out! @samp{if} changes to
573 @samp{IF}, @samp{begin} to @samp{BEGIN}. If you don't like this
574 behavior, remove the option again from your @file{.emacs} file.
575
576 You likely have your own indentation preferences for IDL code. For
577 example, some like to indent the main block of an IDL program from the
578 margin, different from the conventions used by RSI, and use only 3
579 spaces as indentation between @code{BEGIN} and @code{END}. Try the
580 following lines in @file{.emacs}:
581
582 @lisp
583 (setq idlwave-main-block-indent 2)
584 (setq idlwave-block-indent 3)
585 (setq idlwave-end-offset -3)
586 @end lisp
587
588 Restart Emacs, and re-indent the program we developed in the first part
589 of this tutorial with @kbd{C-c h} and @kbd{C-M-\}. You may want to keep
590 these lines in @file{.emacs}, with values adjusted to your likings. If
591 you want to get more information about any of these variables, type,
592 e.g., @kbd{C-h v idlwave-main-block-indent @key{RET}}. To find which
593 variables can be customized, look for items marked @samp{User Option:}
594 throughout this manual.
595
596 If you cannot seem to master this Lisp customization in @file{.emacs},
597 there is another, more user-friendly way to customize all the IDLWAVE
598 variables. You can access it through the IDLWAVE menu in one of the
599 @file{.pro} buffers, menu item @code{Customize->Browse IDLWAVE
600 Group}. Here you'll be presented with all the various variables grouped
601 into categories. You can navigate the hierarchy (e.g. Idlwave Code
602 Formatting->Idlwave Main Block Indent), read about the variables, change
603 them, and `Save for Future Sessions'. Few of these variables need
604 customization, but you can exercise considerable control over IDLWAVE's
605 functionality with them.
606
607 You may also find the key bindings used for the debugging commands too
608 long and complicated. Often we have heard such complaints, ``Do I
609 really have to type @kbd{C-c C-d C-c} to run a simple command?'' Due to
610 Emacs rules and conventions, shorter bindings cannot be set by default,
611 but you can enable them. First, there is a way to assign all debugging
612 commands in a single sweep to other combinations. The only problem is
613 that we have to use something which Emacs does not need for other
614 important commands. One good option is to execute debugging commands by
615 holding down @key{CONTROL} and @key{SHIFT} while pressing a single
616 character: @kbd{C-S-b} for setting a breakpoint, @kbd{C-S-c} for
617 compiling the current source file, @kbd{C-S-a} for deleting all
618 breakpoints. You can enable this with:
619
620 @lisp
621 (setq idlwave-shell-debug-modifiers '(shift control))
622 @end lisp
623
624 @noindent If you have a special keyboard with, for example, a
625 @key{HYPER} key, you could even shorten that:
626
627 @lisp
628 (setq idlwave-shell-debug-modifiers '(hyper))
629 @end lisp
630
631 @noindent to get compilation on @kbd{H-c}. Often, a modifier key like
632 @key{HYPER} or @key{SUPER} is bound or can be bound to an otherwise
633 unused key -- consult your system documentation.
634
635 You can also assign specific commands to keys. This you must do in the
636 @emph{mode-hook}, a special function which is run when a new buffer gets
637 set up. Keybindings can only be done when the buffer exists. The
638 possibilities for key customization are endless. Here we set function
639 keys f5-f8 to common debugging commands.
640
641 @lisp
642 ;; First for the source buffer
643 (add-hook 'idlwave-mode-hook
644 (lambda ()
645 (local-set-key [f5] 'idlwave-shell-break-here)
646 (local-set-key [f6] 'idlwave-shell-clear-current-bp)
647 (local-set-key [f7] 'idlwave-shell-cont)
648 (local-set-key [f8] 'idlwave-shell-clear-all-bp)))
649 ;; Then for the shell buffer
650 (add-hook 'idlwave-shell-mode-hook
651 (lambda ()
652 (local-set-key [f5] 'idlwave-shell-break-here)
653 (local-set-key [f6] 'idlwave-shell-clear-current-bp)
654 (local-set-key [f7] 'idlwave-shell-cont)
655 (local-set-key [f8] 'idlwave-shell-clear-all-bp)))
656 @end lisp
657
658 @node Lesson III -- Library Catalog, , Lesson II -- Customization, Getting Started
659 @section Lesson III: Library Catalog
660
661 We have already used the routine info display in the first part of this
662 tutorial. This was the key @kbd{C-c ?} which displays information about
663 the IDL routine near the cursor position. Wouldn't it be nice
664 to have the same available for your own library routines and for the
665 huge amount of code in major extension libraries like JHUPL or the
666 IDL-Astro library? To do this, you must give IDLWAVE a chance to study
667 these routines first. We call this @emph{Building the library catalog}.
668
669 From the IDLWAVE entry in the menu bar, select @code{Routine Info/Select
670 Catalog Directories}. If necessary, start the shell first with @kbd{C-c
671 C-s} (@pxref{Starting the Shell}). IDLWAVE will find out about the IDL
672 @code{!PATH} variable and offer a list of directories on the path.
673 Simply select them all (or whichever you want) and click on the
674 @samp{Scan&Save} button. Then go for a cup of coffee while IDLWAVE
675 collects information for each and every IDL routine on your search path.
676 All this information is written to the file @file{.idlcat} in your home
677 directory and will from now one be automatically loaded whenever you use
678 IDLWAVE. You may find it necessary to rebuild the catalog on occasion
679 as your local libraries change. Try to use routine info (@kbd{C-c ?})
680 or completion (@kbd{M-@key{TAB}}) while on any routine or partial routine
681 name you know to be located in the library. E.g., if you have scanned
682 the IDL-Astro library:
683
684 @example
685 a=readf@key{M-<TAB>}
686 @end example
687
688
689 expands to `readfits('. Then try
690
691 @example
692 a=readfits(@key{C-c ?}
693 @end example
694
695 and you get:
696
697 @example
698 Usage: Result = READFITS(filename, header, heap)
699 ...
700 @end example
701
702 I hope you made it until here. Now you are set to work with IDLWAVE.
703 On the way you will want to change other things, and to learn more about
704 the possibilities not discussed in this short tutorial. Read the
705 manual, look at the documentation strings of interesting variables (with
706 @kbd{C-h v idlwave<-variable-name> @key{RET}}) and ask the remaining
707 questions on the newsgroup @code{comp.lang.idl-pvwave}.
708
709 @node The IDLWAVE Major Mode, The IDLWAVE Shell, Getting Started, Top
710 @chapter The IDLWAVE Major Mode
711 @cindex IDLWAVE major mode
712 @cindex Major mode, @code{idlwave-mode}
713
714 The IDLWAVE major mode supports editing IDL source files. In this
715 chapter we describe the main features of the mode and how to customize
716 them.
717
718 @menu
719 * Code Formatting:: Making code look nice
720 * Routine Info:: Calling Sequence and Keyword List
721 * Online Help:: One key press from source to help
722 * Completion:: Completing routine names and Keywords
723 * Routine Source:: Finding routines, the easy way
724 * Resolving Routines:: Force the Shell to compile a routine
725 * Code Templates:: Frequent code constructs
726 * Abbreviations:: Abbreviations for common commands
727 * Actions:: Changing case, Padding, End checking
728 * Doc Header:: Inserting a standard header
729 * Motion Commands:: Moving through the structure of a program
730 * Misc Options:: Things that fit nowhere else
731 @end menu
732
733 @node Code Formatting, Routine Info, The IDLWAVE Major Mode, The IDLWAVE Major Mode
734 @section Code Formatting
735 @cindex Code formatting
736 @cindex Formatting, of code
737
738 @menu
739 * Code Indentation:: Reflecting the logical structure
740 * Continued Statement Indentation::
741 * Comment Indentation:: Special indentation for comment lines
742 * Continuation Lines:: Splitting statements over lines
743 * Syntax Highlighting:: Font-lock support
744 * Octals and Highlighting:: Why "123 causes problems
745 @end menu
746
747 The IDL language, with it's early roots in FORTRAN, modern
748 implementation in C, and liberal borrowing of features of many vector
749 languages along its 25+ year history, has inherited an unusual mix of
750 syntax elements. Left to his or her own devices, a novice IDL
751 programmer will often conjure code which is very difficult to read and
752 impossible to adapt. Much can be gleaned from studying available IDL
753 code libraries for coding style pointers, but, due to the variety of IDL
754 syntax elements, replicating this style can be challenging at best.
755 Luckily, IDLWAVE understands the structure IDL code very well, and takes
756 care of almost all formatting issues for you. After configuring it to
757 match your coding standards, you can rely on it to help keep your code
758 neat and organized.
759
760 @cindex Foreign code, adapting
761 @cindex Indentation, of foreign code
762 @kindex C-M-\
763 To re-indent a larger portion of code (e.g. when working with foreign code
764 written with different conventions), use @kbd{C-M-\}
765 (@code{indent-region}) after marking the relevant code. Useful marking
766 commands are @kbd{C-x h} (the entire file) or @kbd{C-M-h} (the
767 current subprogram). @xref{Actions}, for information how to impose
768 additional formatting conventions on foreign code.
769
770 @node Code Indentation, Continued Statement Indentation, Code Formatting, Code Formatting
771 @subsection Code Indentation
772 @cindex Code indentation
773 @cindex Indentation
774
775 Like all Emacs programming modes, IDLWAVE performs code indentation.
776 The @key{TAB} key indents the current line relative to context.
777 @key{LFD} insert a newline and indents the new line. The indentation is
778 governed by a number of variables. IDLWAVE indents blocks (between
779 @code{PRO}/@code{FUNCTION}/@code{BEGIN} and @code{END}), and
780 continuation lines.
781
782 @defopt idlwave-main-block-indent (@code{0})
783 Extra indentation for the main block of code. That is the block between
784 the FUNCTION/PRO statement and the END statement for that program
785 unit.
786 @end defopt
787
788 @defopt idlwave-block-indent (@code{4})
789 Extra indentation applied to block lines. If you change this, you
790 probably also want to change @code{idlwave-end-offset}.
791 @end defopt
792
793 @defopt idlwave-end-offset (@code{-4})
794 Extra indentation applied to block END lines. A value equal to negative
795 @code{idlwave-block-indent} will make END lines line up with the block
796 BEGIN lines.
797 @end defopt
798
799 @node Continued Statement Indentation, Comment Indentation, Code Indentation, Code Formatting
800 @subsection Continued Statement Indentation
801 @cindex Indentation, continued statement
802 @cindex Continued statement indentation
803 Continuation lines (following a line ending with @code{$}) can receive a
804 fixed indentation offset from the main level, but in several situations
805 IDLWAVE can use a special form of indentation which aligns continued
806 statements more naturally. Special indentation is calculated for
807 continued routine definition statements and calls, enclosing parentheses
808 (like function calls, structure/class definitions, explicit structures
809 or lists, etc.), and continued assignments. An attempt is made to line
810 up with the first non-whitespace character after the relevant opening
811 punctuation mark (@code{,},@code{(},@code{@{},@code{[},@code{=}). For
812 lines without any non-comment characters on the line with the opening
813 punctuation, the continued line(s) are aligned just past the
814 punctuation. An example:
815
816 @example
817 function foo, a, b, $
818 c, d
819 bar = sin( a + b + $
820 c + d)
821 end
822 @end example
823 @noindent
824
825 The only drawback to this special continued statement indentation is
826 that it consumes more space, e.g., for long function names or left hand
827 sides of an assignment:
828
829 @example
830 function thisfunctionnameisverylongsoitwillleavelittleroom, a, b, $
831 c, d
832 @end example
833
834 You can instruct IDLWAVE when to use this special continuation
835 indentation by setting the variable
836 @code{idlwave-max-extra-continuation-indent}, which specifies the
837 maximum additional indentation beyond the basic indent to be tolerated,
838 otherwise defaulting to fixed-offset from the enclosing indent (the size
839 of which offset is set in @code{idlwave-continuation-indent}). Also,
840 since the indentation level is somewhat dynamic in continued statements
841 with special continuation indentation, especially if
842 @code{idlwave-max-extra-continuation-indent} is small, the key @kbd{C-u
843 @key{TAB}} will re-indent all lines in the current statement. Note that
844 @code{idlwave-indent-to-open-paren}, if non-nil, overrides the
845 @code{idlwave-max-extra-continuation-indent} limit, for parentheses
846 only, forcing them always to line up.
847
848
849 @defopt idlwave-continuation-indent (@code{2})
850 Extra indentation applied to normal continuation lines.
851 @end defopt
852
853 @defopt idlwave-max-extra-continuation-indent (@code{20})
854 The maximum additional indentation (over the basic continuation-indent)
855 that will be permitted for special continues. To effectively disable
856 special continuation indentation, set to @code{0}. To enable it
857 constantly, set to a large number (like @code{100}). Note that the
858 indentation in a long continued statement never decreases from line to
859 line, outside of nested parentheses statements.
860 @end defopt
861
862 @defopt idlwave-indent-to-open-paren (@code{t})
863 Non-@code{nil} means indent continuation lines to innermost open
864 parenthesis, regardless of whether the
865 @code{idlwave-max-extra-continuation-indent} limit is satisfied.
866 @end defopt
867
868 @node Comment Indentation, Continuation Lines, Continued Statement Indentation, Code Formatting
869 @subsection Comment Indentation
870 @cindex Comment indentation
871 @cindex Hanging paragraphs
872 @cindex Paragraphs, filling
873 @cindex Paragraphs, hanging
874
875 In IDL, lines starting with a @samp{;} are called @emph{comment lines}.
876 Comment lines are indented as follows:
877
878 @multitable @columnfractions .1 .90
879 @item @code{;;;}
880 @tab The indentation of lines starting with three semicolons remains
881 unchanged.
882 @item @code{;;}
883 @tab Lines starting with two semicolons are indented like the surrounding code.
884 @item @code{;}
885 @tab Lines starting with a single semicolon are indent to a minimum column.
886 @end multitable
887
888 @noindent
889 The indentation of comments starting in column 0 is never changed.
890
891 @defopt idlwave-no-change-comment
892 The indentation of a comment starting with this regexp will not be
893 changed.
894 @end defopt
895
896 @defopt idlwave-begin-line-comment
897 A comment anchored at the beginning of line.
898 @end defopt
899
900 @defopt idlwave-code-comment
901 A comment that starts with this regexp is indented as if it is a part of
902 IDL code.
903 @end defopt
904
905 @node Continuation Lines, Syntax Highlighting, Comment Indentation, Code Formatting
906 @subsection Continuation Lines and Filling
907 @cindex Continuation lines
908 @cindex Line splitting
909 @cindex String splitting
910 @cindex Splitting, of lines
911
912 @kindex M-@key{RET}
913 In IDL, a newline character terminates a statement unless preceded by a
914 @samp{$}. If you would like to start a continuation line, use
915 @kbd{M-@key{RET}}, which calls the command @code{idlwave-split-line}.
916 It inserts the continuation character @samp{$}, terminates the line and
917 indents the new line. The command @kbd{M-@key{RET}} can also be invoked
918 inside a string to split it at that point, in which case the @samp{+}
919 concatenation operator is used.
920
921 @cindex Filling
922 @cindex @code{auto-fill-mode}
923 @cindex Hanging paragraphs
924 When filling comment paragraphs, IDLWAVE overloads the normal filling
925 functions and uses a function which creates the hanging paragraphs
926 customary in IDL routine headers. When @code{auto-fill-mode} is turned
927 on (toggle with @kbd{C-c C-a}), comments will be auto-filled. If the
928 first line of a paragraph contains a match for
929 @code{idlwave-hang-indent-regexp} (a dash-space by default), subsequent
930 lines are positioned to line up after it, as in the following example.
931
932 @example
933 @group
934 ;=================================
935 ; x - an array containing
936 ; lots of interesting numbers.
937 ;
938 ; y - another variable where
939 ; a hanging paragraph is used
940 ; to describe it.
941 ;=================================
942 @end group
943 @end example
944
945 @kindex M-q
946 You can also refill a comment at any time paragraph with @kbd{M-q}.
947 Comment delimiting lines as in the above example, consisting of one or
948 more @samp{;} followed by one or more of the characters @samp{+=-_*},
949 are kept in place, as is.
950
951 @defopt idlwave-fill-comment-line-only (@code{t})
952 Non-@code{nil} means auto fill will only operate on comment lines.
953 @end defopt
954
955 @defopt idlwave-auto-fill-split-string (@code{t})
956 Non-@code{nil} means auto fill will split strings with the IDL @samp{+}
957 operator.
958 @end defopt
959
960 @defopt idlwave-split-line-string (@code{t})
961 Non-@code{nil} means @code{idlwave-split-line} will split strings with
962 @samp{+}.
963 @end defopt
964
965 @defopt idlwave-hanging-indent (@code{t})
966 Non-@code{nil} means comment paragraphs are indented under the hanging
967 indent given by @code{idlwave-hang-indent-regexp} match in the first
968 line of the paragraph.
969 @end defopt
970
971 @defopt idlwave-hang-indent-regexp (@code{"- "})
972 Regular expression matching the position of the hanging indent
973 in the first line of a comment paragraph.
974 @end defopt
975
976 @defopt idlwave-use-last-hang-indent (@code{nil})
977 Non-@code{nil} means use last match on line for
978 @code{idlwave-indent-regexp}.
979 @end defopt
980
981 @node Syntax Highlighting, Octals and Highlighting, Continuation Lines, Code Formatting
982 @subsection Syntax Highlighting
983 @cindex Syntax highlighting
984 @cindex Highlighting of syntax
985 @cindex Font lock
986
987 Highlighting of keywords, comments, strings etc. can be accomplished
988 with @code{font-lock}. If you are using @code{global-font-lock-mode}
989 (in Emacs), or have @code{font-lock} turned on in any other buffer in
990 XEmacs, it should also automatically work in IDLWAVE buffers. If you'd
991 prefer invoking font-lock individually by mode, you can enforce it in
992 @code{idlwave-mode} with the following line in your @file{.emacs}:
993
994 @lisp
995 (add-hook 'idlwave-mode-hook 'turn-on-font-lock)
996 @end lisp
997
998 @noindent IDLWAVE supports 3 increasing levels of syntax highlighting.
999 The variable @code{font-lock-maximum-decoration} determines which level
1000 is selected. Individual categories of special tokens can be selected
1001 for highlighting using the variable
1002 @code{idlwave-default-font-lock-items}.
1003
1004 @defopt idlwave-default-font-lock-items
1005 Items which should be fontified on the default fontification level
1006 2.
1007 @end defopt
1008
1009 @node Octals and Highlighting, , Syntax Highlighting, Code Formatting
1010 @subsection Octals and Highlighting
1011 @cindex Syntax highlighting, Octals
1012 @cindex Highlighting of syntax, Octals
1013
1014 A rare syntax highlighting problem results from the extremely
1015 unfortunate notation for octal numbers in IDL: @code{"123}. This
1016 unpaired quotation mark is very difficult to parse, given that it can be
1017 mixed on a single line with any number of strings. Emacs will
1018 incorrectly identify this as a string, and the highlighting of following
1019 lines of code can be distorted, since the string is never terminated.
1020
1021 One solution to this involves terminating the mistakenly identified
1022 string yourself by providing a closing quotation mark in a comment:
1023
1024 @example
1025 string("305B) + $ ;" <--- for font-lock
1026 ' is an Angstrom.'
1027 @end example
1028
1029 @noindent A far better solution is to abandon this notation for octals
1030 altogether, and use the more sensible alternative IDL provides:
1031
1032 @example
1033 string('305'OB) + ' is an Angstrom.'
1034 @end example
1035
1036 @noindent This simultaneously solves the font-lock problem and is more
1037 consistent with the notation for hexadecimal numbers, e.g. @code{'C5'XB}.
1038
1039 @node Routine Info, Online Help, Code Formatting, The IDLWAVE Major Mode
1040 @section Routine Info
1041 @cindex Routine info
1042 @cindex Updating routine info
1043 @cindex Scanning buffers for routine info
1044 @cindex Buffers, scanning for routine info
1045 @cindex Shell, querying for routine info
1046
1047 @kindex C-c C-i
1048 IDL comes bundled with more than one thousand procedures, functions and
1049 object methods, and large libraries typically contain hundreds or even
1050 thousands more. This large command set makes it difficult to remember
1051 the calling sequence and keywords for routines you use, but IDLWAVE can
1052 help. It builds up routine information using a wide variety of sources:
1053 IDLWAVE in fact knows far more about the routines on your system than
1054 IDL itself. It maintains a list of all built-in routines, with calling
1055 sequences and keywords@footnote{This list is created by scanning the IDL
1056 manuals and might contain (very few) errors. Please report any errors
1057 to the maintainer, so that they can be fixed.}. It also scans Emacs
1058 buffers and library files for routine definitions, and queries the
1059 IDLWAVE-Shell for information about routines currently compiled there.
1060 This information is updated automatically, and so should usually be
1061 current. To force a global update and refresh the routine information,
1062 use @kbd{C-c C-i} (@code{idlwave-update-routine-info}).
1063
1064 @kindex C-c ?
1065 To display the information about a routine, press @kbd{C-c ?}, which
1066 calls the command @code{idlwave-routine-info}. When the current cursor
1067 position is on the name or in the argument list of a procedure or
1068 function, information will be displayed about the routine. For example,
1069 consider the indicated cursor positions in the following line:
1070
1071 @example
1072 plot,x,alog(x+5*sin(x) + 2),
1073 | | | | | | | |
1074 1 2 3 4 5 6 7 8
1075 @end example
1076
1077 @cindex Default routine, for info and help
1078 On positions 1,2 and 8, information about the @samp{plot} procedure will
1079 be shown. On positions 3,4, and 7, the @samp{alog} function will be
1080 described, while positions 5 and 6 will investigate the @samp{sin}
1081 function.
1082
1083 When you ask for routine information about an object method, and the
1084 method exists in several classes, IDLWAVE queries for the class of the
1085 object, unless the class is already known through a text property on the
1086 @samp{->} operator (@pxref{Object Method Completion and Class
1087 Ambiguity}), or by having been explicity included in the call
1088 (e.g. @code{a->myclass::Foo}).
1089
1090 @cindex Calling sequences
1091 @cindex Keywords of a routine
1092 @cindex Routine source information
1093 The description displayed contains the calling sequence, the list of
1094 keywords and the source location of this routine. It looks like this:
1095
1096 @example
1097 Usage: XMANAGER, NAME, ID
1098 Keywords: BACKGROUND CATCH CLEANUP EVENT_HANDLER GROUP_LEADER
1099 JUST_REG MODAL NO_BLOCK
1100 Source: SystemLib [CSB] /soft1/idl53/lib/xmanager.pro
1101 @end example
1102
1103 @cindex Categories, of routines
1104 @cindex Load-path shadows
1105 @cindex Shadows, load-path
1106 @cindex IDL variable @code{!PATH}
1107 @cindex @code{!PATH}, IDL variable
1108 @cindex IDL variable @code{!DIR}
1109 @cindex @code{!DIR}, IDL variable
1110
1111 If a definition of this routine exists in several files accessible to
1112 IDLWAVE, several @samp{Source} lines will point to the different files.
1113 This may indicate that your routine is shadowing a library routine,
1114 which may or may not be what you want (@pxref{Load-Path Shadows}). The
1115 information about the calling sequence and keywords is derived from the
1116 first source listed. Library routines are supported only if you have
1117 scanned your local IDL libraries (@pxref{Library Catalog}). The source
1118 entry consists of a @emph{source category}, a set of @emph{flags} and
1119 the path to the @emph{source file}. The following categories exist:
1120
1121 @multitable @columnfractions .15 .85
1122 @item @i{System}
1123 @tab A system routine of unknown origin. When the system library has
1124 been scanned (@pxref{Library Catalog}), this category will automatically
1125 split into the next two.
1126 @item @i{Builtin}
1127 @tab A builtin system routine with no source code available.
1128 @item @i{SystemLib}
1129 @tab A library system routine in the official lib directory @file{!DIR/lib}.
1130 @item @i{Obsolete}
1131 @tab A library routine in the official lib directory @file{!DIR/lib/obsolete}.
1132 @item @i{Library}
1133 @tab A routine in a file on IDL's search path @code{!PATH}.
1134 @item @i{Other}
1135 @tab Any other routine with a file not known to be on the search path.
1136 @item @i{Unresolved}
1137 @tab An otherwise unkown routine the shell lists as unresolved
1138 (referenced, but not compiled).
1139 @end multitable
1140
1141 You can create additional categories based on the routine's filepath
1142 with the variable @code{idlwave-special-lib-alist}. This is useful for
1143 easy discrimination of various libraries, or even versions of the same
1144 library.
1145
1146 @cindex Flags, in routine info
1147 @cindex Duplicate routines
1148 @cindex Multiply defined routines
1149 @cindex Routine definitions, multiple
1150 The flags @code{[CSB]} indicate the source of the information IDLWAVE
1151 has regarding the file: from a library catalog (@w{@code{[C--]}},
1152 @pxref{Library Catalog}), from the IDL Shell (@w{@code{[-S-]}}) or from
1153 an Emacs buffer (@w{@code{[--B]}}). Combinations are possible (a
1154 compiled library routine visited in a buffer might read
1155 @w{@code{[CSB]}}). If a file contains multiple definitions of the same
1156 routine, the file name will be prefixed with @samp{(Nx)} where @samp{N}
1157 is the number of definitions.
1158
1159 @cindex Online Help from the routine info buffer
1160 @cindex Active text, in routine info
1161 @cindex Inserting keywords, from routine info
1162 @cindex Source file, access from routine info
1163 Some of the text in the @file{*Help*} routine info buffer will be active
1164 (it is highlighted when the mouse moves over it). Typically, clicking
1165 with the right mouse button invokes online help lookup, and clicking
1166 with the middle mouse button inserts keywords or visits files:
1167
1168 @multitable @columnfractions 0.15 0.85
1169 @item @i{Usage}
1170 @tab If online help is installed, a click with the @emph{right} mouse
1171 button on the @i{Usage:} line will access the help for the
1172 routine (@pxref{Online Help}).
1173 @item @i{Keyword}
1174 @tab Online help about keywords is also available with the
1175 @emph{right} mouse button. Clicking on a keyword with the @emph{middle}
1176 mouse button will insert this keyword in the buffer from where
1177 @code{idlwave-routine-info} was called. Holding down @key{SHIFT} while
1178 clicking also adds the initial @samp{/}.
1179 @item @i{Source}
1180 @tab Clicking with the @emph{middle} mouse button on a @samp{Source} line
1181 finds the source file of the routine and visits it in another window.
1182 Another click on the same line switches back to the buffer from which
1183 @kbd{C-c ?} was called. If you use the @emph{right} mouse button, the
1184 source will not be visited by a buffer, but displayed in the online help
1185 window.
1186 @item @i{Classes}
1187 @tab The @i{Classes} line is only included in the routine info window if
1188 the current class inherits from other classes. You can click with the
1189 @emph{middle} mouse button to display routine info about the current
1190 method in other classes on the inheritance chain, if such a method
1191 exists there.
1192 @end multitable
1193
1194 @defopt idlwave-resize-routine-help-window (@code{t})
1195 Non-@code{nil} means resize the Routine-info @file{*Help*} window to
1196 fit the content.
1197 @end defopt
1198
1199 @defopt idlwave-special-lib-alist
1200 Alist of regular expressions matching special library directories.
1201 @end defopt
1202
1203 @defopt idlwave-rinfo-max-source-lines (@code{5})
1204 Maximum number of source files displayed in the Routine Info window.
1205 @end defopt
1206
1207
1208 @node Online Help, Completion, Routine Info, The IDLWAVE Major Mode
1209 @section Online Help
1210
1211 @cindex Online Help
1212 @cindex @file{idlw-help.txt}
1213 @cindex @file{idlw-help.el}
1214 @cindex IDL manual, ASCII version
1215 @cindex Installing online help
1216 @cindex Online Help, Installation
1217 @cindex Speed, of online help
1218 For IDL system routines, RSI provides extensive documentation. IDLWAVE
1219 can access an ASCII version of this documentation very quickly and
1220 accurately. This is @emph{much} faster than using the IDL online help
1221 application, because usually IDLWAVE gets you to the right place in the
1222 docs directly, without any additional browsing and scrolling. For this
1223 online help to work, an ASCII version of the IDL documentation, which is
1224 not part of the standalone IDLWAVE distribution, is required. The
1225 necessary help files can be downloaded from
1226 @uref{@value{IDLWAVE-HOMEPAGE}, the maintainers webpage}. The text
1227 extracted from the PDF files is fine for normal documentation
1228 paragraphs, but graphics and multiline equations will not be well
1229 formatted. See also @ref{Documentation Scan}.
1230
1231 @cindex Updated online help
1232 @cindex Online help, updates
1233 @cindex @code{<NEW>..</NEW>}
1234 Occasionally RSI releases a synopsis of new features in an IDL release,
1235 without simultaneously updating the documentation files, instead
1236 preferring a @i{What's New} document which describes the changes. These
1237 updates are incorporated directly into the IDLWAVE online help, and are
1238 delimited in @code{<NEW>..</NEW>} blocks.
1239
1240 @cindex Source code, as online help
1241 @cindex DocLib header, as online help
1242 For routines which are not documented in the IDL manual (for example
1243 your own routines), the source code is used as help text. If the
1244 requested information can be found in a (more or less) standard DocLib
1245 file header, IDLWAVE shows the header (scrolling down to appropriate
1246 keywords). Otherwise the routine definition statement
1247 (@code{pro}/@code{function}) is shown.
1248
1249 @kindex M-?
1250 In any IDL program (or, as with most IDLWAVE commands, in the IDL
1251 Shell), press @kbd{M-?} (@code{idlwave-context-help}), or click with
1252 @kbd{S-Mouse-3} to access context sensitive online help. The following
1253 locations are recognized context for help:
1254
1255 @cindex Context, for online help
1256 @multitable @columnfractions .25 .75
1257 @item @i{Routine name}
1258 @tab The name of a routine (function, procedure, method).
1259 @item @i{Keyword Parameter}
1260 @tab A keyword parameter of a routine.
1261 @item @i{System Variable}
1262 @tab System variables like @code{!DPI}.
1263 @item @i{IDL Statement}
1264 @tab Statements like @code{PRO}, @code{REPEAT}, @code{COMPILE_OPT}, etc.
1265 @item @i{Class name}
1266 @tab A class name in an @code{OBJ_NEW} call.
1267 @item @i{Class Init}
1268 @tab Beyond the class name in an @code{OBJ_NEW} call.
1269 @item @i{Executive Command}
1270 @tab An executive command like @code{.RUN}. Mostly useful in the shell.
1271 @item @i{Default}
1272 @tab The routine that would be selected for routine info display.
1273 @end multitable
1274
1275 @cindex @code{OBJ_NEW}, special online help
1276 Note that the @code{OBJ_NEW} function is special in that the help
1277 displayed depends on the cursor position: If the cursor is on the
1278 @samp{OBJ_NEW}, this function is described. If it is on the class name
1279 inside the quotes, the documentation for the class is pulled up. If the
1280 cursor is @emph{after} the class name, anywhere in the argument list,
1281 the documentation for the corresponding @code{Init} method and its
1282 keywords is targeted.
1283
1284 @noindent Apart from source buffers, there are two more places from
1285 which online help can be accessed.
1286
1287 @itemize @bullet
1288 @item
1289 Online help for routines and keywords can be accessed through the
1290 Routine Info display. Click with @kbd{Mouse-3} on an item to see the
1291 corresponding help (@pxref{Routine Info}).
1292 @item
1293 When using completion and Emacs pops up a window with possible
1294 completions, clicking with @kbd{Mouse-3} on a completion item invokes
1295 help on that item (@pxref{Completion}).
1296 @end itemize
1297 @noindent
1298 In both cases, a blue face indicates that the item is documented in the
1299 IDL manual, but an attempt will be made to visit non-blue items directly
1300 in the originating source file.
1301
1302 @cindex Help application, key bindings
1303 @cindex Key bindings, in help application
1304 The help window is normally displayed in a separate frame. The
1305 following commands can be used to navigate inside the help system:
1306
1307 @multitable @columnfractions .15 .85
1308 @item @kbd{@key{SPACE}}
1309 @tab Scroll forward one page.
1310 @item @kbd{@key{RET}}
1311 @tab Scroll forward one line.
1312 @item @kbd{@key{DEL}}
1313 @tab Scroll back one page.
1314 @item @kbd{n, p}
1315 @tab Browse to the next or previous topic (in physical sequence).
1316 @item @kbd{b, f}
1317 @tab Move back and forward through the help topic history.
1318 @item @kbd{c}
1319 @tab Clear the history.
1320 @item @kbd{Mouse-2}
1321 @tab Follow a link. Active links are displayed in a different font.
1322 Items under @i{See Also} are active, and classes have links to their
1323 methods and back.
1324 @item @kbd{o}
1325 @tab Open a topic. The topic can be selected with completion.
1326 @item @kbd{*}
1327 @tab Load the whole help file into Emacs, for global text searches.
1328 @item @kbd{q}
1329 @tab Kill the help window.
1330 @end multitable
1331
1332 @sp 1
1333 @noindent When the help text is a source file, the following commands
1334 are also available:
1335
1336 @multitable @columnfractions .15 .85
1337 @item @kbd{h}
1338 @tab Jump to DocLib Header of the routine whose source is displayed
1339 as help.
1340 @item @kbd{H}
1341 @tab Jump to the first DocLib Header in the file.
1342 @item @kbd{.} @r{(Dot)}
1343 @tab Jump back and forth between the routine definition (the
1344 @code{pro}/@code{function} statement) and the description of the help
1345 item in the DocLib header.
1346 @item @kbd{F}
1347 @tab Fontify the buffer like source code. See the variable @code{idlwave-help-fontify-source-code}.
1348 @end multitable
1349
1350 @defopt idlwave-help-directory
1351 The directory where idlw-help.txt and idlw-help.el are stored.
1352 @end defopt
1353
1354 @defopt idlwave-help-use-dedicated-frame (@code{t})
1355 Non-@code{nil} means use a separate frame for Online Help if possible.
1356 @end defopt
1357
1358 @defopt idlwave-help-frame-parameters
1359 The frame parameters for the special Online Help frame.
1360 @end defopt
1361
1362 @defopt idlwave-max-popup-menu-items (@code{20})
1363 Maximum number of items per pane in pop-up menus.
1364 @end defopt
1365
1366 @defopt idlwave-extra-help-function
1367 Function to call for help if the normal help fails.
1368 @end defopt
1369
1370 @defopt idlwave-help-fontify-source-code (@code{nil})
1371 Non-@code{nil} means fontify source code displayed as help.
1372 @end defopt
1373
1374 @defopt idlwave-help-source-try-header (@code{t})
1375 Non-@code{nil} means try to find help in routine header when displaying source
1376 file.
1377 @end defopt
1378
1379 @defopt idlwave-help-link-face
1380 The face for links in IDLWAVE online help.
1381 @end defopt
1382
1383 @defopt idlwave-help-activate-links-aggressively (@code{t})
1384 Non-@code{nil} means make all possible links in help window active.
1385 @end defopt
1386
1387 @node Completion, Routine Source, Online Help, The IDLWAVE Major Mode
1388 @section Completion
1389 @cindex Completion
1390 @cindex Keyword completion
1391 @cindex Method completion
1392 @cindex Object method completion
1393 @cindex Class name completion
1394 @cindex Function name completion
1395 @cindex Procedure name completion
1396
1397 @kindex M-@key{TAB}
1398 @kindex C-c C-i
1399 IDLWAVE offers completion for class names, routine names, keywords,
1400 system variables, class structure tags, regular structure tags and file
1401 names. As in many programming modes, completion is bound to
1402 @kbd{M-@key{TAB}} (or @kbd{@key{TAB}} in the IDLWAVE Shell ---
1403 @pxref{Using the Shell}). Completion uses exactly the same internal
1404 information as routine info, so when necessary (rarely) it can be
1405 updated with @kbd{C-c C-i} (@code{idlwave-update-routine-info}).
1406
1407 The completion function is context sensitive and figures out what to
1408 complete based location of the point. Here are example lines and what
1409 @kbd{M-@key{TAB}} would try to complete when the cursor is on the
1410 position marked with a @samp{_}:
1411
1412 @example
1413 plo_ @r{Procedure}
1414 x = a_ @r{Function}
1415 plot,xra_ @r{Keyword of @code{plot} procedure}
1416 plot,x,y,/x_ @r{Keyword of @code{plot} procedure}
1417 plot,min(_ @r{Keyword of @code{min} function}
1418 obj -> a_ @r{Object method (procedure)}
1419 a(2,3) = obj -> a_ @r{Object method (function)}
1420 x = obj_new('IDL_ @r{Class name}
1421 x = obj_new('MyCl',a_ @r{Keyword to @code{Init} method in class @code{MyCl}}
1422 pro A_ @r{Class name}
1423 pro _ @r{Fill in @code{Class::} of first method in this file}
1424 !v_ @r{System variable}
1425 !version.t_ @r{Structure tag of system variable}
1426 self.g_ @r{Class structure tag in methods}
1427 state.w_ @r{Structure tag, if tag completion enabled}
1428 name = 'a_ @r{File name (default inside quotes)}
1429 @end example
1430
1431 @cindex Completion, ambiguity
1432 @cindex Completion, forcing function name
1433 The only place where completion is ambiguous is procedure/function
1434 @emph{keywords} versus @emph{functions}. After @samp{plot,x_}, IDLWAVE
1435 will always assume a keyword to plot. You can force completion of a
1436 function name at such a location with a prefix arg: @kbd{C-u
1437 M-@key{TAB}}.
1438
1439 @cindex Scrolling the @file{*Completions*} window
1440 @cindex Completion, scrolling
1441 @cindex Completion, Online Help
1442 @cindex Online Help in @file{*Completions*} buffer
1443 If the list of completions is too long to fit in the
1444 @file{*Completions*} window, the window can be scrolled by pressing
1445 @kbd{M-@key{TAB}} repeatedly. Online help (if installed) for each
1446 possible completion is available by clicking with @kbd{Mouse-3} on the
1447 item. Items for which system online help (from the IDL manual) is
1448 available will be displayed in a different font (e.g. colored blue).
1449 For other items, the corresponding source code or DocLib header will be
1450 used as the help text.
1451
1452 @defopt idlwave-keyword-completion-adds-equal (@code{t})
1453 Non-@code{nil} means completion automatically adds @samp{=} after
1454 completed keywords.
1455 @end defopt
1456
1457 @defopt idlwave-function-completion-adds-paren (@code{t})
1458 Non-@code{nil} means completion automatically adds @samp{(} after
1459 completed function. A value of `2' means also add the closing
1460 parenthesis and position the cursor between the two.
1461 @end defopt
1462
1463 @defopt idlwave-completion-restore-window-configuration (@code{t})
1464 Non-@code{nil} means restore window configuration after successful
1465 completion.
1466 @end defopt
1467
1468 @defopt idlwave-highlight-help-links-in-completion (@code{t})
1469 Non-@code{nil} means highlight completions for which system help is
1470 available.
1471 @end defopt
1472
1473 @menu
1474 * Case of Completed Words:: CaseOFcomPletedWords
1475 * Object Method Completion and Class Ambiguity:: obj->Method, what?
1476 * Class and Keyword Inheritance:: obj->Method, _EXTRA=e
1477 * Structure Tag Completion:: Completing state.Tag
1478 @end menu
1479
1480 @node Case of Completed Words, Object Method Completion and Class Ambiguity, Completion, Completion
1481 @subsection Case of Completed Words
1482 @cindex Case of completed words
1483 @cindex Mixed case completion
1484 The case of the completed words is determined by what is already in the
1485 buffer. When the partial word being completed is all lower case, the
1486 completion will be lower case as well. If at least one character is
1487 upper case, the string will be completed in upper case or mixed case.
1488 The default is to use upper case for procedures, functions and keywords,
1489 and mixed case for object class names and methods, similar to the
1490 conventions in the IDL manuals. These defaults can be changed with the
1491 variable @code{idlwave-completion-case}. For instance, to enable
1492 mixed-case completion for routines in addition to classes and methods,
1493 you need an entry such as @code{routine . preserve} in that variable.
1494 To enable total control over the case of completed items, independent of
1495 buffer context, set @code{idlwave-completion-force-default-case} to
1496 non-@code{nil}.
1497
1498 @defopt idlwave-completion-case
1499 Association list setting the case (UPPER/lower/Capitalized/MixedCase...)
1500 of completed words.
1501 @end defopt
1502
1503 @defopt idlwave-completion-force-default-case (@code{nil})
1504 Non-@code{nil} means completion will always honor the settings in
1505 @code{idlwave-completion-case}. When nil (the default), entirely lower
1506 case strings will always be completed to lower case, no matter what the
1507 settings in @code{idlwave-completion-case}.
1508 @end defopt
1509
1510 @defopt idlwave-complete-empty-string-as-lower-case (@code{nil})
1511 Non-@code{nil} means the empty string is considered lower case for
1512 completion.
1513 @end defopt
1514
1515 @node Object Method Completion and Class Ambiguity, Class and Keyword Inheritance, Case of Completed Words, Completion
1516 @subsection Object Method Completion and Class Ambiguity
1517 @cindex Object methods
1518 @cindex Class ambiguity
1519 @cindex @code{self} object, default class
1520 An object method is not uniquely determined without the object's class.
1521 Since the class is almost always omitted in the calling source, IDLWAVE
1522 considers all available methods in all classes as possible method name
1523 completions. The combined list of keywords of the current method in
1524 @emph{all} known classes which contain that method will be considered
1525 for keyword completion. In the @file{*Completions*} buffer, the
1526 matching classes will be shown next to each item (see option
1527 @code{idlwave-completion-show-classes}). As a special case, the class
1528 of an object called @samp{self} is always taken to be the class of the
1529 current routine. All classes it inherits from are considered as well
1530 where appropriate.
1531
1532 @cindex Forcing class query.
1533 @cindex Class query, forcing
1534 You can also call @code{idlwave-complete} with a prefix arg: @kbd{C-u
1535 M-@key{TAB}}. IDLWAVE will then prompt you for the class in order to
1536 narrow down the number of possible completions. The variable
1537 @code{idlwave-query-class} can be configured to make such prompting the
1538 default for all methods (not recommended), or selectively for very
1539 common methods for which the number of completing keywords would be too
1540 large (e.g. @code{Init}). After you have specified the class for a
1541 particular statement (e.g. when completing the method), IDLWAVE can
1542 remember it for the rest of the editing session. Subsequent completions
1543 in the same statement (e.g. keywords) can then reuse this class
1544 information. This works by placing a text property on the method
1545 invocation operator @samp{->}, after which the operator will be shown in
1546 a different face. This is not enabled by default --- the variable
1547 @code{idlwave-store-inquired-class} can be used to turn it on.
1548
1549 @defopt idlwave-completion-show-classes (@code{1})
1550 Non-@code{nil} means show classes in @file{*Completions*} buffer when
1551 completing object methods and keywords.
1552 @end defopt
1553
1554 @defopt idlwave-completion-fontify-classes (@code{t})
1555 Non-@code{nil} means fontify the classes in completions buffer.
1556 @end defopt
1557
1558 @defopt idlwave-query-class (@code{nil})
1559 Association list governing query for object classes during completion.
1560 @end defopt
1561
1562 @defopt idlwave-store-inquired-class (@code{nil})
1563 Non-@code{nil} means store class of a method call as text property on
1564 @samp{->}.
1565 @end defopt
1566
1567 @defopt idlwave-class-arrow-face
1568 Face to highlight object operator arrows @samp{->} which carry a class
1569 text property.
1570 @end defopt
1571
1572 @node Class and Keyword Inheritance, Structure Tag Completion, Object Method Completion and Class Ambiguity, Completion
1573 @subsection Class and Keyword Inheritance
1574 @cindex Inheritance, class
1575 @cindex Keyword inheritance
1576 @cindex Inheritance, keyword
1577
1578 Class inheritance affects which methods are called in IDL. An object of
1579 a class which inherits methods from one or more superclasses can
1580 override that method by defining its own method of the same name, extend
1581 the method by calling the method(s) of its superclass(es) in its
1582 version, or inherit the method directly by making no modifications.
1583 IDLWAVE examines class definitions during completion and routine
1584 information display, and records all inheritance information it finds.
1585 This information is displayed if appropriate with the calling sequence
1586 for methods (@pxref{Routine Info}), as long as variable
1587 @code{idlwave-support-inheritance} is non-@code{nil}.
1588
1589 In many class methods, @emph{keyword} inheritance (@code{_EXTRA} and
1590 @code{_REF_EXTRA}) is used hand-in-hand with class inheritance and
1591 method overriding. E.g., in a @code{SetProperty} method, this technique
1592 allows a single call @code{obj->SetProperty} to set properties up the
1593 entire class inheritance chain. This is often referred to as
1594 @emph{chaining}, and is characterized by chained method calls like
1595 @w{@code{self->MySuperClass::SetProperty,_EXTRA=e}}.
1596
1597 IDLWAVE can accomodate this special synergy between class and keyword
1598 inheritance: if @code{_EXTRA} or @code{_REF_EXTRA} are detected among a
1599 method's keyword parameters, all keywords of superclass versions of the
1600 method being considered are included in completion. The completion
1601 buffer will label keywords based on their originating class. The
1602 variable @code{idlwave-keyword-class-inheritance} can be used to
1603 configure which methods have keyword inheritance treated in this simple,
1604 class-driven way. By default, only @code{Init} and
1605 @code{(Get|Set)Property} are.
1606
1607 @defopt idlwave-support-inheritance (@code{t})
1608 Non-@code{nil} means consider inheritance during completion, online help etc.
1609 @end defopt
1610
1611 @defopt idlwave-keyword-class-inheritance
1612 A list of regular expressions to match methods for which simple
1613 class-driven keyword inheritance will be used for Completion.
1614 @end defopt
1615
1616 @node Structure Tag Completion, , Class and Keyword Inheritance, Completion
1617 @subsection Structure Tag Completion
1618 @cindex Completion, structure tag
1619 @cindex Structure tag completion
1620
1621 In many programs, especially those involving widgets, large structures
1622 (e.g. the @samp{state} structure) are used to communicate among
1623 routines. It is very convenient to be able to complete structure tags,
1624 in the same way as for instance variables of the @samp{self} object
1625 (@pxref{Object Method Completion and Class Ambiguity}). Add-in code for
1626 structure tag completion is available in the form of a loadable
1627 completion module: @file{idlw-complete-structtag.el}. Tag completion in
1628 structures is highly ambiguous (much more so than @samp{self}
1629 completion), so @code{idlw-complete-structtag} makes an unusual and
1630 specific assumption: the exact same variable name is used to refer to
1631 the structure in all parts of the program. So, if you consistently
1632 refer to the same structure with the same variable name
1633 (e.g. @samp{state}), structure tags which are read from its definition
1634 can be used for completion.
1635
1636 Structure tag completion is not enabled by default. To enable it,
1637 simply add the following to your @file{.emacs}:
1638
1639 @lisp
1640 (add-hook 'idlwave-load-hook
1641 (lambda () (require 'idlw-complete-structtag)))
1642 @end lisp
1643
1644 @node Routine Source, Resolving Routines, Completion, The IDLWAVE Major Mode
1645 @section Routine Source
1646 @cindex Routine source file
1647 @cindex Module source file
1648 @cindex Source file, of a routine
1649 @kindex C-c C-v
1650 In addition to clicking on a @i{Source:} line in the routine info
1651 window, there is another way to find the source file of a routine. The
1652 command @kbd{C-c C-v} (@code{idlwave-find-module}) asks for a module
1653 name, offering the same default as @code{idlwave-routine-info} would
1654 have used, taken from nearby buffer contents. In the minibuffer,
1655 specify a complete routine name (including any class part). IDLWAVE
1656 will display the source file in another window, positioned at the
1657 routine in question.
1658
1659 @cindex Buffers, killing
1660 @cindex Killing autoloaded buffers
1661 Since getting the source of a routine into a buffer is so easy with
1662 IDLWAVE, too many buffers visiting different IDL source files are
1663 sometimes created. The special command @kbd{C-c C-k}
1664 (@code{idlwave-kill-autoloaded-buffers}) can be used to remove these
1665 buffers.
1666
1667 @node Resolving Routines, Code Templates, Routine Source, The IDLWAVE Major Mode
1668 @section Resolving Routines
1669 @cindex @code{RESOLVE_ROUTINE}
1670 @cindex Compiling library modules
1671 @cindex Routines, resolving
1672
1673 The key sequence @kbd{C-c =} calls the command @code{idlwave-resolve}
1674 and sends the line @samp{RESOLVE_ROUTINE, '@var{routine_name}'} to IDL
1675 in order to resolve (compile) it. The default routine to be resolved is
1676 taken from context, but you get a chance to edit it.
1677
1678 @code{idlwave-resolve} is one way to get a library module within reach
1679 of IDLWAVE's routine info collecting functions. A better way is to
1680 scan (parts of) the library (@pxref{Library Catalog}). Routine info on
1681 library modules will then be available without the need to compile the
1682 modules first, and even without a running shell.
1683
1684 @xref{Sources of Routine Info}, for more information on the ways IDLWAVE
1685 collects data about routines, and how to update this information.
1686
1687 @node Code Templates, Abbreviations, Resolving Routines, The IDLWAVE Major Mode
1688 @section Code Templates
1689 @cindex Code templates
1690 @cindex Templates
1691
1692 IDLWAVE can insert IDL code templates into the buffer. For a few
1693 templates, this is done with direct key bindings:
1694
1695 @multitable @columnfractions .15 .85
1696 @item @kbd{C-c C-c}
1697 @tab @code{CASE} statement template
1698 @item @kbd{C-c C-f}
1699 @tab @code{FOR} loop template
1700 @item @kbd{C-c C-r}
1701 @tab @code{REPEAT} loop template
1702 @item @kbd{C-c C-w}
1703 @tab @code{WHILE} loop template
1704 @end multitable
1705
1706 All code templates are also available as abbreviations
1707 (@pxref{Abbreviations}).
1708
1709 @node Abbreviations, Actions, Code Templates, The IDLWAVE Major Mode
1710 @section Abbreviations
1711 @cindex Abbreviations
1712
1713 Special abbreviations exist to enable rapid entry of commonly used
1714 commands. Emacs abbreviations are expanded by typing text into the
1715 buffer and pressing @key{SPC} or @key{RET}. The special abbreviations
1716 used to insert code templates all start with a @samp{\} (the backslash),
1717 or, optionally, any other character set in
1718 @code{idlwave-abbrev-start-char}. IDLWAVE ensures that abbreviations are
1719 only expanded where they should be (i.e., not in a string or comment),
1720 and permits the point to be moved after an abbreviation expansion ---
1721 very useful for positioning the mark inside of parentheses, etc.
1722
1723 Special abbreviations are pre-defined for code templates and other
1724 useful items. To visit the full list of abbreviations, use @kbd{M-x
1725 idlwave-list-abbrevs}.
1726
1727 Template abbreviations:
1728
1729 @multitable @columnfractions .15 .85
1730 @item @code{\pr}
1731 @tab @code{PROCEDURE} template
1732 @item @code{\fu}
1733 @tab @code{FUNCTION} template
1734 @item @code{\c}
1735 @tab @code{CASE} statement template
1736 @item @code{\f}
1737 @tab @code{FOR} loop template
1738 @item @code{\r}
1739 @tab @code{REPEAT} loop template
1740 @item @code{\w}
1741 @tab @code{WHILE} loop template
1742 @item @code{\i}
1743 @tab @code{IF} statement template
1744 @item @code{\elif}
1745 @tab @code{IF-ELSE} statement template
1746 @end multitable
1747
1748 String abbreviations:
1749
1750 @multitable @columnfractions .15 .85
1751 @item @code{\ap}
1752 @tab @code{arg_present()}
1753 @item @code{\b}
1754 @tab @code{begin}
1755 @item @code{\cb}
1756 @tab @code{byte()}
1757 @item @code{\cc}
1758 @tab @code{complex()}
1759 @item @code{\cd}
1760 @tab @code{double()}
1761 @item @code{\cf}
1762 @tab @code{float()}
1763 @item @code{\cl}
1764 @tab @code{long()}
1765 @item @code{\co}
1766 @tab @code{common}
1767 @item @code{\cs}
1768 @tab @code{string()}
1769 @item @code{\cx}
1770 @tab @code{fix()}
1771 @item @code{\e}
1772 @tab @code{else}
1773 @item @code{\ec}
1774 @tab @code{endcase}
1775 @item @code{\ee}
1776 @tab @code{endelse}
1777 @item @code{\ef}
1778 @tab @code{endfor}
1779 @item @code{\ei}
1780 @tab @code{endif else if}
1781 @item @code{\el}
1782 @tab @code{endif else}
1783 @item @code{\en}
1784 @tab @code{endif}
1785 @item @code{\er}
1786 @tab @code{endrep}
1787 @item @code{\es}
1788 @tab @code{endswitch}
1789 @item @code{\ew}
1790 @tab @code{endwhile}
1791 @item @code{\g}
1792 @tab @code{goto,}
1793 @item @code{\h}
1794 @tab @code{help,}
1795 @item @code{\ik}
1796 @tab @code{if keyword_set() then}
1797 @item @code{\iap}
1798 @tab @code{if arg_present() then}
1799 @item @code{\ine}
1800 @tab @code{if n_elements() eq 0 then}
1801 @item @code{\inn}
1802 @tab @code{if n_elements() ne 0 then}
1803 @item @code{\k}
1804 @tab @code{keyword_set()}
1805 @item @code{\n}
1806 @tab @code{n_elements()}
1807 @item @code{\np}
1808 @tab @code{n_params()}
1809 @item @code{\oi}
1810 @tab @code{on_ioerror,}
1811 @item @code{\or}
1812 @tab @code{openr,}
1813 @item @code{\ou}
1814 @tab @code{openu,}
1815 @item @code{\ow}
1816 @tab @code{openw,}
1817 @item @code{\p}
1818 @tab @code{print,}
1819 @item @code{\pt}
1820 @tab @code{plot,}
1821 @item @code{\re}
1822 @tab @code{read,}
1823 @item @code{\rf}
1824 @tab @code{readf,}
1825 @item @code{\rt}
1826 @tab @code{return}
1827 @item @code{\ru}
1828 @tab @code{readu,}
1829 @item @code{\s}
1830 @tab @code{size()}
1831 @item @code{\sc}
1832 @tab @code{strcompress()}
1833 @item @code{\sl}
1834 @tab @code{strlowcase()}
1835 @item @code{\sm}
1836 @tab @code{strmid()}
1837 @item @code{\sn}
1838 @tab @code{strlen()}
1839 @item @code{\sp}
1840 @tab @code{strpos()}
1841 @item @code{\sr}
1842 @tab @code{strtrim()}
1843 @item @code{\st}
1844 @tab @code{strput()}
1845 @item @code{\su}
1846 @tab @code{strupcase()}
1847 @item @code{\t}
1848 @tab @code{then}
1849 @item @code{\u}
1850 @tab @code{until}
1851 @item @code{\wc}
1852 @tab @code{widget_control,}
1853 @item @code{\wi}
1854 @tab @code{widget_info()}
1855 @item @code{\wu}
1856 @tab @code{writeu,}
1857 @end multitable
1858
1859 @noindent You can easily add your own abbreviations or override existing
1860 abbrevs with @code{define-abbrev} in your mode hook, using the
1861 convenience function @code{idlwave-define-abbrev}:
1862
1863 @lisp
1864 (add-hook 'idlwave-mode-hook
1865 (lambda ()
1866 (idlwave-define-abbrev "wb" "widget_base()"
1867 (idlwave-keyword-abbrev 1))
1868 (idlwave-define-abbrev "ine" "IF N_Elements() EQ 0 THEN"
1869 (idlwave-keyword-abbrev 11))))
1870 @end lisp
1871
1872 Notice how the abbreviation (here @emph{wb}) and its expansion
1873 (@emph{widget_base()}) are given as argument, and the single argument to
1874 @code{idlwave-keyword-abbrev} (here @emph{1}) specifies how far back to
1875 move the point upon expansion (in this example, to put it between the
1876 parentheses).
1877
1878 The abbreviations are expanded in upper or lower case, depending upon
1879 the variables @code{idlwave-abbrev-change-case} and (for reserved word
1880 templates) @code{idlwave-reserved-word-upcase} (@pxref{Case Changes}).
1881
1882 @defopt idlwave-abbrev-start-char (@code{"\"})
1883 A single character string used to start abbreviations in abbrev
1884 mode.
1885 @end defopt
1886
1887 @defopt idlwave-abbrev-move (@code{t})
1888 Non-@code{nil} means the abbrev hook can move point, e.g. to end up
1889 between the parenthesis of a function call.
1890 @end defopt
1891
1892 @node Actions, Doc Header, Abbreviations, The IDLWAVE Major Mode
1893 @section Actions
1894 @cindex Actions
1895 @cindex Coding standards, enforcing
1896
1897 @emph{Actions} are special commands which are executed automatically
1898 while you write code in order to check the structure of the program or
1899 to enforce coding standards. Most actions which have been implemented
1900 in IDLWAVE are turned off by default, assuming that the average user
1901 wants her code the way she writes it. But if you are a lazy typist and
1902 want your code to adhere to certain standards, actions can be
1903 helpful.
1904
1905 Actions can be applied in three ways:
1906
1907 @itemize @bullet
1908 @item
1909 Some actions are applied directly while typing. For example, pressing
1910 @samp{=} can run a check to make sure that this operator is surrounded
1911 by spaces and insert these spaces if necessary. Pressing @key{SPC}
1912 after a reserved word can call a command to change the word to upper
1913 case.
1914 @item
1915 When a line is re-indented with @key{TAB}, actions can be applied to the
1916 entire line. To enable this, the variable @code{idlwave-do-actions}
1917 must be non-@code{nil}.
1918 @item
1919 @cindex Foreign code, adapting
1920 @cindex Actions, applied to foreign code
1921 Actions can also be applied to a larger piece of code, e.g. to convert
1922 foreign code to your own style. To do this, mark the relevant part of
1923 the code and execute @kbd{M-x expand-region-abbrevs}. Useful marking
1924 commands are @kbd{C-x h} (the entire file) or @kbd{C-M-h} (the current
1925 subprogram). @xref{Code Indentation}, for information how to adjust the
1926 indentation of the code.
1927 @end itemize
1928
1929 @defopt idlwave-do-actions (@code{nil})
1930 Non-@code{nil} means performs actions when indenting.
1931 @end defopt
1932
1933 @menu
1934 * Block Boundary Check:: Is the END correct
1935 * Padding Operators:: Enforcing space around `=' etc
1936 * Case Changes:: Enforcing upper case keywords
1937 @end menu
1938
1939 @node Block Boundary Check, Padding Operators, Actions, Actions
1940 @subsection Block Boundary Check
1941 @cindex Block boundary check
1942 @cindex @code{END} type checking
1943 @cindex @code{END}, automatic insertion
1944 @cindex @code{END}, expanding
1945 @cindex Block, closing
1946 @cindex Closing a block
1947
1948 Whenever you type an @code{END} statement, IDLWAVE finds the
1949 corresponding start of the block and the cursor blinks back to that
1950 location for a second. If you have typed a specific @code{END}, like
1951 @code{ENDIF} or @code{ENDCASE}, you get a warning if that terminator
1952 does not match the type of block it terminates.
1953
1954 Set the variable @code{idlwave-expand-generic-end} in order to have all
1955 generic @code{END} statements automatically expanded to the appropriate
1956 type. You can also type @kbd{C-c ]} to close the current block by
1957 inserting the appropriate @code{END} statement.
1958
1959 @defopt idlwave-show-block (@code{t})
1960 Non-@code{nil} means point blinks to block beginning for
1961 @code{idlwave-show-begin}.
1962 @end defopt
1963
1964 @defopt idlwave-expand-generic-end (@code{t})
1965 Non-@code{nil} means expand generic END to ENDIF/ENDELSE/ENDWHILE etc.
1966 @end defopt
1967
1968 @defopt idlwave-reindent-end (@code{t})
1969 Non-@code{nil} means re-indent line after END was typed.
1970 @end defopt
1971
1972 @node Padding Operators, Case Changes, Block Boundary Check, Actions
1973 @subsection Padding Operators
1974 @cindex Padding operators with spaces
1975 @cindex Operators, padding with spaces
1976 @cindex Space, around operators
1977
1978 Some operators can be automatically surrounded by spaces. This can
1979 happen when the operator is typed, or later when the line is indented.
1980 IDLWAVE can pad the operators @samp{&}, @samp{<}, @samp{>}, @samp{,},
1981 @samp{=}, and @samp{->}, but this feature is turned off by default. If
1982 you want to turn it on, customize the variables
1983 @code{idlwave-surround-by-blank} and @code{idlwave-do-actions}. You can
1984 also define similar actions for other operators by using the function
1985 @code{idlwave-action-and-binding} in the mode hook. For example, to
1986 enforce space padding of the @samp{+} and @samp{*} operators, try this
1987 in @file{.emacs}
1988
1989 @lisp
1990 (add-hook 'idlwave-mode-hook
1991 (lambda ()
1992 (setq idlwave-surround-by-blank t) ; Turn this type of actions on
1993 (idlwave-action-and-binding "*" '(idlwave-surround 1 1))
1994 (idlwave-action-and-binding "+" '(idlwave-surround 1 1))))
1995 @end lisp
1996
1997 @defopt idlwave-surround-by-blank (@code{nil})
1998 Non-@code{nil} means enable @code{idlwave-surround}. If non-@code{nil},
1999 @samp{=}, @samp{<}, @samp{>}, @samp{&}, @samp{,}, @samp{->} are
2000 surrounded with spaces by @code{idlwave-surround}.
2001 @end defopt
2002
2003 @defopt idlwave-pad-keyword (@code{t})
2004 Non-@code{nil} means pad @samp{=} for keywords like assignments.
2005 @end defopt
2006
2007 @node Case Changes, , Padding Operators, Actions
2008 @subsection Case Changes
2009 @cindex Case changes
2010 @cindex Upcase, enforcing for reserved words
2011 @cindex Downcase, enforcing for reserved words
2012
2013 Actions can be used to change the case of reserved words or expanded
2014 abbreviations by customizing the variables
2015 @code{idlwave-abbrev-change-case} and
2016 @code{idlwave-reserved-word-upcase}. If you want to change the case of
2017 additional words automatically, put something like the following into
2018 your @file{.emacs} file:
2019
2020 @lisp
2021 (add-hook 'idlwave-mode-hook
2022 (lambda ()
2023 ;; Capitalize system vars
2024 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)
2025 ;; Capitalize procedure name
2026 (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
2027 '(capitalize-word 1) t)
2028 ;; Capitalize common block name
2029 (idlwave-action-and-binding "\\<common\\>[ \t]+\\<"
2030 '(capitalize-word 1) t)))
2031 @end lisp
2032
2033 For more information, see the documentation string for the function
2034 @code{idlwave-action-and-binding}. For information on controlling the
2035 case of routines, keywords, classes, and methods as they are completed, see
2036 @ref{Completion}.
2037
2038 @defopt idlwave-abbrev-change-case (@code{nil})
2039 Non-@code{nil} means all abbrevs will be forced to either upper or lower
2040 case. Legal values are @code{nil}, @code{t}, and @code{down}.
2041 @end defopt
2042
2043 @defopt idlwave-reserved-word-upcase (@code{nil})
2044 Non-@code{nil} means reserved words will be made upper case via abbrev
2045 expansion.
2046 @end defopt
2047
2048
2049 @node Doc Header, Motion Commands, Actions, The IDLWAVE Major Mode
2050 @section Documentation Header
2051 @cindex Documentation header
2052 @cindex DocLib header
2053 @cindex Modification timestamp
2054 @cindex Header, for file documentation
2055 @cindex Timestamp, in doc header.
2056 @cindex Changelog, in doc header.
2057
2058 @kindex C-c C-h
2059 @kindex C-c C-m
2060 The command @kbd{C-c C-h} inserts a standard routine header into the
2061 buffer, with the usual fields for documentation (a different header can
2062 be specified with @code{idlwave-file-header}). One of the keywords is
2063 @samp{MODIFICATION HISTORY} under which the changes to a routine can be
2064 recorded. The command @kbd{C-c C-m} jumps to the @samp{MODIFICATION
2065 HISTORY} of the current routine or file and inserts the user name with a
2066 timestamp.
2067
2068 @defopt idlwave-file-header
2069 The doc-header template or a path to a file containing it.
2070 @end defopt
2071
2072 @defopt idlwave-header-to-beginning-of-file (@code{nil})
2073 Non-@code{nil} means the documentation header will always be at start
2074 of file.
2075 @end defopt
2076
2077 @defopt idlwave-timestamp-hook
2078 The hook function used to update the timestamp of a function.
2079 @end defopt
2080
2081 @defopt idlwave-doc-modifications-keyword
2082 The modifications keyword to use with the log documentation commands.
2083 @end defopt
2084
2085 @defopt idlwave-doclib-start
2086 Regexp matching the start of a document library header.
2087 @end defopt
2088
2089 @defopt idlwave-doclib-end
2090 Regexp matching the start of a document library header.
2091 @end defopt
2092
2093 @node Motion Commands, Misc Options, Doc Header, The IDLWAVE Major Mode
2094 @section Motion Commands
2095 @cindex Motion commands
2096 @cindex Program structure, moving through
2097 @cindex Code structure, moving through
2098 @cindex @file{Func-menu}, XEmacs package
2099 @cindex @file{Imenu}, Emacs package
2100 @cindex Function definitions, jumping to
2101 @cindex Procedure definitions, jumping to
2102
2103 IDLWAVE supports both @file{Imenu} and @file{Func-menu}, two packages
2104 which make it easy to jump to the definitions of functions and
2105 procedures in the current file with a pop-up selection. To bind
2106 @file{Imenu} to a mouse-press, use in your @file{.emacs}:
2107
2108 @lisp
2109 (define-key global-map [S-down-mouse-3] 'imenu)
2110 @end lisp
2111
2112 @cindex @file{Speedbar}, Emacs package
2113
2114 In addition, @file{Speedbar} support allows convenient navigation of a
2115 source tree of IDL routine files, quickly stepping to routine
2116 definitions. See @code{Tools->Display Speedbar}.
2117
2118 Several commands allow you to move quickly through the structure of an
2119 IDL program:
2120
2121 @multitable @columnfractions .15 .85
2122 @item @kbd{C-M-a}
2123 @tab Beginning of subprogram
2124 @item @kbd{C-M-e}
2125 @tab End of subprogram
2126 @item @kbd{C-c @{}
2127 @tab Beginning of block (stay inside the block)
2128 @item @kbd{C-c @}}
2129 @tab End of block (stay inside the block)
2130 @item @kbd{C-M-n}
2131 @tab Forward block (on same level)
2132 @item @kbd{C-M-p}
2133 @tab Backward block (on same level)
2134 @item @kbd{C-M-d}
2135 @tab Down block (enters a block)
2136 @item @kbd{C-M-u}
2137 @tab Backward up block (leaves a block)
2138 @item @kbd{C-c C-n}
2139 @tab Next Statement
2140 @end multitable
2141
2142
2143 @node Misc Options, , Motion Commands, The IDLWAVE Major Mode
2144 @section Miscellaneous Options
2145 @cindex Hooks
2146
2147 @defopt idlwave-help-application
2148 The external application providing reference help for programming.
2149 @end defopt
2150
2151 @defopt idlwave-startup-message (@code{t})
2152 Non-@code{nil} means display a startup message when @code{idlwave-mode}'
2153 is first called.
2154 @end defopt
2155
2156 @defopt idlwave-mode-hook
2157 Normal hook. Executed when a buffer is put into @code{idlwave-mode}.
2158 @end defopt
2159
2160 @defopt idlwave-load-hook
2161 Normal hook. Executed when @file{idlwave.el} is loaded.
2162 @end defopt
2163
2164
2165
2166 @node The IDLWAVE Shell, Installation, The IDLWAVE Major Mode, Top
2167 @chapter The IDLWAVE Shell
2168 @cindex IDLWAVE shell
2169 @cindex Major mode, @code{idlwave-shell-mode}
2170 @cindex IDL, as Emacs subprocess
2171 @cindex Subprocess of Emacs, IDL
2172 @cindex Comint, Emacs package
2173 @cindex Windows
2174 @cindex MacOS
2175
2176 The IDLWAVE shell is an Emacs major mode which permits running the IDL
2177 program as an inferior process of Emacs, and works closely with the
2178 IDLWAVE major mode in buffers. It can be used to work with IDL
2179 interactively, to compile and run IDL programs in Emacs buffers and to
2180 debug these programs. The IDLWAVE shell is built upon @file{comint}, an
2181 Emacs packages which handles the communication with the IDL program.
2182 Unfortunately IDL for Windows and MacOS do not have command-prompt
2183 versions and thus do not allow the interaction with
2184 Emacs@footnote{Please inform the maintainer if you come up with a way to
2185 make the IDLWAVE shell work on these systems.} --- so the IDLWAVE shell
2186 currently only works under GNU and Unix.
2187
2188 @menu
2189 * Starting the Shell:: How to launch IDL as a subprocess
2190 * Using the Shell:: Interactively working with the Shell
2191 * Debugging IDL Programs:: Compilation/Debugging
2192 * Examining Variables::
2193 * Custom Expression Examination::
2194 @end menu
2195
2196 @node Starting the Shell, Using the Shell, The IDLWAVE Shell, The IDLWAVE Shell
2197 @section Starting the Shell
2198 @cindex Starting the shell
2199 @cindex Shell, starting
2200 @cindex Dedicated frame, for shell buffer
2201 @cindex Frame, for shell buffer
2202 @cindex Subprocess of Emacs, IDL
2203
2204 @kindex C-c C-s
2205 The IDLWAVE shell can be started with the command @kbd{M-x
2206 idlwave-shell}. In @code{idlwave-mode} the function is bound to
2207 @kbd{C-c C-s}. It creates a buffer @file{*idl*} which is used to
2208 interact with the shell. If the shell is already running, @kbd{C-c C-s}
2209 will simple switch to the shell buffer. The command @kbd{C-c C-l}
2210 (@code{idlwave-shell-recenter-shell-window}) displays the shell window
2211 without selecting it. The shell can also be started automatically when
2212 another command tries to send a command to it. To enable auto start,
2213 set the variable @code{idlwave-shell-automatic-start} to @code{t}.
2214
2215 In order to create a separate frame for the IDLWAVE shell buffer, call
2216 @code{idlwave-shell} with a prefix argument: @kbd{C-u C-c C-s} or
2217 @kbd{C-u C-c C-l}. If you always want a dedicated frame for the shell
2218 window, configure the variable
2219 @code{idlwave-shell-use-dedicated-frame}.
2220
2221 To launch a quick IDLWAVE shell directly from a shell prompt without an
2222 IDLWAVE buffer (e.g., as a replacement for running inside an xterm),
2223 define an alias with the following content:
2224
2225 @example
2226 emacs -geometry 80x32 -eval "(idlwave-shell 'quick)"
2227 @end example
2228
2229 Replace the @samp{-geometry 80x32} option with @samp{-nw} if you prefer
2230 the Emacs process to run directly inside the terminal window.
2231
2232 @defopt idlwave-shell-explicit-file-name (@file{idl})
2233 This is the command to run IDL.
2234 @end defopt
2235
2236 @defopt idlwave-shell-command-line-options
2237 A list of command line options for calling the IDL program.
2238 @end defopt
2239
2240 @defopt idlwave-shell-prompt-pattern
2241 Regexp to match IDL prompt at beginning of a line.
2242 @end defopt
2243
2244 @defopt idlwave-shell-process-name
2245 Name to be associated with the IDL process.
2246 @end defopt
2247
2248 @defopt idlwave-shell-automatic-start (@code{nil})
2249 Non-@code{nil} means attempt to invoke idlwave-shell if not already
2250 running.
2251 @end defopt
2252
2253 @defopt idlwave-shell-initial-commands
2254 Initial commands, separated by newlines, to send to IDL.
2255 @end defopt
2256
2257 @defopt idlwave-shell-save-command-history (@code{t})
2258 Non-@code{nil} means preserve command history between sessions.
2259 @end defopt
2260
2261 @defopt idlwave-shell-command-history-file (@file{~/.idlwhist})
2262 The file in which the command history of the idlwave shell is saved.
2263 @end defopt
2264
2265 @defopt idlwave-shell-use-dedicated-frame (@code{nil})
2266 Non-@code{nil} means IDLWAVE should use a special frame to display
2267 shell buffer.
2268 @end defopt
2269
2270 @defopt idlwave-shell-frame-parameters
2271 The frame parameters for a dedicated idlwave-shell frame.
2272 @end defopt
2273
2274 @defopt idlwave-shell-raise-frame (@code{t})
2275 Non-@code{nil} means `idlwave-shell' raises the frame showing the shell
2276 window.
2277 @end defopt
2278
2279 @defopt idlwave-shell-temp-pro-prefix
2280 The prefix for temporary IDL files used when compiling regions.
2281 @end defopt
2282
2283 @cindex Hooks
2284 @defopt idlwave-shell-mode-hook
2285 Hook for customizing @code{idlwave-shell-mode}.
2286 @end defopt
2287
2288 @node Using the Shell, Debugging IDL Programs, Starting the Shell, The IDLWAVE Shell
2289 @section Using the Shell
2290 @cindex Comint
2291 @cindex Shell, basic commands
2292
2293 The IDLWAVE shell works in the same fashion as other shell modes in
2294 Emacs. It provides command history, command line editing and job
2295 control. The @key{UP} and @key{DOWN} arrows cycle through the input
2296 history just like in an X terminal@footnote{This is different from
2297 normal Emacs/Comint behavior, but more like an xterm. If you prefer the
2298 default comint functionality, check the variable
2299 @code{idlwave-shell-arrows-do-history}.}. The history is preserved
2300 between emacs and IDL sessions. Here is a list of commonly used
2301 commands:
2302
2303 @multitable @columnfractions .12 .88
2304 @item @key{UP}
2305 @tab Cycle backwards in input history
2306 @item @key{DOWN}
2307 @tab Cycle forwards in input history
2308 @item @kbd{M-p}
2309 @tab Cycle backwards in input history @emph{matching input}
2310 @item @kbd{M-n}
2311 @tab Cycle forwards in input history @emph{matching input}
2312 @item @kbd{M-r}
2313 @tab Previous input matching a regexp
2314 @item @kbd{M-s}
2315 @tab Next input that matches a regexp
2316 @item @kbd{return}
2317 @tab Send input or copy line to current prompt
2318 @item @kbd{C-c C-a}
2319 @tab Beginning of line; skip prompt
2320 @item @kbd{C-c C-u}
2321 @tab Kill input to beginning of line
2322 @item @kbd{C-c C-w}
2323 @tab Kill word before cursor
2324 @item @kbd{C-c C-c}
2325 @tab Send ^C
2326 @item @kbd{C-c C-z}
2327 @tab Send ^Z
2328 @item @kbd{C-c C-\}
2329 @tab Send ^\
2330 @item @kbd{C-c C-o}
2331 @tab Delete last batch of process output
2332 @item @kbd{C-c C-r}
2333 @tab Show last batch of process output
2334 @item @kbd{C-c C-l}
2335 @tab List input history
2336 @end multitable
2337
2338 In addition to these standard @file{comint} commands,
2339 @code{idlwave-shell-mode} provides many of the commands which simplify
2340 writing IDL code, including abbreviations, online help, and completion.
2341 See @ref{Routine Info} and @ref{Online Help} and @ref{Completion} for more
2342 information on these commands.
2343
2344 @cindex Completion, in the shell
2345 @cindex Routine info, in the shell
2346 @cindex Online Help, in the shell
2347 @multitable @columnfractions .12 .88
2348 @item @kbd{@key{TAB}}
2349 @tab Completion of file names (between quotes and after executive
2350 commands @samp{.run} and @samp{.compile}), routine names, class names,
2351 keywords, system variables, system variable tags etc.
2352 (@code{idlwave-shell-complete}).
2353 @item @kbd{M-@key{TAB}}
2354 @tab Same as @key{TAB}
2355 @item @kbd{C-c ?}
2356 @tab Routine Info display (@code{idlwave-routine-info})
2357 @item @kbd{M-?}
2358 @tab IDL online help on routine (@code{idlwave-routine-info-from-idlhelp})
2359 @item @kbd{C-c C-i}
2360 @tab Update routine info from buffers and shell
2361 (@code{idlwave-update-routine-info})
2362 @item @kbd{C-c C-v}
2363 @tab Find the source file of a routine (@code{idlwave-find-module})
2364 @item @kbd{C-c =}
2365 @tab Compile a library routine (@code{idlwave-resolve})
2366 @end multitable
2367
2368 @defopt idlwave-shell-arrows-do-history (@code{t})
2369 Non-@code{nil} means @key{UP} and @key{DOWN} arrows move through command
2370 history like xterm.
2371 @end defopt
2372
2373 @defopt idlwave-shell-comint-settings
2374 Alist of special settings for the comint variables in the IDLWAVE Shell.
2375 @end defopt
2376
2377 @defopt idlwave-shell-file-name-chars
2378 The characters allowed in file names, as a string. Used for file name
2379 completion.
2380 @end defopt
2381
2382 @defopt idlwave-shell-graphics-window-size
2383 Size of IDL graphics windows popped up by special IDLWAVE command.
2384 @end defopt
2385
2386 @cindex Input mode
2387 @cindex Character input mode (Shell)
2388 @cindex Line input mode (Shell)
2389 @cindex Magic spells, for input mode
2390 @cindex Spells, magic
2391 IDLWAVE works in line input mode: You compose a full command line, using
2392 all the power Emacs gives you to do this. When you press @key{RET}, the
2393 whole line is sent to IDL. Sometimes it is necessary to send single
2394 characters (without a newline), for example when an IDL program is
2395 waiting for single character input with the @code{GET_KBRD} function.
2396 You can send a single character to IDL with the command @kbd{C-c C-x}
2397 (@code{idlwave-shell-send-char}). When you press @kbd{C-c C-y}
2398 (@code{idlwave-shell-char-mode-loop}), IDLWAVE runs a blocking loop
2399 which accepts characters and immediately sends them to IDL. The loop
2400 can be exited with @kbd{C-g}. It terminates also automatically when the
2401 current IDL command is finished. Check the documentation of the two
2402 variables described below for a way to make IDL programs trigger
2403 automatic switches of the input mode.
2404
2405 @defopt idlwave-shell-use-input-mode-magic (@code{nil})
2406 Non-@code{nil} means IDLWAVE should check for input mode spells in
2407 output.
2408 @end defopt
2409
2410 @defopt idlwave-shell-input-mode-spells
2411 The three regular expressions which match the magic spells for input
2412 modes.
2413 @end defopt
2414
2415 @node Debugging IDL Programs, Examining Variables, Using the Shell, The IDLWAVE Shell
2416 @section Debugging IDL Programs
2417 @cindex Debugging
2418 @cindex Keybindings for debugging
2419 @cindex Toolbar
2420
2421 @kindex C-c C-d
2422 Programs can be compiled, run, and debugged directly from the source
2423 buffer in Emacs. The IDLWAVE shell installs key bindings both in the
2424 shell buffer and in all IDL code buffers of the current Emacs session.
2425 On Emacs versions which support this, it also installs a debugging
2426 toolbar. The display of the toolbar can be toggled with @kbd{C-c C-d
2427 C-t} (@code{idlwave-shell-toggle-toolbar}).
2428
2429 The debugging key bindings are by default on the prefix key @kbd{C-c
2430 C-d}, so for example setting a breakpoint is done with @kbd{C-c C-d
2431 C-b}, compiling a source file with @kbd{C-c C-d C-c}. If you find this
2432 too much work, you can add bindings for one or more modifier keys which
2433 is not used by other commands. For example, if you write in
2434 @file{.emacs}:
2435
2436 @lisp
2437 (setq idlwave-shell-debug-modifiers '(control shift))
2438 @end lisp
2439
2440 @noindent a breakpoint can be set by pressing @kbd{b} while holding down
2441 @kbd{shift} and @kbd{control} keys, i.e. @kbd{C-S-b}. Compiling a
2442 source file will be on @kbd{C-S-c}, deleting a breakpoint @kbd{C-S-d},
2443 etc. In the remainder of this chapter we will assume that the @kbd{C-c
2444 C-d} bindings are active, but each of these bindings will have an
2445 equivalent single-keypress shortcut if modifiers are given in the
2446 @code{idlwave-shell-debug-modifiers} variable (see @pxref{Lesson II --
2447 Customization}).
2448
2449 @defopt idlwave-shell-prefix-key (@kbd{C-c C-d})
2450 The prefix key for the debugging map
2451 @code{idlwave-shell-mode-prefix-map}.
2452 @end defopt
2453
2454 @defopt idlwave-shell-activate-prefix-keybindings (@code{t})
2455 Non-@code{nil} means debug commands will be bound to the prefix
2456 key, like @kbd{C-c C-d C-b}.
2457 @end defopt
2458
2459 @defopt idlwave-shell-debug-modifiers (@code{nil})
2460 List of modifier keys to use for additional binding of debugging
2461 commands in the shell and source buffers.
2462 @end defopt
2463
2464 @defopt idlwave-shell-use-toolbar (@code{t})
2465 Non-@code{nil} means use the debugging toolbar in all IDL related
2466 buffers.
2467 @end defopt
2468
2469
2470 @menu
2471 * Compiling Programs:: Compiling buffers under the shell
2472 * Breakpoints and Stepping:: Deciding where to stop and look
2473 * Walking the Calling Stack:: From where was this routine called?
2474 @end menu
2475
2476 @node Compiling Programs, Breakpoints and Stepping, Debugging IDL Programs, Debugging IDL Programs
2477 @subsection Compiling Programs
2478 @cindex Compiling programs
2479 @cindex Programs, compiling
2480 @cindex Default command line, executing
2481 @cindex Executing a default command line
2482
2483 @kindex C-c C-d C-c
2484 In order to compile the current buffer under the IDLWAVE shell, press
2485 @kbd{C-c C-d C-c} (@code{idlwave-save-and-run}). This first saves the
2486 current buffer and then sends the command @samp{.run path/to/file} to the
2487 shell. You can also execute @kbd{C-c C-d C-c} from the shell buffer, in
2488 which case the most recently compiled buffer will be saved and
2489 re-compiled.
2490
2491 When developing or debugging a program, it is often necessary to execute
2492 the same command line many times. A convenient way to do this is
2493 @kbd{C-c C-d C-y} (@code{idlwave-shell-execute-default-command-line}).
2494 This command first resets IDL from a state of interrupted execution by
2495 closing all files and returning to the main interpreter level. Then a
2496 default command line is send to the shell. To edit the default command
2497 line, call @code{idlwave-shell-execute-default-command-line} with a
2498 prefix argument: @kbd{C-u C-c C-d C-y}.
2499
2500 @defopt idlwave-shell-mark-stop-line (@code{t})
2501 Non-@code{nil} means mark the source code line where IDL is currently
2502 stopped. The value specifies the preferred method. Legal values are
2503 @code{nil}, @code{t}, @code{arrow}, and @code{face}.
2504 @end defopt
2505
2506 @defopt idlwave-shell-overlay-arrow (@code{">"})
2507 The overlay arrow to display at source lines where execution halts, if
2508 configured in @code{idlwave-shell-mark-stop-line}.
2509 @end defopt
2510
2511 @defopt idlwave-shell-stop-line-face
2512 The face which highlights the source line where IDL is stopped, if
2513 configured in @code{idlwave-shell-mark-stop-line}.
2514 @end defopt
2515
2516 @node Breakpoints and Stepping, Walking the Calling Stack, Compiling Programs, Debugging IDL Programs
2517 @subsection Breakpoints and Stepping
2518 @cindex Breakpoints
2519 @cindex Stepping
2520 @cindex Execution, controlled
2521
2522 @kindex C-c C-d C-b
2523 @kindex C-c C-d C-b
2524 You can set breakpoints and step through a program with IDLWAVE.
2525 Setting a breakpoint in the current line of the source buffer is done
2526 with @kbd{C-c C-d C-b} (@code{idlwave-shell-break-here}). With a prefix
2527 arg of 1 (i.e. @kbd{C-1 C-c C-d C-b}, the breakpoint gets a @code{/ONCE}
2528 keyword, meaning that it will be deleted after first use. With a
2529 numeric prefix greater than one, the breakpoint will only be active the
2530 @code{nth} time it is hit. To clear the breakpoint in the current line,
2531 use @kbd{C-c C-d C-d} (@code{idlwave-clear-current-bp}). When executed
2532 from the shell window, the breakpoint where IDL is currently stopped
2533 will be deleted. To clear all breakpoints, use @kbd{C-c C-d C-a}
2534 (@code{idlwave-clear-all-bp}). Breakpoint lines are highlighted in the
2535 source code.
2536
2537 Once the program has stopped somewhere, you can step through it. The
2538 most important stepping commands are @kbd{C-c C-d C-s} to execute one
2539 line of IDL code ("step into"); @kbd{C-c C-d C-n} to step a single line,
2540 treating procedure and function calls as a single step ("step over");
2541 @kbd{C-c C-d C-h} to continue execution to the line at the cursor and
2542 @kbd{C-c C-d C-r} to continue execution. Here is a summary of the
2543 breakpoint and stepping commands:
2544
2545 @multitable @columnfractions .23 .77
2546 @item @kbd{C-c C-d C-b}
2547 @tab Set breakpoint (@code{idlwave-shell-break-here})
2548 @item @kbd{C-c C-d C-i}
2549 @tab Set breakpoint in function named here (@code{idlwave-shell-break-in})
2550 @item @kbd{C-c C-d C-d}
2551 @tab Clear current breakpoint (@code{idlwave-shell-clear-current-bp})
2552 @item @kbd{C-c C-d C-a}
2553 @tab Clear all breakpoints (@code{idlwave-shell-clear-all-bp})
2554 @item @kbd{C-c C-d C-s}
2555 @tab Step, into function calls (@code{idlwave-shell-step})
2556 @item @kbd{C-c C-d C-n}
2557 @tab Step, over function calls (@code{idlwave-shell-stepover})
2558 @item @kbd{C-c C-d C-k}
2559 @tab Skip one statement (@code{idlwave-shell-skip})
2560 @item @kbd{C-c C-d C-u}
2561 @tab Continue to end of block (@code{idlwave-shell-up})
2562 @item @kbd{C-c C-d C-m}
2563 @tab Continue to end of function (@code{idlwave-shell-return})
2564 @item @kbd{C-c C-d C-o}
2565 @tab Continue past end of function (@code{idlwave-shell-out})
2566 @item @kbd{C-c C-d C-h}
2567 @tab Continue to line at cursor position (@code{idlwave-shell-to-here})
2568 @item @kbd{C-c C-d C-r}
2569 @tab Continue execution to next breakpoint (@code{idlwave-shell-cont})
2570 @item @kbd{C-c C-d C-up}
2571 @tab Show higher level in calling stack (@code{idlwave-shell-stack-up})
2572 @item @kbd{C-c C-d C-down}
2573 @tab Show lower level in calling stack (@code{idlwave-shell-stack-down})
2574 @end multitable
2575
2576 @defopt idlwave-shell-mark-breakpoints (@code{t})
2577 Non-@code{nil} means mark breakpoints in the source file buffers. The
2578 value indicates the preferred method. Legal values are @code{nil},
2579 @code{t}, @code{face}, and @code{glyph}.
2580 @end defopt
2581
2582 @defopt idlwave-shell-breakpoint-face
2583 The face for breakpoint lines in the source code if
2584 @code{idlwave-shell-mark-breakpoints} has the value @code{face}.
2585 @end defopt
2586
2587 @node Walking the Calling Stack, , Breakpoints and Stepping, Debugging IDL Programs
2588 @subsection Walking the Calling Stack
2589 @cindex Calling stack, walking
2590
2591 While debugging a program, it can be very useful to check the context in
2592 which the current routine was called, for instance to help understand
2593 the value of the arguments passed. To do so conveniently you need to
2594 examine the calling stack. If execution is stopped somewhere deep in a
2595 program, you can use the commands @kbd{C-c C-d C-@key{UP}}
2596 (@code{idlwave-shell-stack-up}) and @kbd{C-c C-d C-@key{DOWN}}
2597 (@code{idlwave-shell-stack-down}), or the corresponding toolbar buttons,
2598 to move up or down through the calling stack. The mode line of the
2599 shell window will indicate the position within the stack with a label
2600 like @samp{[-3:MYPRO]}. The line of IDL code at that stack position
2601 will be highlighted. If you continue execution, IDLWAVE will
2602 automatically return to the current level. @xref{Examining Variables},
2603 for information how to examine the value of variables and expressions on
2604 higher calling stack levels.
2605
2606 @node Examining Variables, Custom Expression Examination, Debugging IDL Programs, The IDLWAVE Shell
2607 @section Examining Variables
2608 @cindex @code{PRINT} expressions
2609 @cindex @code{HELP}, on expressions
2610 @cindex Expressions, printing
2611 @cindex Expressions, help
2612 @cindex Printing expressions
2613 @cindex Mouse binding to print expressions
2614
2615 @kindex C-c C-d C-p
2616 Do you find yourself repeatedly typing, e.g. @code{print,n_elements(x)},
2617 and similar statements to remind yourself of the
2618 type/size/structure/value/etc. of variables and expressions in your code
2619 or at the command line? IDLWAVE has a suite of special commands to
2620 automate these types of variables or expression examinations. They work
2621 by sending statements to the shell formatted to include the indicated
2622 expression.
2623
2624 These examination commands can be used in the shell or buffer at any
2625 time (as long as the shell is running), and are very useful when
2626 execution is stopped in a buffer due to a triggered breakpoint or error,
2627 or while composing a long command in the IDLWAVE shell. In the latter
2628 case, the command is sent to the shell and its output is visible, but
2629 point remains unmoved in the command being composed --- you can inspect
2630 the contituents of a command you're building without interrupting the
2631 process of building it! You can even print arbitrary expressions from
2632 older input or output further up in the shell window --- any expression,
2633 variable, number, or function you see can be examined.
2634
2635 If the variable @code{idlwave-shell-separate-examine-output} is
2636 non-@code{nil} (the default), all examine output will be sent to a
2637 special @file{*Examine*} buffer, rather than the shell. The output of
2638 prior examine commands is saved. In this buffer @key{c} clears the
2639 contents, and @key{q} hides the buffer.
2640
2641 The two most basic examine commands are bound to @kbd{C-c C-d C-p}, to
2642 print the expression at point, and @kbd{C-c C-d ?}, to invoke help on
2643 this expression. The expression at point is either an array expression
2644 or a function call, or the contents of a pair of parentheses. The
2645 selected expression is highlighted, and simultaneously the resulting
2646 output is highlighted in the shell. Calling the above commands with a
2647 prefix argument will prompt for an expression instead of using the one
2648 at point. Two prefix arguments (@kbd{C-u C-u C-c C-d C-p}) will use the
2649 current region as expression.
2650
2651 For added speed and convenience, there are mouse bindings which allow
2652 you to click on expressions and examine their values. Use
2653 @kbd{S-Mouse-2} to print an expression and @kbd{C-M-Mouse-2} to invoke
2654 help (i.e. you need to hold down @key{META} and @key{CONTROL} while
2655 clicking with the middle mouse button). If you simply click, the
2656 nearest expression will be selected in the same manner as described
2657 above. You can also @emph{drag} the mouse in order to highlight exactly
2658 a specific expression or sub-expression to be examined. For custom
2659 expression examination, and the customizable pop-up examine selection,
2660 @xref{Custom Expression Examination}.
2661
2662 @cindex Printing expressions, on calling stack
2663 @cindex Restrictions for expression printing
2664 The same variable inspection commands work both in the IDL Shell and
2665 IDLWAVE buffers, and even for variables at higher levels of the calling
2666 stack. For instance, if you're stopped at a breakpoint in a routine,
2667 you can examine the values of variables and expressions inside its
2668 calling routine, and so on, all the way up through the calling stack.
2669 Simply step up the stack, and print variables as you see them
2670 (@pxref{Walking the Calling Stack}, for information on stepping back
2671 through the calling stack). The following restrictions apply for all
2672 levels except the current:
2673
2674 @itemize @bullet
2675 @item
2676 Array expressions must use the @samp{[ ]} index delimiters. Identifiers
2677 with a @samp{( )} will be interpreted as function calls.
2678 @item
2679 @cindex ROUTINE_NAMES, IDL procedure
2680 N.B.: printing values of expressions on higher levels of the calling
2681 stack uses the @emph{unsupported} IDL routine @code{ROUTINE_NAMES},
2682 which may or may not be available in future versions of IDL.
2683 @end itemize
2684
2685 @defopt idlwave-shell-expression-face
2686 The face for @code{idlwave-shell-expression-overlay}.
2687 Allows you to choose the font, color and other properties for
2688 the expression printed by IDL.
2689 @end defopt
2690
2691 @defopt idlwave-shell-output-face
2692 The face for @code{idlwave-shell-output-overlay}.
2693 Allows to choose the font, color and other properties for the most
2694 recent output of IDL when examining an expression."
2695 @end defopt
2696
2697 @defopt idlwave-shell-separate-examine-output (@code{t})
2698 If non-@code{nil}, re-direct the output of examine commands to a special
2699 @file{*Examine*} buffer, instead of in the shell itself.
2700 @end defopt
2701
2702 @node Custom Expression Examination, , Examining Variables, The IDLWAVE Shell
2703 @section Custom Expression Examination
2704 @cindex Expressions, custom examination
2705 @cindex Custom expression examination
2706
2707 The variety of possible variable and expression examination commands is
2708 endless (just look, for instance, at the keyword list to
2709 @code{widget_info()}). Rather than attempt to include them all, IDLWAVE
2710 provides two easy methods to customize your own commands, with a special
2711 mouse examine command, and two macros for generating your own examine
2712 bindings.
2713
2714 The most powerful and flexible mouse examine command is available on
2715 @kbd{C-S-Mouse-2}. Just as for all the other mouse examine commands, it
2716 permits click or drag expression selection, but instead of sending
2717 hard-coded commands to the shell, it pops-up a customizable selection
2718 list of examine functions to choose among, configured with the
2719 @code{idlwave-shell-examine-alist} variable. This variable is a list of
2720 key-value pairs (an @emph{alist} in Emacs parlance), where the keys name
2721 the command, and the values are the command strings, in which the text
2722 @code{___} (three underscores) will be replaced by the selected
2723 expression before being sent to the shell. An example might be key
2724 @code{Structure Help} with value @code{help,___,/STRUCTURE}.
2725 @code{idlwave-shell-examine-alist} comes by default with a large list of
2726 examine commands, but can be easily customized to add more.
2727
2728 In addition to the pop-up mouse command, you can easily create your own
2729 customized bindings to inspect expressions using the two convenience
2730 macros @code{idlwave-shell-inspect} and
2731 @code{idlwave-shell-mouse-inspect}. These create keyboard or
2732 mouse-based custom inspections of variables, sharing all the same
2733 properties of the built-in examine commands. Both functions take a
2734 single string argument sharing the syntax of the
2735 @code{idlwave-shell-examine-alist} values, e.g.:
2736
2737 @lisp
2738 (add-hook 'idlwave-shell-mode-hook
2739 (lambda ()
2740 (idlwave-shell-define-key-both [s-down-mouse-2]
2741 (idlwave-shell-mouse-examine
2742 "print, size(___,/DIMENSIONS)"))
2743 (idlwave-shell-define-key-both [f9] (idlwave-shell-examine
2744 "print, size(___,/DIMENSIONS)"))
2745 (idlwave-shell-define-key-both [f10] (idlwave-shell-examine
2746 "print,size(___,/TNAME)"))
2747 (idlwave-shell-define-key-both [f11] (idlwave-shell-examine
2748 "help,___,/STRUCTURE"))))
2749 @end lisp
2750
2751 @noindent Now pressing @key{f9}, or middle-mouse dragging with the
2752 @key{SUPER} key depressed, will print the dimensions of the nearby or
2753 highlighted expression. Pressing @key{f10} will give the type string,
2754 and @key{f11} will show the contents of a nearby structure. As you can
2755 see, the possibilities are only marginally finite.
2756
2757 @defopt idlwave-shell-examine-alist
2758 An alist of examine commands in which the keys name the command and are
2759 displayed in the selection pop-up, and the values are custom IDL examine
2760 command strings to send, after all instances of @code{___} are replaced
2761 by the indicated expression.
2762 @end defopt
2763
2764
2765 @node Installation, Acknowledgements, The IDLWAVE Shell, Top
2766 @chapter Installation
2767 @cindex Installation
2768
2769 @menu
2770 * Installing IDLWAVE:: How to install the distribution
2771 * Installing Online Help:: Where to get the additional files needed
2772 * Upgrading from idl.el:: Necessary configuration changes
2773 @end menu
2774
2775 @node Installing IDLWAVE, Installing Online Help, Installation, Installation
2776 @section Installing IDLWAVE
2777
2778 @cindex FTP site
2779 @cindex URL, homepage for IDLWAVE
2780 @cindex Homepage for IDLWAVE
2781 @cindex IDLWAVE, homepage
2782 @cindex XEmacs package IDLWAVE
2783 @cindex Emacs, distributed with IDLWAVE
2784 @cindex Copyright, of IDL manual
2785 IDLWAVE is part of Emacs 21.1 and later. It is also an XEmacs package
2786 and can be installed from
2787 @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,the XEmacs ftp site}
2788 with the normal package management system on XEmacs 21. These
2789 pre-installed versions should work out-of-the-box. However, the files
2790 required for online help are not distributed with XEmacs/Emacs and have
2791 to be installed separately@footnote{Due to copyright reasons, the ASCII
2792 version of the IDL manual cannot be distributed under the GPL.}
2793 (@pxref{Installing Online Help}).
2794
2795 You can also download IDLWAVE and install it yourself from
2796 @uref{@value{IDLWAVE-HOMEPAGE}, the maintainers webpage}. Follow the
2797 instructions in the INSTALL file.
2798
2799 @node Installing Online Help, Upgrading from idl.el, Installing IDLWAVE, Installation
2800 @section Installing Online Help
2801 @cindex Installing online help
2802 @cindex Online Help, Installation
2803
2804 If you want to use the online help display, two additional files (an
2805 ASCII version of the IDL documentation and a topics/code file) must be
2806 installed. These files can also be downloaded from
2807 @uref{@value{IDLWAVE-HOMEPAGE}, the maintainers webpage}. You need to
2808 place the files somewhere on your system and tell IDLWAVE where they are
2809 with
2810
2811 @lisp
2812 (setq idlwave-help-directory "/path/to/help/files/")
2813 @end lisp
2814
2815 @node Upgrading from idl.el, , Installing Online Help, Installation
2816 @section Upgrading from the old @b{@file{idl.el}} file
2817 @cindex Upgrading from old @b{@file{idl.el}}
2818 @cindex Renaming old variables
2819 @cindex Old variables, renaming
2820 @kindex M-@key{TAB}
2821
2822 If you have been using the old @file{idl.el} and @file{idl-shell.el}
2823 files and would like to use IDLWAVE, you need to update your
2824 customization in @file{.emacs}.
2825
2826 @enumerate
2827 @item
2828 Change all variable and function prefixes from @samp{idl-} to @samp{idlwave-}.
2829 @item
2830 Remove the now invalid @code{autoload} and @code{auto-mode-alist} forms
2831 pointing to the @file{idl.el} and @file{idl-shell.el} files. Install
2832 the new autoload forms.
2833 @item
2834 If you have been using the hook function recommended in earlier versions
2835 to get a separate frame for the IDL shell, remove that command from your
2836 @code{idlwave-shell-mode-hook}. Instead, set the variable
2837 @code{idlwave-shell-use-dedicated-frame} with
2838 @lisp
2839 (setq idlwave-shell-use-dedicated-frame t)
2840 @end lisp
2841 @item
2842 The key sequence @kbd{M-@key{TAB}} no longer inserts a TAB character.
2843 Like in many other Emacs modes, @kbd{M-@key{TAB}} now does
2844 completion. Inserting a TAB has therefore been moved to
2845 @kbd{C-@key{TAB}}. On a character based terminal you can also use
2846 @kbd{C-c @key{SPC}}.
2847 @end enumerate
2848
2849 @node Acknowledgements, Sources of Routine Info, Installation, Top
2850 @chapter Acknowledgements
2851 @cindex Acknowledgements
2852 @cindex Maintainer, of IDLWAVE
2853 @cindex Authors, of IDLWAVE
2854 @cindex Contributors, to IDLWAVE
2855 @cindex Email address, of Maintainer
2856 @cindex Thanks
2857
2858 @noindent
2859 The main contributors to the IDLWAVE package have been:
2860
2861 @itemize @minus
2862 @item
2863 @uref{mailto:chase@@att.com, @b{Chris Chase}}, the original author.
2864 Chris wrote @file{idl.el} and @file{idl-shell.el} and maintained them
2865 for several years.
2866
2867 @item
2868 @uref{mailto:dominik@@astro.uva.nl, @b{Carsten Dominik}} was in charge
2869 of the package from version 3.0, during which time he overhauled almost
2870 everything, modernized IDLWAVE with many new features, and developed the
2871 manual.
2872
2873 @item
2874 @uref{mailto:jdsmith@@as.arizona.edu, @b{J.D. Smith}}, the current
2875 maintainer, as of version 4.10, helped shape object method completion
2876 and most new features introduced in versions 4.x.
2877 @end itemize
2878
2879 @noindent
2880 The following people have also contributed to the development of IDLWAVE
2881 with patches, ideas, bug reports and suggestions.
2882
2883 @itemize @minus
2884 @item
2885 Ulrik Dickow <dickow@@nbi.dk>
2886 @item
2887 Eric E. Dors <edors@@lanl.gov>
2888 @item
2889 Stein Vidar H. Haugan <s.v.h.haugan@@astro.uio.no>
2890 @item
2891 David Huenemoerder <dph@@space.mit.edu>
2892 @item
2893 Kevin Ivory <Kevin.Ivory@@linmpi.mpg.de>
2894 @item
2895 Dick Jackson <dick@@d-jackson.com>
2896 @item
2897 Xuyong Liu <liu@@stsci.edu>
2898 @item
2899 Simon Marshall <Simon.Marshall@@esrin.esa.it>
2900 @item
2901 Craig Markwardt <craigm@@cow.physics.wisc.edu>
2902 @item
2903 Laurent Mugnier <mugnier@@onera.fr>
2904 @item
2905 Lubos Pochman <lubos@@rsinc.com>
2906 @item
2907 Patrick M. Ryan <pat@@jaameri.gsfc.nasa.gov>
2908 @item
2909 Marty Ryba <ryba@@ll.mit.edu>
2910 @item
2911 Phil Williams <williams@@irc.chmcc.org>
2912 @item
2913 Phil Sterne <sterne@@dublin.llnl.gov>
2914 @end itemize
2915
2916 @noindent
2917 Thanks to everyone!
2918
2919 @node Sources of Routine Info, Configuration Examples, Acknowledgements, Top
2920 @appendix Sources of Routine Info
2921
2922 @cindex Sources of routine information
2923 In @ref{Routine Info} and @ref{Completion} we showed how IDLWAVE
2924 displays the calling sequence and keywords of routines, and completes
2925 routine names and keywords. For these features to work, IDLWAVE must
2926 know about the accessible routines.
2927
2928 @menu
2929 * Routine Definitions:: Where IDL Routines are defined.
2930 * Routine Information Sources:: So how does IDLWAVE know about...
2931 * Library Catalog:: Scanning the Libraries for Routine Info
2932 * Load-Path Shadows:: Routines defined in several places
2933 * Documentation Scan:: Scanning the IDL Manuals
2934 @end menu
2935
2936 @node Routine Definitions, Routine Information Sources, Sources of Routine Info, Sources of Routine Info
2937 @appendixsec Routine Definitions
2938 @cindex Routine definitions
2939 @cindex IDL variable @code{!PATH}
2940 @cindex @code{!PATH}, IDL variable
2941 @cindex @code{CALL_EXTERNAL}, IDL routine
2942 @cindex @code{LINKIMAGE}, IDL routine
2943 @cindex External routines
2944
2945 @noindent Routines which can be used in an IDL program can be defined in
2946 several places:
2947
2948 @enumerate
2949 @item
2950 @emph{Builtin routines} are defined inside IDL itself. The source
2951 code of such routines is not available.
2952 @item
2953 Routines which are @emph{part of the current program}, defined in a
2954 file which is explicitly compiled by the user. This file may or may not
2955 be located on the IDL search path.
2956 @item
2957 @emph{Library routines} are defined in files located on IDL's search
2958 path, and will need not be manually compiled. When a library routine is
2959 called for the first time, IDL will find the source file and compile it
2960 dynamically. A special sub-category of library routines are the
2961 @emph{system routines} distributed with IDL, and usually available in
2962 the @file{lib} subdirectory of the IDL distribution.
2963 @item
2964 External routines written in other languages (like Fortran or C) can be
2965 called with @code{CALL_EXTERNAL}, linked into IDL via @code{LINKIMAGE},
2966 or included as dynamically loaded modules (DLMs). Currently IDLWAVE
2967 cannot provide routine info and completion for such external routines.
2968 @end enumerate
2969
2970 @node Routine Information Sources, Library Catalog, Routine Definitions, Sources of Routine Info
2971 @appendixsec Routine Information Sources
2972 @cindex Routine info sources
2973 @cindex Builtin list of routines
2974 @cindex Updating routine info
2975 @cindex Scanning buffers for routine info
2976 @cindex Buffers, scanning for routine info
2977 @cindex Shell, querying for routine info
2978
2979 @noindent To maintain the most comprehensive information about all IDL
2980 routines on a system, IDLWAVE collects data from many sources:
2981
2982 @enumerate
2983
2984 @item
2985 It has a @emph{builtin list} with the properties of the builtin IDL
2986 routines. IDLWAVE @value{VERSION} is distributed with a list of
2987 @value{NSYSROUTINES} routines and @value{NSYSKEYWORDS} keywords,
2988 reflecting IDL version @value{IDLVERSION}. This list has been created
2989 by scanning the IDL manuals and is stored in the file
2990 @file{idlw-rinfo.el}. @xref{Documentation Scan}, for information on how
2991 to regenerate this file for new versions of IDL.
2992
2993 @item
2994 It @emph{scans} all @emph{buffers} of the current Emacs session for
2995 routine definitions. This is done automatically when routine
2996 information or completion is first requested by the user. Each new
2997 buffer and each buffer which is saved after making changes is also
2998 scanned. The command @kbd{C-c C-i} (@code{idlwave-update-routine-info})
2999 can be used at any time to rescan all buffers.
3000
3001 @item
3002 If you have an IDLWAVE-Shell running in the Emacs session, IDLWAVE will
3003 @emph{query the shell} for compiled routines and their arguments. This
3004 happens automatically when routine information or completion is first
3005 requested by the user, and each time an Emacs buffer is compiled with
3006 @kbd{C-c C-d C-c}. Though rarely necessary, the command @kbd{C-c C-i}
3007 (@code{idlwave-update-routine-info}) can be used to update the shell
3008 routine data.
3009
3010 @item
3011 IDLWAVE can scan all or selected library source files and store the
3012 result in a file which will be automatically loaded just like
3013 @file{idlw-rinfo.el}. @xref{Library Catalog}, for information how to
3014 scan library files.
3015 @end enumerate
3016
3017 Loading routine and catalog information is a time consuming process.
3018 Depending on the system and network configuration it can take up to 30
3019 seconds. In order to minimize the waiting time upon your first
3020 completion or routine info command in a session, IDLWAVE uses Emacs idle
3021 time to do the initialization in 5 steps, yielding to user input in
3022 between. If this gets into your way, set the variable
3023 @code{idlwave-init-rinfo-when-idle-after} to 0 (zero).
3024
3025 @defopt idlwave-init-rinfo-when-idle-after (@code{10})
3026 Seconds of idle time before routine info is automatically initialized.
3027 @end defopt
3028
3029 @defopt idlwave-scan-all-buffers-for-routine-info (@code{t})
3030 Non-@code{nil} means scan all buffers for IDL programs when updating
3031 info.
3032 @end defopt
3033
3034 @defopt idlwave-query-shell-for-routine-info (@code{t})
3035 Non-@code{nil} means query the shell for info about compiled routines.
3036 @end defopt
3037
3038 @defopt idlwave-auto-routine-info-updates
3039 Controls under what circumstances routine info is updated automatically.
3040 @end defopt
3041
3042 @node Library Catalog, Load-Path Shadows, Routine Information Sources, Sources of Routine Info
3043 @appendixsec Library Catalog
3044 @cindex Library scan
3045 @cindex Library catalog
3046 @cindex IDL library routine info
3047 @cindex Windows
3048 @cindex MacOS
3049 @cindex IDL variable @code{!DIR}
3050 @cindex @code{!DIR}, IDL variable
3051
3052
3053 IDLWAVE can extract routine information from library modules and store
3054 that information in a file. To do this, the variable
3055 @code{idlwave-libinfo-file} needs to contain the path to a file in an
3056 existing directory (the default is @code{"~/.idlcat.el"}). Since the
3057 file will contain lisp code, its name should end in @file{.el}. Under
3058 Windows and MacOS, you also need to specify the search path for IDL
3059 library files in the variable @code{idlwave-library-path}, and the
3060 location of the IDL directory (the value of the @code{!DIR} system
3061 variable) in the variable @code{idlwave-system-directory}, like
3062 this@footnote{The initial @samp{+} leads to recursive expansion of the
3063 path, just like in IDL}:
3064
3065 @lisp
3066 (setq idlwave-library-path
3067 '("+c:/RSI/IDL54/lib/" "+c:/user/me/idllibs" ))
3068 (setq idlwave-system-directory "c:/RSI/IDL54/")
3069 @end lisp
3070
3071 @noindent Under GNU and UNIX, these values will be automatically inferred from
3072 an IDLWAVE shell.
3073
3074 The command @kbd{M-x idlwave-create-libinfo-file} can then be used to
3075 scan library files. It brings up a widget in which you can select some
3076 or all directories on the search path. If you only want to have routine
3077 and completion info of some libraries, it is sufficient to scan those
3078 directories. However, if you want IDLWAVE to detect possible name
3079 conflicts with routines defined in other libraries, the whole pass
3080 should be scanned.
3081
3082 After selecting directories, click on the @w{@samp{[Scan & Save]}}
3083 button in the widget to scan all files in the selected directories and
3084 write the resulting routine information into the file
3085 @code{idlwave-libinfo-file}. In order to update the library information
3086 from the same directories, call the command
3087 @code{idlwave-update-routine-info} with a double prefix argument:
3088 @w{@kbd{C-u C-u C-c C-i}}. This will rescan files in the previously
3089 selected directories, write an updated version of the libinfo file and
3090 rebuild IDLWAVE's internal lists. If you give three prefix arguments
3091 @w{@kbd{C-u C-u C-u C-c C-i}}, updating will be done with a background
3092 job@footnote{GNU and Unix systems only, I think.}. You can continue to work,
3093 and the library catalog will be re-read when it is ready.
3094
3095 A note of caution: Depending on your local installation, the IDL
3096 library can be very large. Parsing it for routine information will take
3097 time and loading this information into Emacs can require a
3098 significant amount of memory. However, having this information
3099 available will be a great help.
3100
3101 @defopt idlwave-libinfo-file
3102 File for routine information of the IDL library.
3103 @end defopt
3104
3105 @defopt idlwave-library-path
3106 IDL library path for Windows and MacOS. Not needed under GNU and Unix.
3107 @end defopt
3108
3109 @defopt idlwave-system-directory
3110 The IDL system directory for Windows and MacOS. Not needed under GNU and Unix.
3111 @end defopt
3112
3113 @defopt idlwave-special-lib-alist
3114 Alist of regular expressions matching special library directories.
3115 @end defopt
3116
3117 @node Load-Path Shadows, Documentation Scan, Library Catalog, Sources of Routine Info
3118 @appendixsec Load-Path Shadows
3119 @cindex Load-path shadows
3120 @cindex Shadows, load-path
3121 @cindex Duplicate routines
3122 @cindex Multiply defined routines
3123 @cindex Routine definitions, multiple
3124 @cindex Application, testing for shadowing
3125 @cindex Buffer, testing for shadowing
3126
3127 IDLWAVE can compile a list of routines which are defined in several
3128 different files. Since one definition will hide (shadow) the others
3129 depending on which file is compiled first, such multiple definitions are
3130 called "load-path shadows". IDLWAVE has several routines to scan for
3131 load path shadows. The output is placed into the special buffer
3132 @file{*Shadows*}. The format of the output is identical to the source
3133 section of the routine info buffer (@pxref{Routine Info}). The
3134 different definitions of a routine are listed in the sequence of
3135 @emph{likelihood of use}. So the first entry will be most likely the
3136 one you'll get if an unsuspecting command uses that routine. Before
3137 listing shadows, you should make sure that routine info is up-to-date by
3138 pressing @kbd{C-c C-i}. Here are the different routines:
3139
3140 @table @asis
3141 @item @kbd{M-x idlwave-list-buffer-load-path-shadows}
3142 This commands checks the names of all routines defined in the current
3143 buffer for shadowing conflicts with other routines accessible to
3144 IDLWAVE. The command also has a key binding: @kbd{C-c C-b}
3145 @item @kbd{M-x idlwave-list-shell-load-path-shadows}.
3146 Checks all routines compiled under the shell for shadowing. This is
3147 very useful when you have written a complete application. Just compile
3148 the application, use @code{RESOLVE_ALL} to compile any routines used by
3149 your code, update the routine info inside IDLWAVE with @kbd{C-c C-i} and
3150 then check for shadowing.
3151 @item @kbd{M-x idlwave-list-all-load-path-shadows}
3152 This command checks all routines accessible to IDLWAVE for conflicts.
3153 @end table
3154
3155 For these commands to work properly you should have scanned the entire
3156 load path, not just selected directories. Also, IDLWAVE should be able
3157 to distinguish between the system library files (normally installed in
3158 @file{/usr/local/rsi/idl/lib}) and any site specific or user specific
3159 files. Therefore, such local files should not be installed inside the
3160 @file{lib} directory of the IDL directory. This is also advisable for
3161 many other reasons.
3162
3163 @cindex Windows
3164 @cindex MacOS
3165 @cindex IDL variable @code{!DIR}
3166 @cindex @code{!DIR}, IDL variable
3167 Users of Windows and MacOS also must set the variable
3168 @code{idlwave-system-directory} to the value of the @code{!DIR} system
3169 variable in IDL. IDLWAVE appends @file{lib} to the value of this
3170 variable and assumes that all files found on that path are system
3171 routines.
3172
3173 Another way to find out if a specific routine has multiple definitions
3174 on the load path is routine info display (@pxref{Routine Info}).
3175
3176 @node Documentation Scan, , Load-Path Shadows, Sources of Routine Info
3177 @appendixsec Documentation Scan
3178 @cindex @file{get_rinfo}
3179 @cindex @file{idlw-rinfo.el}
3180 @cindex @file{idlw-help.txt}
3181 @cindex @file{idlw-help.el}
3182 @cindex Scanning the documentation
3183 @cindex Perl program, to create @file{idlw-rinfo.el}
3184
3185 IDLWAVE derives it knowledge about system routines from the IDL
3186 manuals. The file @file{idlw-rinfo.el} contains the routine information
3187 for the IDL system routines. The Online Help feature of IDLWAVE
3188 requires ASCII versions of some IDL manuals to be available in a
3189 specific format (@file{idlw-help.txt}), along with an Emacs-Lisp file
3190 @file{idlw-help.el} with supporting code and pointers to the ASCII file.
3191
3192 All 3 files can be derived from the IDL documentation. If you are
3193 lucky, the maintainer of IDLWAVE will always have access to the newest
3194 version of IDL and provide updates. The IDLWAVE distribution also
3195 contains the Perl program @file{get_rinfo} which constructs these files
3196 by scanning selected files from the IDL documentation. Instructions on
3197 how to use @file{get_rinfo} are in the program itself.
3198
3199 One particularly frustrating situation occurs when a new IDL version is
3200 released without the associated documentation updates. Instead, a
3201 @emph{What's New} file containing new and updated documentation is
3202 shipped alongside the previous version's reference material. The
3203 @file{get_rinfo} script can merge this new information into the standard
3204 help text and routine information, as long as it is pre-formatted in a
3205 simple way. See @file{get_rinfo} for more information.
3206
3207 @node Configuration Examples, Windows and MacOS, Sources of Routine Info, Top
3208 @appendix Configuration Examples
3209 @cindex Configuration examples
3210 @cindex Example configuration
3211 @cindex @file{.emacs}
3212 @cindex Default settings, of options
3213 @cindex Interview, with the maintainer
3214
3215 @noindent
3216 @b{Question:} You have all these complicated configuration options in
3217 your package, but which ones do @emph{you} as the maintainer actually
3218 set in your own configuration?
3219
3220 @noindent
3221 @b{Answer:} Not many, beyond custom key bindings. I set most defaults
3222 the way that seems best. However, the default settings do not turn on
3223 features which:
3224
3225 @itemize @minus
3226 @item
3227 are not self-evident (i.e. too magic) when used by an unsuspecting user.
3228 @item
3229 are too intrusive.
3230 @item
3231 will not work properly on all Emacs installations.
3232 @item
3233 break with widely used standards.
3234 @item
3235 use function or other non-standard keys.
3236 @item
3237 are purely personal customizations, like additional key bindings, and
3238 library names.
3239 @end itemize
3240
3241 @noindent To see what I mean, here is the @emph{entire} configuration
3242 the old maintainer had in his @file{.emacs}:
3243
3244 @lisp
3245 (setq idlwave-shell-debug-modifiers '(control shift)
3246 idlwave-store-inquired-class t
3247 idlwave-shell-automatic-start t
3248 idlwave-main-block-indent 2
3249 idlwave-init-rinfo-when-idle-after 2
3250 idlwave-help-dir "~/lib/emacs/idlwave"
3251 idlwave-special-lib-alist '(("/idl-astro/" . "AstroLib")
3252 ("/jhuapl/" . "JHUAPL-Lib")
3253 ("/dominik/lib/idl/" . "MyLib")))
3254 @end lisp
3255
3256 However, if you are an Emacs power-user and want IDLWAVE to work
3257 completely differently, you can change almost every aspect of it. Here
3258 is an example of a much more extensive configuration of IDLWAVE. The
3259 user is King!
3260
3261 @example
3262 ;;; Settings for IDLWAVE mode
3263
3264 (setq idlwave-block-indent 3) ; Indentation settings
3265 (setq idlwave-main-block-indent 3)
3266 (setq idlwave-end-offset -3)
3267 (setq idlwave-continuation-indent 1)
3268 (setq idlwave-begin-line-comment "^;[^;]") ; Leave ";" but not ";;"
3269 ; anchored at start of line.
3270 (setq idlwave-surround-by-blank t) ; Turn on padding ops =,<,>
3271 (setq idlwave-pad-keyword nil) ; Remove spaces for keyword '='
3272 (setq idlwave-expand-generic-end t) ; convert END to ENDIF etc...
3273 (setq idlwave-reserved-word-upcase t) ; Make reserved words upper case
3274 ; (with abbrevs only)
3275 (setq idlwave-abbrev-change-case nil) ; Don't force case of expansions
3276 (setq idlwave-hang-indent-regexp ": ") ; Change from "- " for auto-fill
3277 (setq idlwave-show-block nil) ; Turn off blinking to begin
3278 (setq idlwave-abbrev-move t) ; Allow abbrevs to move point
3279 (setq idlwave-query-class '((method-default . nil) ; No query for method
3280 (keyword-default . nil); or keyword completion
3281 ("INIT" . t) ; except for these
3282 ("CLEANUP" . t)
3283 ("SETPROPERTY" .t)
3284 ("GETPROPERTY" .t)))
3285
3286 ;; Some setting can only be done from a mode hook. Here is an example:
3287 (add-hook 'idlwave-mode-hook
3288 (lambda ()
3289 (setq case-fold-search nil) ; Make searches case sensitive
3290 ;; Run other functions here
3291 (font-lock-mode 1) ; Turn on font-lock mode
3292 (idlwave-auto-fill-mode 0) ; Turn off auto filling
3293
3294 ;; Pad with 1 space (if -n is used then make the
3295 ;; padding a minimum of n spaces.) The defaults use -1
3296 ;; instead of 1.
3297 (idlwave-action-and-binding "=" '(idlwave-expand-equal 1 1))
3298 (idlwave-action-and-binding "<" '(idlwave-surround 1 1))
3299 (idlwave-action-and-binding ">" '(idlwave-surround 1 1 '(?-)))
3300 (idlwave-action-and-binding "&" '(idlwave-surround 1 1))
3301
3302 ;; Only pad after comma and with exactly 1 space
3303 (idlwave-action-and-binding "," '(idlwave-surround nil 1))
3304 (idlwave-action-and-binding "&" '(idlwave-surround 1 1))
3305
3306 ;; Pad only after `->', remove any space before the arrow
3307 (idlwave-action-and-binding "->" '(idlwave-surround 0 -1 nil 2))
3308
3309 ;; Set some personal bindings
3310 ;; (In this case, makes `,' have the normal self-insert behavior.)
3311 (local-set-key "," 'self-insert-command)
3312 (local-set-key [f5] 'idlwave-shell-break-here)
3313 (local-set-key [f6] 'idlwave-shell-clear-current-bp)
3314
3315 ;; Create a newline, indenting the original and new line.
3316 ;; A similar function that does _not_ reindent the original
3317 ;; line is on "\C-j" (The default for emacs programming modes).
3318 (local-set-key "\n" 'idlwave-newline)
3319 ;; (local-set-key "\C-j" 'idlwave-newline) ; My preference.
3320
3321 ;; Some personal abbreviations
3322 (define-abbrev idlwave-mode-abbrev-table
3323 (concat idlwave-abbrev-start-char "wb") "widget_base()"
3324 (idlwave-keyword-abbrev 1))
3325 (define-abbrev idlwave-mode-abbrev-table
3326 (concat idlwave-abbrev-start-char "on") "obj_new()"
3327 (idlwave-keyword-abbrev 1))
3328 ))
3329
3330 ;;; Settings for IDLWAVE SHELL mode
3331
3332 (setq idlwave-shell-overlay-arrow "=>") ; default is ">"
3333 (setq idlwave-shell-use-dedicated-frame t) ; Make a dedicated frame
3334 (setq idlwave-shell-prompt-pattern "^WAVE> ") ; default is "^IDL> "
3335 (setq idlwave-shell-explicit-file-name "wave")
3336 (setq idlwave-shell-process-name "wave")
3337 (setq idlwave-shell-use-toolbar nil) ; No toolbar
3338
3339 ;; Most shell interaction settings can be done from the shell-mode-hook.
3340 (add-hook 'idlwave-shell-mode-hook
3341 (lambda ()
3342 ;; Set up some custom key and mouse examine commands
3343 (idlwave-shell-define-key-both [s-down-mouse-2]
3344 (idlwave-shell-mouse-examine
3345 "print, size(___,/DIMENSIONS)"))
3346 (idlwave-shell-define-key-both [f9] (idlwave-shell-examine
3347 "print, size(___,/DIMENSIONS)"))
3348 (idlwave-shell-define-key-both [f10] (idlwave-shell-examine
3349 "print,size(___,/TNAME)"))
3350 (idlwave-shell-define-key-both [f11] (idlwave-shell-examine
3351 "help,___,/STRUCTURE"))))
3352 @end example
3353
3354 @node Windows and MacOS, Index, Configuration Examples, Top
3355 @appendix Windows and MacOS
3356 @cindex Windows
3357 @cindex MacOS
3358
3359 IDLWAVE was developed on a UNIX system. However, due to the portability
3360 of Emacs, much of IDLWAVE does also work under different operating
3361 systems like Windows (with NTEmacs or NTXEmacs) or MacOS.
3362
3363 The only problem really is that RSI does not provide a command-line
3364 version of IDL for Windows or MacOS which IDLWAVE can interact
3365 with@footnote{Call your RSI representative and complain --- it should be
3366 trivial for them to provide one. And if enough people ask for it, maybe
3367 they will. The upcoming IDL for Mac OSX is slated to have a
3368 command-line version.}. Therefore the IDLWAVE Shell does not work and
3369 you have to rely on IDLDE to run and debug your programs. However,
3370 editing IDL source files with Emacs/IDLWAVE works with all bells and
3371 whistles, including routine info, completion and fast online help. Only
3372 a small amount of additional information must be specified in your
3373 .emacs file: you must specify path names which on a GNU or UNIX system
3374 are automatically gathered by talking to the IDL program.
3375
3376 Here is an example of the additional configuration needed for a Windows
3377 system. I am assuming that IDLWAVE has been installed in
3378 @w{@samp{C:\Program Files\IDLWAVE}} and that IDL is installed in
3379 @w{@samp{C:\RSI\IDL55}}.
3380
3381 @lisp
3382 ;; location of the lisp files (needed if IDLWAVE is not part of
3383 ;; the X/Emacs installation)
3384 (setq load-path (cons "c:/program files/IDLWAVE" load-path))
3385
3386 ;; The location of the IDL library files, both from RSI and your own.
3387 ;; note that the initial "+" expands the path recursively
3388 (setq idlwave-library-path
3389 '("+c:/RSI/IDL55/lib/" "+c:/user/me/idllibs" ))
3390
3391 ;; location of the IDL system directory (try "print,!DIR")
3392 (setq idlwave-system-directory "c:/RSI/IDL55/")
3393
3394 ;; location of the IDLWAVE help files idlw-help.el and idlw-help.txt.
3395 (setq idlwave-help-directory "c:/IDLWAVE")
3396
3397 ;; file in which to store the user catalog info
3398 (setq idlwave-libinfo-file "c:/IDLWAVE/idlcat.el")
3399 @end lisp
3400
3401 @noindent Furthermore, Windows sometimes tries to outsmart you --- make
3402 sure you check the following things:
3403
3404 @itemize @bullet
3405 @item When you download the IDLWAVE distribution, make sure you save the
3406 files under the names @file{idlwave.tar.gz} and
3407 @file{idlwave-help-tar.gz}.
3408 @item Be sure that your software for untarring/ungzipping is @emph{NOT}
3409 doing smart CR/LF conversion (WinZip users will find this in
3410 Options:Configuration:Miscellaneous, change the setting, then re-open
3411 the archive). This adds one byte per line, throwing off the
3412 byte-counts for the help file lookups and defeating fast online help lookup.
3413 @item M-TAB switches among running programs --- use Esc-TAB
3414 instead.
3415 @item Other issues as yet unnamed...
3416 @end itemize
3417
3418
3419 @node Index, , Windows and MacOS, Top
3420 @unnumbered Index
3421 @printindex cp
3422
3423 @bye