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