Add 2007 to copyright years.
[bpt/emacs.git] / man / idlwave.texi
CommitLineData
797c8ebc
CD
1\input texinfo @c -*-texinfo-*-
2@c %**start of header
746337e0 3@setfilename ../info/idlwave
797c8ebc 4@settitle IDLWAVE User Manual
12b86f0e
S
5@dircategory Emacs
6@direntry
7* IDLWAVE: (idlwave). Major mode and shell for IDL files.
8@end direntry
797c8ebc
CD
9@synindex ky cp
10@syncodeindex vr cp
11@syncodeindex fn cp
4111a42b
S
12@set VERSION 6.0
13@set EDITION 6.0
14@set IDLVERSION 6.2
15@set NSYSROUTINES 1966
16@set DATE Feb, 2006
5af23035 17@set AUTHOR J.D. Smith & Carsten Dominik
4111a42b 18@set AUTHOREMAIL jdsmith@@as.arizona.edu
5af23035 19@set MAINTAINER J.D. Smith
4111a42b 20@set MAINTAINEREMAIL jdsmith@@as.arizona.edu
4111a42b 21@set IDLWAVEHOMEPAGE http://idlwave.org/
797c8ebc 22@c %**end of header
12b86f0e 23@finalout
797c8ebc 24
12b86f0e 25@ifinfo
5af23035
S
26This file documents IDLWAVE, a major mode for editing IDL files with
27Emacs, and interacting with an IDL shell run as a subprocess.
28
29This is edition @value{EDITION} of the IDLWAVE User Manual for IDLWAVE
30@value{VERSION}
31
4111a42b 32Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4e6835db 33 2006, 2007 Free Software Foundation, Inc.
5af23035 34
32d4cddb 35Permission is granted to copy, distribute and/or modify this document
678e7c71 36under the terms of the GNU Free Documentation License, Version 1.2 or
32d4cddb
S
37any later version published by the Free Software Foundation; with no
38Invariant Sections, with the Front-Cover texts being ``A GNU
39Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
40license is included in the section entitled ``GNU Free Documentation
41License'' in the Emacs manual.
42
43(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
44this GNU Manual, like GNU software. Copies published by the Free
45Software Foundation raise funds for GNU development.''
46
47This document is part of a collection distributed under the GNU Free
48Documentation License. If you want to distribute this document
49separately from the collection, you can do so by adding a copy of the
50license to the document, as described in section 6 of the license.
12b86f0e 51@end ifinfo
797c8ebc
CD
52
53@titlepage
54@title IDLWAVE User Manual
5af23035 55@subtitle Emacs major mode and shell for IDL
797c8ebc
CD
56@subtitle Edition @value{EDITION}, @value{DATE}
57
12b86f0e 58@author by J.D. Smith & Carsten Dominik
797c8ebc 59@page
797c8ebc 60This is edition @value{EDITION} of the @cite{IDLWAVE User Manual} for
a8e833f3 61IDLWAVE version @value{VERSION}, @value{DATE}.
12b86f0e 62@sp 2
4111a42b 63Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4e6835db 64 2006, 2007 Free Software Foundation, Inc.
12b86f0e 65@sp 2
a8e833f3 66@cindex Copyright, of IDLWAVE
12b86f0e 67Permission is granted to copy, distribute and/or modify this document
678e7c71 68under the terms of the GNU Free Documentation License, Version 1.2 or
12b86f0e
S
69any later version published by the Free Software Foundation; with no
70Invariant Sections, with the Front-Cover texts being ``A GNU
71Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
72license is included in the section entitled ``GNU Free Documentation
73License'' in the Emacs manual.
74
75(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
76this GNU Manual, like GNU software. Copies published by the Free
77Software Foundation raise funds for GNU development.''
78
79This document is part of a collection distributed under the GNU Free
80Documentation License. If you want to distribute this document
81separately from the collection, you can do so by adding a copy of the
82license to the document, as described in section 6 of the license.
797c8ebc 83@end titlepage
a8e833f3
CD
84@contents
85
797c8ebc
CD
86@page
87
a8e833f3
CD
88@ifnottex
89
797c8ebc
CD
90@node Top, Introduction, (dir), (dir)
91
12b86f0e
S
92IDLWAVE is a package which supports editing source code written in the
93Interactive Data Language (IDL), and running IDL as an inferior shell.
797c8ebc 94
a8e833f3 95@end ifnottex
797c8ebc
CD
96
97@menu
12b86f0e 98* Introduction:: What IDLWAVE is, and what it is not
797c8ebc 99* IDLWAVE in a Nutshell:: One page quick-start guide
aea44e56 100* Getting Started:: Tutorial
12b86f0e
S
101* The IDLWAVE Major Mode:: The mode for editing IDL programs
102* The IDLWAVE Shell:: The mode for running IDL as an inferior program
5af23035 103* Acknowledgements:: Who did what
12b86f0e
S
104* Sources of Routine Info:: How does IDLWAVE know about routine XYZ
105* HTML Help Browser Tips::
106* Configuration Examples:: The user is king
5af23035 107* Windows and MacOS:: What still works, and how
12b86f0e 108* Troubleshooting:: When good computers turn bad
797c8ebc
CD
109* Index:: Fast access
110
5af23035
S
111@detailmenu
112 --- The Detailed Node Listing ---
113
114Getting Started (Tutorial)
115
12b86f0e
S
116* Lesson I -- Development Cycle::
117* Lesson II -- Customization::
118* Lesson III -- User Catalog::
797c8ebc
CD
119
120The IDLWAVE Major Mode
121
122* Code Formatting:: Making code look nice
a8e833f3
CD
123* Routine Info:: Calling Sequence and Keyword List
124* Online Help:: One key press from source to help
797c8ebc 125* Completion:: Completing routine names and Keywords
5af23035 126* Routine Source:: Finding routines, the easy way
a8e833f3 127* Resolving Routines:: Force the Shell to compile a routine
5af23035
S
128* Code Templates:: Frequent code constructs
129* Abbreviations:: Abbreviations for common commands
797c8ebc
CD
130* Actions:: Changing case, Padding, End checking
131* Doc Header:: Inserting a standard header
132* Motion Commands:: Moving through the structure of a program
133* Misc Options:: Things that fit nowhere else
134
135Code Formatting
136
137* Code Indentation:: Reflecting the logical structure
12b86f0e 138* Continued Statement Indentation::
797c8ebc
CD
139* Comment Indentation:: Special indentation for comment lines
140* Continuation Lines:: Splitting statements over lines
141* Syntax Highlighting:: Font-lock support
5af23035
S
142* Octals and Highlighting:: Why "123 causes problems
143
12b86f0e
S
144Online Help
145
146* Help with HTML Documentation::
147* Help with Source::
148
5af23035
S
149Completion
150
151* Case of Completed Words:: CaseOFcomPletedWords
152* Object Method Completion and Class Ambiguity:: obj->Method, what?
12b86f0e 153* Object Method Completion in the Shell::
5af23035
S
154* Class and Keyword Inheritance:: obj->Method, _EXTRA=e
155* Structure Tag Completion:: Completing state.Tag
797c8ebc
CD
156
157Actions
158
76959b77 159* Block Boundary Check:: Is the END statement correct?
797c8ebc
CD
160* Padding Operators:: Enforcing space around `=' etc
161* Case Changes:: Enforcing upper case keywords
162
163The IDLWAVE Shell
164
165* Starting the Shell:: How to launch IDL as a subprocess
166* Using the Shell:: Interactively working with the Shell
12b86f0e
S
167* Commands Sent to the Shell::
168* Debugging IDL Programs::
169* Examining Variables::
170* Custom Expression Examination::
797c8ebc
CD
171
172Debugging IDL Programs
173
12b86f0e
S
174* A Tale of Two Modes::
175* Debug Key Bindings::
176* Breakpoints and Stepping::
177* Compiling Programs::
178* Walking the Calling Stack::
179* Electric Debug Mode::
797c8ebc 180
797c8ebc
CD
181Sources of Routine Info
182
183* Routine Definitions:: Where IDL Routines are defined.
a8e833f3 184* Routine Information Sources:: So how does IDLWAVE know about...
12b86f0e 185* Catalogs::
a8e833f3
CD
186* Load-Path Shadows:: Routines defined in several places
187* Documentation Scan:: Scanning the IDL Manuals
188
12b86f0e
S
189Catalogs
190
191* Library Catalogs::
192* User Catalog::
193
797c8ebc
CD
194@end detailmenu
195@end menu
196
197@node Introduction, IDLWAVE in a Nutshell, Top, Top
198@chapter Introduction
199@cindex Introduction
4111a42b
S
200@cindex CORBA (Common Object Request Broker Architecture)
201@cindex Interface Definition Language
a8e833f3 202@cindex Interactive Data Language
797c8ebc 203@cindex cc-mode.el
a8e833f3
CD
204@cindex @file{idl.el}
205@cindex @file{idl-shell.el}
797c8ebc
CD
206@cindex Feature overview
207
12b86f0e 208IDLWAVE is a package which supports editing source files written in
5a2881c2 209the Interactive Data Language (IDL), and running IDL as an inferior shell@footnote{IDLWAVE can also be used
4111a42b
S
210for editing source files for the related WAVE/CL language, but with only
211limited support.}. It is a feature-rich replacement for the IDLDE
212development environment included with IDL, and uses the full power of
213Emacs to make editing and running IDL programs easier, quicker, and more
214structured.
12b86f0e
S
215
216IDLWAVE consists of two main parts: a major mode for editing IDL
217source files (@code{idlwave-mode}) and a mode for running the IDL
218program as an inferior shell (@code{idlwave-shell-mode}). Although
219one mode can be used without the other, both work together closely to
220form a complete development environment. Here is a brief summary of
221what IDLWAVE does:
797c8ebc
CD
222
223@itemize @bullet
12b86f0e
S
224@item
225Smart code indentation and automatic-formatting.
797c8ebc 226@item
5af23035 227Three level syntax highlighting support.
12b86f0e 228@item
5af23035 229Context-sensitive display of calling sequences and keywords for more
12b86f0e
S
230than 1000 native IDL routines, extendible to any additional number of
231local routines, and already available with many pre-scanned libraries.
a8e833f3 232@item
12b86f0e
S
233Fast, context-sensitive online HTML help, or source-header help for
234undocumented routines.
797c8ebc 235@item
12b86f0e
S
236Context sensitive completion of routine names, keywords, system
237variables, class names and much more.
797c8ebc 238@item
12b86f0e 239Easy insertion of code templates and abbreviations of common constructs.
797c8ebc 240@item
5af23035
S
241Automatic corrections to enforce a variety of customizable coding
242standards.
797c8ebc 243@item
5af23035 244Integrity checks and auto-termination of logical blocks.
797c8ebc 245@item
4111a42b
S
246Routine name space conflict search with likelihood-of-use ranking.
247@item
a8e833f3
CD
248Support for @file{imenu} (Emacs) and @file{func-menu} (XEmacs).
249@item
797c8ebc
CD
250Documentation support.
251@item
5af23035
S
252Running IDL as an inferior Shell with history search, command line
253editing and all the completion and routine info capabilities present in
254IDL source buffers.
255@item
4111a42b
S
256Full handling of debugging with breakpoints, with interactive setting
257of break conditions, and easy stepping through code.
258@item
12b86f0e
S
259Compilation, execution and interactive single-keystroke debugging of
260programs directly from the source buffer.
797c8ebc 261@item
5af23035
S
262Quick, source-guided navigation of the calling stack, with variable
263inspection, etc.
797c8ebc 264@item
5af23035 265Examining variables and expressions with a mouse click.
797c8ebc 266@item
5af23035 267And much, much more...
797c8ebc
CD
268@end itemize
269
270@ifnottex
271@cindex Screenshots
5af23035 272Here are a number of screenshots showing IDLWAVE in action:
a8e833f3 273
797c8ebc
CD
274@itemize @bullet
275@item
5af23035 276@uref{http://idlwave.org/screenshots/emacs_21_nav.gif,An IDLWAVE buffer}
797c8ebc 277@item
5af23035 278@uref{http://idlwave.org/screenshots/emacs_21_keys.gif,A keyword being completed}
797c8ebc 279@item
5af23035 280@uref{http://idlwave.org/screenshots/emacs_21_help.gif,Online help text.}
797c8ebc 281@item
5af23035
S
282@uref{http://idlwave.org/screenshots/emacs_21_ri.gif,Routine information displayed}
283@item
284@uref{http://idlwave.org/screenshots/emacs_21_bp.gif,Debugging code
285stopped at a breakpoint}
797c8ebc
CD
286@end itemize
287@end ifnottex
288
12b86f0e
S
289IDLWAVE is the distant successor to the @file{idl.el} and
290@file{idl-shell.el} files written by Chris Chase. The modes and files
291had to be renamed because of a name space conflict with CORBA's
292@code{idl-mode}, defined in Emacs in the file @file{cc-mode.el}.
5af23035
S
293
294In this manual, each section ends with a list of related user options.
295Don't be confused by the sheer number of options available --- in most
296cases the default settings are just fine. The variables are listed here
297to make sure you know where to look if you want to change anything. For
298a full description of what a particular variable does and how to
299configure it, see the documentation string of that variable (available
300with @kbd{C-h v}). Some configuration examples are also given in the
301appendix.
797c8ebc 302
aea44e56 303@node IDLWAVE in a Nutshell, Getting Started, Introduction, Top
797c8ebc 304@chapter IDLWAVE in a Nutshell
a8e833f3 305@cindex Summary of important commands
797c8ebc
CD
306@cindex IDLWAVE in a Nutshell
307@cindex Nutshell, IDLWAVE in a
308
797c8ebc
CD
309@subheading Editing IDL Programs
310
311@multitable @columnfractions .15 .85
312@item @key{TAB}
313@tab Indent the current line relative to context.
718fb8a1 314@item @kbd{C-M-\}
797c8ebc 315@tab Re-indent all lines in the current region.
4111a42b
S
316@item @kbd{C-M-q}
317@tab Re-indent all lines in the current routine.
5af23035
S
318@item @kbd{C-u @key{TAB}}
319@tab Re-indent all lines in the current statement.
797c8ebc 320@item @kbd{M-@key{RET}}
4111a42b 321@tab Start a continuation line, splitting the current line at point.
797c8ebc
CD
322@item @kbd{M-q}
323@tab Fill the current comment paragraph.
324@item @kbd{C-c ?}
5af23035 325@tab Display calling sequence and keywords for the procedure or function call
797c8ebc 326at point.
a8e833f3 327@item @kbd{M-?}
5af23035 328@tab Load context sensitive online help for nearby routine, keyword, etc.
797c8ebc
CD
329@item @kbd{M-@key{TAB}}
330@tab Complete a procedure name, function name or keyword in the buffer.
331@item @kbd{C-c C-i}
332@tab Update IDLWAVE's knowledge about functions and procedures.
333@item @kbd{C-c C-v}
5af23035 334@tab Visit the source code of a procedure/function.
12b86f0e
S
335@item @kbd{C-u C-c C-v}
336@tab Visit the source code of a procedure/function in this buffer.
797c8ebc
CD
337@item @kbd{C-c C-h}
338@tab Insert a standard documentation header.
5af23035 339@item @kbd{C-c @key{RET}}
797c8ebc
CD
340@tab Insert a new timestamp and history item in the documentation header.
341@end multitable
342
343@subheading Running the IDLWAVE Shell, Debugging Programs
344
345@multitable @columnfractions .15 .85
346@item @kbd{C-c C-s}
4111a42b
S
347@tab Start IDL as a subprocess and/or switch to the shell buffer.
348@item @key{Up}, @kbd{M-p}
5af23035 349@tab Cycle back through IDL command history.
4111a42b 350@item @key{Down},@kbd{M-n}
797c8ebc 351@tab Cycle forward.
12b86f0e 352@item @kbd{@key{TAB}}
797c8ebc
CD
353@tab Complete a procedure name, function name or keyword in the shell buffer.
354@item @kbd{C-c C-d C-c}
355@tab Save and compile the source file in the current buffer.
356@item @kbd{C-c C-d C-x}
12b86f0e
S
357@tab Go to next syntax error.
358@item @kbd{C-c C-d C-v}
359@tab Switch to electric debug mode.
797c8ebc 360@item @kbd{C-c C-d C-b}
5af23035 361@tab Set a breakpoint at the nearest viable source line.
797c8ebc 362@item @kbd{C-c C-d C-d}
5af23035 363@tab Clear the nearest breakpoint.
12b86f0e
S
364@item @kbd{C-c C-d [}
365@tab Go to the previous breakpoint.
366@item @kbd{C-c C-d ]}
367@tab Go to the next breakpoint.
797c8ebc 368@item @kbd{C-c C-d C-p}
5af23035 369@tab Print the value of the expression near point in IDL.
797c8ebc
CD
370@end multitable
371
372@subheading Commonly used Settings in @file{.emacs}
373@lisp
374;; Change the indentation preferences
5af23035
S
375;; Start autoloading routine info after 2 idle seconds
376(setq idlwave-init-rinfo-when-idle-after 2)
4111a42b 377;; Pad operators with spaces
ea442c62
CD
378(setq idlwave-do-actions t
379 idlwave-surround-by-blank t)
ea442c62
CD
380;; Syntax Highlighting
381(add-hook 'idlwave-mode-hook 'turn-on-font-lock)
aea44e56
CD
382;; Automatically start the shell when needed
383(setq idlwave-shell-automatic-start t)
384;; Bind debugging commands with CONTROL and SHIFT modifiers
385(setq idlwave-shell-debug-modifiers '(control shift))
797c8ebc
CD
386@end lisp
387
4111a42b 388@html
76959b77 389<A NAME="TUTORIAL"></A>
4111a42b
S
390@end html
391
aea44e56
CD
392@node Getting Started, The IDLWAVE Major Mode, IDLWAVE in a Nutshell, Top
393@chapter Getting Started (Tutorial)
394@cindex Quick-Start
395@cindex Tutorial
396@cindex Getting Started
397
5af23035 398@menu
12b86f0e
S
399* Lesson I -- Development Cycle::
400* Lesson II -- Customization::
401* Lesson III -- User Catalog::
5af23035
S
402@end menu
403
404@node Lesson I -- Development Cycle, Lesson II -- Customization, Getting Started, Getting Started
405@section Lesson I: Development Cycle
aea44e56
CD
406
407The purpose of this tutorial is to guide you through a very basic
12b86f0e
S
408development cycle using IDLWAVE. We will paste a simple program into
409a buffer and use the shell to compile, debug and run it. On the way
410we will use many of the important IDLWAVE commands. Note, however,
411that IDLWAVE has many more capabilities than covered here, which can
412be discovered by reading the entire manual, or hovering over the
413shoulder of your nearest IDLWAVE guru for a few days.
5af23035
S
414
415It is assumed that you have access to Emacs or XEmacs with the full
5a2881c2
RS
416IDLWAVE package including online help. We also assume that you are
417familiar with Emacs and can read the nomenclature of key presses in
418Emacs (in particular, @kbd{C} stands for @key{CONTROL} and @kbd{M} for
419@key{META} (often the @key{ALT} key carries this functionality)).
aea44e56 420
5af23035 421Open a new source file by typing:
aea44e56
CD
422
423@example
424@kbd{C-x C-f tutorial.pro @key{RET}}
425@end example
426
12b86f0e
S
427A buffer for this file will pop up, and it should be in IDLWAVE mode,
428indicated in the mode line just below the editing window. Also, the
429menu bar should contain @samp{IDLWAVE}.
aea44e56 430
5af23035 431Now cut-and-paste the following code, also available as
aea44e56
CD
432@file{tutorial.pro} in the IDLWAVE distribution.
433
434@example
435function daynr,d,m,y
436 ;; compute a sequence number for a date
437 ;; works 1901-2099.
438 if y lt 100 then y = y+1900
439 if m le 2 then delta = 1 else delta = 0
440 m1 = m + delta*12 + 1
441 y1 = y * delta
442 return, d + floor(m1*30.6)+floor(y1*365.25)+5
443end
12b86f0e 444
aea44e56
CD
445function weekday,day,month,year
446 ;; compute weekday number for date
447 nr = daynr(day,month,year)
448 return, nr mod 7
449end
12b86f0e 450
aea44e56
CD
451pro plot_wday,day,month
452 ;; Plot the weekday of a date in the first 10 years of this century.
453 years = 2000,+indgen(10)
454 wdays = intarr(10)
455 for i=0,n_elements(wdays)-1 do begin
5af23035 456 wdays[i] = weekday(day,month,years[i])
aea44e56 457 end
5af23035 458 plot,years,wdays,YS=2,YT="Wday (0=Sunday)"
aea44e56
CD
459end
460@end example
461
462The indentation probably looks funny, since it's different from the
12b86f0e
S
463settings you use, so use the @key{TAB} key in each line to
464automatically line it up (or, more quickly, @emph{select} the entire
465buffer with @kbd{C-x h}, and indent the whole region with
466@kbd{C-M-\}). Notice how different syntactical elements are
467highlighted in different colors, if you have set up support for
468font-lock.
aea44e56
CD
469
470Let's check out two particular editing features of IDLWAVE. Place the
471cursor after the @code{end} statement of the @code{for} loop and press
472@key{SPC}. IDLWAVE blinks back to the beginning of the block and
473changes the generic @code{end} to the specific @code{endfor}
12b86f0e
S
474automatically (as long as the variable @code{idlwave-expand-generic-end}
475is turned on --- @pxref{Lesson II -- Customization}). Now place the
476cursor in any line you would like to split and press @kbd{M-@key{RET}}.
477The line is split at the cursor position, with the continuation @samp{$}
478and indentation all taken care of. Use @kbd{C-/} to undo the last
479change.
480
481The procedure @code{plot_wday} is supposed to plot the day of the week
482of a given date for the first 10 years of the 21st century. As in
483most code, there are a few bugs, which we are going to use IDLWAVE to
484help us fix.
aea44e56
CD
485
486First, let's launch the IDLWAVE shell. You do this with the command
12b86f0e
S
487@kbd{C-c C-s}. The Emacs window will split or another window will popup
488to display IDL running in a shell interaction buffer. Type a few
489commands like @code{print,!PI} to convince yourself that you can work
490there just as well as in a terminal, or the IDLDE. Use the arrow keys
491to cycle through your command history. Are we having fun now?
aea44e56
CD
492
493Now go back to the source window and type @kbd{C-c C-d C-c} to compile
494the program. If you watch the shell buffer, you see that IDLWAVE types
4111a42b 495@samp{.run "tutorial.pro"} for you. But the compilation fails because
aea44e56
CD
496there is a comma in the line @samp{years=...}. The line with the error
497is highlighted and the cursor positioned at the error, so remove the
5af23035
S
498comma (you should only need to hit @kbd{Delete}!). Compile again, using
499the same keystrokes as before. Notice that the file is automatically
500saved for you. This time everything should work fine, and you should
501see the three routines compile.
502
503Now we want to use the command to plot the day of the week on January
5041st. We could type the full command ourselves, but why do that? Go
12b86f0e
S
505back to the shell window, type @samp{plot_} and hit @key{TAB}. After
506a bit of a delay (while IDLWAVE initializes its routine info database,
507if necessary), the window will split to show all procedures it knows
5af23035 508starting with that string, and @w{@code{plot_wday}} should be one of
12b86f0e
S
509them. Saving the buffer alerted IDLWAVE about this new routine.
510Click with the middle mouse button on @code{plot_wday} and it will be
511copied to the shell buffer, or if you prefer, add @samp{w} to
512@samp{plot_} to make it unambiguous (depending on what other routines
513starting with @samp{plot_} you have installed on your system), hit
514@key{TAB} again, and the full routine name will be completed. Now
515provide the two arguments:
aea44e56
CD
516
517@example
518plot_wday,1,1
519@end example
520
12b86f0e
S
521@noindent and press @key{RET}. This fails with an error message telling
522you the @code{YT} keyword to plot is ambiguous. What are the allowed
523keywords again? Go back to the source window and put the cursor into
524the `plot' line and press @kbd{C-c ?}. This shows the routine info
525window for the plot routine, which contains a list of keywords, along
526with the argument list. Oh, we wanted @code{YTITLE}. Fix that up.
527Recompile with @kbd{C-c C-d C-c}. Jump back into the shell with
528@kbd{C-c C-s}, press the @key{UP} arrow to recall the previous command
529and execute again.
aea44e56 530
5af23035 531This time we get a plot, but it is pretty ugly --- the points are all
aea44e56
CD
532connected with a line. Hmm, isn't there a way for @code{plot} to use
533symbols instead? What was that keyword? Position the cursor on the
534plot line after a comma (where you'd normally type a keyword), and hit
12b86f0e
S
535@kbd{M-@key{Tab}}. A long list of plot's keywords appears. Aha,
536there it is, @code{PSYM}. Middle click to insert it. An @samp{=}
537sign is included for you too. Now what were the values of @code{PSYM}
538supposed to be? With the cursor on or after the keyword, press
539@kbd{M-?} for online help (alternatively, you could have right clicked
540on the colored keyword itself in the completion list). A browser will
541pop up showing the HTML documentation for the @code{PYSM} keyword.
542OK, let's use diamonds=4. Fix this, recompile (you know the command
543by now: @kbd{C-c C-d C-c}), go back to the shell (if it's vanished,
544you know what to do: @kbd{C-c C-s}) and execute again. Now things
545look pretty good.
aea44e56 546
5af23035 547Let's try a different day --- how about April fool's day?
aea44e56
CD
548
549@example
550plot_wday,1,4
551@end example
552
4111a42b 553Oops, this looks very wrong. All April Fool's days cannot be Fridays!
5af23035
S
554We've got a bug in the program, perhaps in the @code{daynr} function.
555Let's put a breakpoint on the last line there. Position the cursor on
556the @samp{return, d+...} line and press @kbd{C-c C-d C-b}. IDL sets a
12b86f0e
S
557breakpoint (as you see in the shell window), and the break line is
558indicated. Back to the shell buffer, re-execute the previous command.
559IDL stops at the line with the breakpoint. Now hold down the SHIFT
560key and click with the middle mouse button on a few variables there:
561@samp{d}, @samp{y}, @samp{m}, @samp{y1}, etc. Maybe @code{d} isn't
562the correct type. CONTROL-SHIFT middle-click on it for help. Well,
563it's an integer, so that's not the problem. Aha, @samp{y1} is zero,
564but it should be the year, depending on delta. Shift click
565@samp{delta} to see that it's 0. Below, we see the offending line:
566@samp{y1=y*delta...} the multiplication should have been a minus sign!
567Hit @kbd{q} to exit the debugging mode, and fix the line to read:
aea44e56
CD
568
569@example
570y1 = y - delta
571@end example
572
573Now remove all breakpoints: @kbd{C-c C-d C-a}. Recompile and rerun the
574command. Everything should now work fine. How about those leap years?
575Change the code to plot 100 years and see that every 28 years, the
576sequence of weekdays repeats.
577
12b86f0e 578@node Lesson II -- Customization, Lesson III -- User Catalog, Lesson I -- Development Cycle, Getting Started
5af23035 579@section Lesson II: Customization
aea44e56 580
4111a42b
S
581Emacs is probably the most customizable piece of software ever written,
582and it would be a shame if you did not make use of this to adapt IDLWAVE
583to your own preferences. Customizing Emacs or IDLWAVE is accomplished
584by setting Lisp variables in the @file{.emacs} file in your home
585directory --- but do not be dismayed; for the most part, you can just
586copy and work from the examples given here.
5af23035
S
587
588Let's first use a boolean variable. These are variables which you turn
589on or off, much like a checkbox. A value of @samp{t} means on, a value
590of @samp{nil} means off. Copy the following line into your
aea44e56
CD
591@file{.emacs} file, exit and restart Emacs.
592
593@lisp
594(setq idlwave-reserved-word-upcase t)
595@end lisp
596
597When this option is turned on, each reserved word you type into an IDL
598source buffer will be converted to upper case when you press @key{SPC}
599or @key{RET} right after the word. Try it out! @samp{if} changes to
600@samp{IF}, @samp{begin} to @samp{BEGIN}. If you don't like this
12b86f0e
S
601behavior, remove the option again from your @file{.emacs} file and
602restart Emacs.
aea44e56 603
5af23035 604You likely have your own indentation preferences for IDL code. For
4111a42b
S
605example, some may prefer to indent the main block of an IDL program
606slightly from the margin and use only 3 spaces as indentation between
607@code{BEGIN} and @code{END}. Try the following lines in @file{.emacs}:
aea44e56
CD
608
609@lisp
4111a42b 610(setq idlwave-main-block-indent 1)
aea44e56
CD
611(setq idlwave-block-indent 3)
612(setq idlwave-end-offset -3)
613@end lisp
614
5af23035
S
615Restart Emacs, and re-indent the program we developed in the first part
616of this tutorial with @kbd{C-c h} and @kbd{C-M-\}. You may want to keep
617these lines in @file{.emacs}, with values adjusted to your likings. If
618you want to get more information about any of these variables, type,
619e.g., @kbd{C-h v idlwave-main-block-indent @key{RET}}. To find which
620variables can be customized, look for items marked @samp{User Option:}
621throughout this manual.
622
623If you cannot seem to master this Lisp customization in @file{.emacs},
624there is another, more user-friendly way to customize all the IDLWAVE
625variables. You can access it through the IDLWAVE menu in one of the
626@file{.pro} buffers, menu item @code{Customize->Browse IDLWAVE
627Group}. Here you'll be presented with all the various variables grouped
12b86f0e
S
628into categories. You can navigate the hierarchy (e.g. @samp{IDLWAVE
629Code Formatting->Idlwave Abbrev And Indent Action->Idlwave Expand
630Generic End} to turn on @code{END} expansion), read about the variables,
631change them, and `Save for Future Sessions'. Few of these variables
632need customization, but you can exercise considerable control over
633IDLWAVE's functionality with them.
5af23035
S
634
635You may also find the key bindings used for the debugging commands too
12b86f0e
S
636long and complicated. Often we have heard complaints along the lines
637of, ``Do I really have to go through the finger gymnastics of @kbd{C-c
638C-d C-c} to run a simple command?'' Due to Emacs rules and
639conventions, shorter bindings cannot be set by default, but you can
640easily enable them. First, there is a way to assign all debugging
641commands in a single sweep to another simpler combination. The only
642problem is that we have to use something which Emacs does not need for
643other important commands. One good option is to execute debugging
644commands by holding down @key{CONTROL} and @key{SHIFT} while pressing
645a single character: @kbd{C-S-b} for setting a breakpoint, @kbd{C-S-c}
646for compiling the current source file, @kbd{C-S-a} for deleting all
647breakpoints (try it, it's easier). You can enable this with:
aea44e56
CD
648
649@lisp
650(setq idlwave-shell-debug-modifiers '(shift control))
651@end lisp
652
5af23035 653@noindent If you have a special keyboard with, for example, a
12b86f0e 654@key{SUPER} key, you could even shorten that:
aea44e56
CD
655
656@lisp
12b86f0e 657(setq idlwave-shell-debug-modifiers '(super))
aea44e56
CD
658@end lisp
659
12b86f0e
S
660@noindent to get compilation on @kbd{S-c}. Often, a modifier key like
661@key{SUPER} or @key{HYPER} is bound or can be bound to an otherwise
662unused key on your keyboard --- consult your system documentation.
aea44e56 663
5af23035 664You can also assign specific commands to keys. This you must do in the
12b86f0e
S
665@emph{mode-hook}, a special function which is run when a new IDLWAVE
666buffer gets set up. The possibilities for key customization are
667endless. Here we set function keys f4-f8 to common debugging commands.
aea44e56
CD
668
669@lisp
670;; First for the source buffer
671(add-hook 'idlwave-mode-hook
672 (lambda ()
12b86f0e 673 (local-set-key [f4] 'idlwave-shell-retall)
aea44e56
CD
674 (local-set-key [f5] 'idlwave-shell-break-here)
675 (local-set-key [f6] 'idlwave-shell-clear-current-bp)
676 (local-set-key [f7] 'idlwave-shell-cont)
677 (local-set-key [f8] 'idlwave-shell-clear-all-bp)))
678;; Then for the shell buffer
679(add-hook 'idlwave-shell-mode-hook
680 (lambda ()
12b86f0e 681 (local-set-key [f4] 'idlwave-shell-retall)
aea44e56
CD
682 (local-set-key [f5] 'idlwave-shell-break-here)
683 (local-set-key [f6] 'idlwave-shell-clear-current-bp)
684 (local-set-key [f7] 'idlwave-shell-cont)
685 (local-set-key [f8] 'idlwave-shell-clear-all-bp)))
686@end lisp
687
12b86f0e
S
688@node Lesson III -- User Catalog, , Lesson II -- Customization, Getting Started
689@section Lesson III: User and Library Catalogs
aea44e56
CD
690
691We have already used the routine info display in the first part of this
12b86f0e
S
692tutorial. This was the invoked using @kbd{C-c ?}, and displays
693information about the IDL routine near the cursor position. Wouldn't it
694be nice to have the same kind of information available for your own
695routines and for the huge amount of code in major libraries like JHUPL
696or the IDL-Astro library? In many cases, you may already have this
697information. Files named @file{.idlwave_catalog} in library directories
698contain scanned information on the routines in that directory; many
699popular libraries ship with these ``library catalogs'' pre-scanned.
700Users can scan their own routines in one of two ways: either using the
701supplied tool to scan directories and build their own
702@file{.idlwave_catalog} files, or using the built-in method to create a
703single ``user catalog'', which we'll show here. @xref{Catalogs}, for
704more information on choosing which method to use.
705
706To build a user catalog, select @code{Routine Info/Select Catalog
707Directories} from the IDLWAVE entry in the menu bar. If necessary,
708start the shell first with @kbd{C-c C-s} (@pxref{Starting the Shell}).
709IDLWAVE will find out about the IDL @code{!PATH} variable and offer a
710list of directories on the path. Simply select them all (or whichever
711you want --- directories with existing library catalogs will not be
712selected by default) and click on the @samp{Scan&Save} button. Then
713go for a cup of coffee while IDLWAVE collects information for each and
714every IDL routine on your search path. All this information is
715written to the file @file{.idlwave/idlusercat.el} in your home
716directory and will from now on automatically load whenever you use
5af23035 717IDLWAVE. You may find it necessary to rebuild the catalog on occasion
12b86f0e
S
718as your local libraries change, or build a library catalog for those
719directories instead. Invoke routine info (@kbd{C-c ?}) or completion
720(@kbd{M-@key{TAB}}) on any routine or partial routine name you know to
721be located in the library. E.g., if you have scanned the IDL-Astro
722library:
aea44e56
CD
723
724@example
12b86f0e 725 a=readf@key{M-@key{TAB}}
aea44e56
CD
726@end example
727
aea44e56
CD
728expands to `readfits('. Then try
729
730@example
731 a=readfits(@key{C-c ?}
732@end example
733
734and you get:
735
736@example
737Usage: Result = READFITS(filename, header, heap)
738...
739@end example
740
741I hope you made it until here. Now you are set to work with IDLWAVE.
12b86f0e
S
742On the way you will want to change other things, and to learn more
743about the possibilities not discussed in this short tutorial. Read
744the manual, look at the documentation strings of interesting variables
745(with @kbd{C-h v idlwave<-variable-name> @key{RET}}) and ask the
746remaining questions on the newsgroup @code{comp.lang.idl-pvwave}.
aea44e56
CD
747
748@node The IDLWAVE Major Mode, The IDLWAVE Shell, Getting Started, Top
797c8ebc
CD
749@chapter The IDLWAVE Major Mode
750@cindex IDLWAVE major mode
751@cindex Major mode, @code{idlwave-mode}
752
5af23035
S
753The IDLWAVE major mode supports editing IDL source files. In this
754chapter we describe the main features of the mode and how to customize
755them.
797c8ebc
CD
756
757@menu
758* Code Formatting:: Making code look nice
a8e833f3
CD
759* Routine Info:: Calling Sequence and Keyword List
760* Online Help:: One key press from source to help
797c8ebc 761* Completion:: Completing routine names and Keywords
5af23035 762* Routine Source:: Finding routines, the easy way
a8e833f3 763* Resolving Routines:: Force the Shell to compile a routine
5af23035
S
764* Code Templates:: Frequent code constructs
765* Abbreviations:: Abbreviations for common commands
797c8ebc
CD
766* Actions:: Changing case, Padding, End checking
767* Doc Header:: Inserting a standard header
768* Motion Commands:: Moving through the structure of a program
769* Misc Options:: Things that fit nowhere else
770@end menu
771
772@node Code Formatting, Routine Info, The IDLWAVE Major Mode, The IDLWAVE Major Mode
773@section Code Formatting
774@cindex Code formatting
775@cindex Formatting, of code
776
777@menu
778* Code Indentation:: Reflecting the logical structure
12b86f0e 779* Continued Statement Indentation::
797c8ebc
CD
780* Comment Indentation:: Special indentation for comment lines
781* Continuation Lines:: Splitting statements over lines
782* Syntax Highlighting:: Font-lock support
5af23035 783* Octals and Highlighting:: Why "123 causes problems
797c8ebc
CD
784@end menu
785
12b86f0e 786The IDL language, with its early roots in FORTRAN, modern
5af23035 787implementation in C, and liberal borrowing of features of many vector
12b86f0e
S
788and other languages along its 25+ year history, has inherited an
789unusual mix of syntax elements. Left to his or her own devices, a
790novice IDL programmer will often conjure code which is very difficult
791to read and impossible to adapt. Much can be gleaned from studying
792available IDL code libraries for coding style pointers, but, due to
793the variety of IDL syntax elements, replicating this style can be
794challenging at best. Luckily, IDLWAVE understands the structure of
795IDL code very well, and takes care of almost all formatting issues for
796you. After configuring it to match your coding standards, you can
797rely on it to help keep your code neat and organized.
797c8ebc 798
797c8ebc 799
5af23035
S
800@node Code Indentation, Continued Statement Indentation, Code Formatting, Code Formatting
801@subsection Code Indentation
802@cindex Code indentation
803@cindex Indentation
804
805Like all Emacs programming modes, IDLWAVE performs code indentation.
806The @key{TAB} key indents the current line relative to context.
807@key{LFD} insert a newline and indents the new line. The indentation is
808governed by a number of variables. IDLWAVE indents blocks (between
809@code{PRO}/@code{FUNCTION}/@code{BEGIN} and @code{END}), and
810continuation lines.
811
12b86f0e
S
812@cindex Foreign code, adapting
813@cindex Indentation, of foreign code
814@kindex C-M-\
4111a42b
S
815To re-indent a larger portion of code (e.g. when working with foreign
816code written with different conventions), use @kbd{C-M-\}
12b86f0e 817(@code{indent-region}) after marking the relevant code. Useful marking
4111a42b
S
818commands are @kbd{C-x h} (the entire file) or @kbd{C-M-h} (the current
819subprogram). The command @kbd{C-M-q} reindents the entire current
820routine. @xref{Actions}, for information how to impose additional
821formatting conventions on foreign code.
12b86f0e 822
4111a42b 823@defopt idlwave-main-block-indent (@code{2})
797c8ebc
CD
824Extra indentation for the main block of code. That is the block between
825the FUNCTION/PRO statement and the END statement for that program
a8e833f3 826unit.
797c8ebc
CD
827@end defopt
828
4111a42b 829@defopt idlwave-block-indent (@code{3})
797c8ebc 830Extra indentation applied to block lines. If you change this, you
a8e833f3 831probably also want to change @code{idlwave-end-offset}.
797c8ebc
CD
832@end defopt
833
4111a42b 834@defopt idlwave-end-offset (@code{-3})
797c8ebc
CD
835Extra indentation applied to block END lines. A value equal to negative
836@code{idlwave-block-indent} will make END lines line up with the block
a8e833f3 837BEGIN lines.
797c8ebc
CD
838@end defopt
839
5af23035
S
840@node Continued Statement Indentation, Comment Indentation, Code Indentation, Code Formatting
841@subsection Continued Statement Indentation
842@cindex Indentation, continued statement
843@cindex Continued statement indentation
844Continuation lines (following a line ending with @code{$}) can receive a
845fixed indentation offset from the main level, but in several situations
846IDLWAVE can use a special form of indentation which aligns continued
847statements more naturally. Special indentation is calculated for
848continued routine definition statements and calls, enclosing parentheses
849(like function calls, structure/class definitions, explicit structures
850or lists, etc.), and continued assignments. An attempt is made to line
851up with the first non-whitespace character after the relevant opening
852punctuation mark (@code{,},@code{(},@code{@{},@code{[},@code{=}). For
853lines without any non-comment characters on the line with the opening
854punctuation, the continued line(s) are aligned just past the
855punctuation. An example:
856
857@example
858function foo, a, b, $
859 c, d
860 bar = sin( a + b + $
861 c + d)
862end
863@end example
864@noindent
865
866The only drawback to this special continued statement indentation is
867that it consumes more space, e.g., for long function names or left hand
868sides of an assignment:
869
870@example
871function thisfunctionnameisverylongsoitwillleavelittleroom, a, b, $
872 c, d
873@end example
874
76959b77 875You can instruct IDLWAVE when to avoid using this special continuation
5af23035
S
876indentation by setting the variable
877@code{idlwave-max-extra-continuation-indent}, which specifies the
76959b77
S
878maximum additional indentation beyond the basic indent to be
879tolerated, otherwise defaulting to a fixed-offset from the enclosing
880indent (the size of which offset is set in
12b86f0e
S
881@code{idlwave-continuation-indent}). As a special case, continuations
882of routine calls without any arguments or keywords will @emph{not}
883align the continued line, under the assumption that you continued
884because you needed the space.
885
886Also, since the indentation level can be somewhat dynamic in continued
887statements with special continuation indentation, especially if
76959b77
S
888@code{idlwave-max-extra-continuation-indent} is small, the key
889@kbd{C-u @key{TAB}} will re-indent all lines in the current statement.
4111a42b
S
890Note that @code{idlwave-indent-to-open-paren}, if non-@code{nil},
891overrides the @code{idlwave-max-extra-continuation-indent} limit, for
76959b77 892parentheses only, forcing them always to line up.
5af23035
S
893
894
797c8ebc 895@defopt idlwave-continuation-indent (@code{2})
5af23035
S
896Extra indentation applied to normal continuation lines.
897@end defopt
898
899@defopt idlwave-max-extra-continuation-indent (@code{20})
900The maximum additional indentation (over the basic continuation-indent)
901that will be permitted for special continues. To effectively disable
902special continuation indentation, set to @code{0}. To enable it
903constantly, set to a large number (like @code{100}). Note that the
904indentation in a long continued statement never decreases from line to
905line, outside of nested parentheses statements.
906@end defopt
907
908@defopt idlwave-indent-to-open-paren (@code{t})
909Non-@code{nil} means indent continuation lines to innermost open
910parenthesis, regardless of whether the
911@code{idlwave-max-extra-continuation-indent} limit is satisfied.
797c8ebc
CD
912@end defopt
913
5af23035 914@node Comment Indentation, Continuation Lines, Continued Statement Indentation, Code Formatting
797c8ebc
CD
915@subsection Comment Indentation
916@cindex Comment indentation
917@cindex Hanging paragraphs
918@cindex Paragraphs, filling
919@cindex Paragraphs, hanging
920
921In IDL, lines starting with a @samp{;} are called @emph{comment lines}.
922Comment lines are indented as follows:
923
924@multitable @columnfractions .1 .90
925@item @code{;;;}
926@tab The indentation of lines starting with three semicolons remains
927unchanged.
928@item @code{;;}
929@tab Lines starting with two semicolons are indented like the surrounding code.
930@item @code{;}
76959b77 931@tab Lines starting with a single semicolon are indented to a minimum column.
797c8ebc
CD
932@end multitable
933
a8e833f3 934@noindent
797c8ebc
CD
935The indentation of comments starting in column 0 is never changed.
936
937@defopt idlwave-no-change-comment
5af23035
S
938The indentation of a comment starting with this regexp will not be
939changed.
797c8ebc
CD
940@end defopt
941
942@defopt idlwave-begin-line-comment
a8e833f3 943A comment anchored at the beginning of line.
797c8ebc
CD
944@end defopt
945
946@defopt idlwave-code-comment
a8e833f3
CD
947A comment that starts with this regexp is indented as if it is a part of
948IDL code.
797c8ebc
CD
949@end defopt
950
951@node Continuation Lines, Syntax Highlighting, Comment Indentation, Code Formatting
952@subsection Continuation Lines and Filling
953@cindex Continuation lines
954@cindex Line splitting
a8e833f3 955@cindex String splitting
797c8ebc 956@cindex Splitting, of lines
797c8ebc 957
a8e833f3 958@kindex M-@key{RET}
797c8ebc
CD
959In IDL, a newline character terminates a statement unless preceded by a
960@samp{$}. If you would like to start a continuation line, use
5af23035
S
961@kbd{M-@key{RET}}, which calls the command @code{idlwave-split-line}.
962It inserts the continuation character @samp{$}, terminates the line and
963indents the new line. The command @kbd{M-@key{RET}} can also be invoked
964inside a string to split it at that point, in which case the @samp{+}
965concatenation operator is used.
797c8ebc 966
a8e833f3
CD
967@cindex Filling
968@cindex @code{auto-fill-mode}
969@cindex Hanging paragraphs
797c8ebc 970When filling comment paragraphs, IDLWAVE overloads the normal filling
5af23035
S
971functions and uses a function which creates the hanging paragraphs
972customary in IDL routine headers. When @code{auto-fill-mode} is turned
973on (toggle with @kbd{C-c C-a}), comments will be auto-filled. If the
974first line of a paragraph contains a match for
975@code{idlwave-hang-indent-regexp} (a dash-space by default), subsequent
976lines are positioned to line up after it, as in the following example.
797c8ebc
CD
977
978@example
5af23035
S
979@group
980;=================================
797c8ebc
CD
981; x - an array containing
982; lots of interesting numbers.
983;
984; y - another variable where
985; a hanging paragraph is used
986; to describe it.
5af23035
S
987;=================================
988@end group
797c8ebc
CD
989@end example
990
a8e833f3 991@kindex M-q
5af23035
S
992You can also refill a comment at any time paragraph with @kbd{M-q}.
993Comment delimiting lines as in the above example, consisting of one or
994more @samp{;} followed by one or more of the characters @samp{+=-_*},
995are kept in place, as is.
797c8ebc
CD
996
997@defopt idlwave-fill-comment-line-only (@code{t})
998Non-@code{nil} means auto fill will only operate on comment lines.
999@end defopt
1000
1001@defopt idlwave-auto-fill-split-string (@code{t})
1002Non-@code{nil} means auto fill will split strings with the IDL @samp{+}
1003operator.
1004@end defopt
1005
1006@defopt idlwave-split-line-string (@code{t})
1007Non-@code{nil} means @code{idlwave-split-line} will split strings with
1008@samp{+}.
1009@end defopt
1010
a8e833f3 1011@defopt idlwave-hanging-indent (@code{t})
797c8ebc
CD
1012Non-@code{nil} means comment paragraphs are indented under the hanging
1013indent given by @code{idlwave-hang-indent-regexp} match in the first
a8e833f3 1014line of the paragraph.
797c8ebc
CD
1015@end defopt
1016
5af23035 1017@defopt idlwave-hang-indent-regexp (@code{"- "})
797c8ebc 1018Regular expression matching the position of the hanging indent
a8e833f3 1019in the first line of a comment paragraph.
797c8ebc
CD
1020@end defopt
1021
1022@defopt idlwave-use-last-hang-indent (@code{nil})
1023Non-@code{nil} means use last match on line for
12b86f0e 1024@code{idlwave-indent-regexp}.
797c8ebc
CD
1025@end defopt
1026
5af23035 1027@node Syntax Highlighting, Octals and Highlighting, Continuation Lines, Code Formatting
797c8ebc
CD
1028@subsection Syntax Highlighting
1029@cindex Syntax highlighting
a8e833f3 1030@cindex Highlighting of syntax
797c8ebc
CD
1031@cindex Font lock
1032
1033Highlighting of keywords, comments, strings etc. can be accomplished
a8e833f3 1034with @code{font-lock}. If you are using @code{global-font-lock-mode}
5af23035
S
1035(in Emacs), or have @code{font-lock} turned on in any other buffer in
1036XEmacs, it should also automatically work in IDLWAVE buffers. If you'd
1037prefer invoking font-lock individually by mode, you can enforce it in
1038@code{idlwave-mode} with the following line in your @file{.emacs}:
797c8ebc
CD
1039
1040@lisp
1041(add-hook 'idlwave-mode-hook 'turn-on-font-lock)
1042@end lisp
1043
5af23035
S
1044@noindent IDLWAVE supports 3 increasing levels of syntax highlighting.
1045The variable @code{font-lock-maximum-decoration} determines which level
1046is selected. Individual categories of special tokens can be selected
1047for highlighting using the variable
1048@code{idlwave-default-font-lock-items}.
797c8ebc
CD
1049
1050@defopt idlwave-default-font-lock-items
1051Items which should be fontified on the default fontification level
12b86f0e 10522.
797c8ebc
CD
1053@end defopt
1054
5af23035
S
1055@node Octals and Highlighting, , Syntax Highlighting, Code Formatting
1056@subsection Octals and Highlighting
1057@cindex Syntax highlighting, Octals
1058@cindex Highlighting of syntax, Octals
1059
12b86f0e
S
1060A rare syntax highlighting problem results from an extremely unfortunate
1061notation for octal numbers in IDL: @code{"123}. This unpaired quotation
1062mark is very difficult to parse, given that it can be mixed on a single
1063line with any number of strings. Emacs will incorrectly identify this
1064as a string, and the highlighting of following lines of code can be
1065distorted, since the string is never terminated.
5af23035
S
1066
1067One solution to this involves terminating the mistakenly identified
1068string yourself by providing a closing quotation mark in a comment:
1069
1070@example
1071 string("305B) + $ ;" <--- for font-lock
1072 ' is an Angstrom.'
1073@end example
1074
1075@noindent A far better solution is to abandon this notation for octals
1076altogether, and use the more sensible alternative IDL provides:
1077
1078@example
1079 string('305'OB) + ' is an Angstrom.'
1080@end example
1081
1082@noindent This simultaneously solves the font-lock problem and is more
1083consistent with the notation for hexadecimal numbers, e.g. @code{'C5'XB}.
1084
a8e833f3 1085@node Routine Info, Online Help, Code Formatting, The IDLWAVE Major Mode
797c8ebc
CD
1086@section Routine Info
1087@cindex Routine info
a8e833f3
CD
1088@cindex Updating routine info
1089@cindex Scanning buffers for routine info
1090@cindex Buffers, scanning for routine info
1091@cindex Shell, querying for routine info
797c8ebc 1092
a8e833f3 1093@kindex C-c C-i
76959b77
S
1094IDL comes bundled with more than one thousand procedures, functions
1095and object methods, and large libraries typically contain hundreds or
1096even thousands more (each with a few to tens of keywords and
1097arguments). This large command set can make it difficult to remember
1098the calling sequence and keywords for the routines you use, but
12b86f0e
S
1099IDLWAVE can help. It builds up routine information from a wide
1100variety of sources; IDLWAVE in fact knows far more about the
1101@samp{.pro} routines on your system than IDL itself! It maintains a
1102list of all built-in routines, with calling sequences and
1103keywords@footnote{This list is created by scanning the IDL manuals and
1104might contain (very few) errors. Please report any errors to the
1105maintainer, so that they can be fixed.}. It also scans Emacs buffers
1106for routine definitions, queries the IDLWAVE-Shell for information
1107about routines currently compiled there, and automatically locates
1108library and user-created catalogs. This information is updated
76959b77
S
1109automatically, and so should usually be current. To force a global
1110update and refresh the routine information, use @kbd{C-c C-i}
1111(@code{idlwave-update-routine-info}).
797c8ebc 1112
a8e833f3 1113@kindex C-c ?
5af23035 1114To display the information about a routine, press @kbd{C-c ?}, which
797c8ebc
CD
1115calls the command @code{idlwave-routine-info}. When the current cursor
1116position is on the name or in the argument list of a procedure or
1117function, information will be displayed about the routine. For example,
5af23035 1118consider the indicated cursor positions in the following line:
797c8ebc
CD
1119
1120@example
1121plot,x,alog(x+5*sin(x) + 2),
5af23035 1122 | | | | | | | |
797c8ebc
CD
1123 1 2 3 4 5 6 7 8
1124@end example
1125
a8e833f3 1126@cindex Default routine, for info and help
797c8ebc
CD
1127On positions 1,2 and 8, information about the @samp{plot} procedure will
1128be shown. On positions 3,4, and 7, the @samp{alog} function will be
5af23035 1129described, while positions 5 and 6 will investigate the @samp{sin}
12b86f0e 1130function.
5af23035 1131
797c8ebc
CD
1132When you ask for routine information about an object method, and the
1133method exists in several classes, IDLWAVE queries for the class of the
5af23035
S
1134object, unless the class is already known through a text property on the
1135@samp{->} operator (@pxref{Object Method Completion and Class
4dc5fe62 1136Ambiguity}), or by having been explicitly included in the call
5af23035 1137(e.g. @code{a->myclass::Foo}).
797c8ebc
CD
1138
1139@cindex Calling sequences
1140@cindex Keywords of a routine
a8e833f3 1141@cindex Routine source information
797c8ebc 1142The description displayed contains the calling sequence, the list of
a8e833f3 1143keywords and the source location of this routine. It looks like this:
797c8ebc
CD
1144
1145@example
a8e833f3
CD
1146Usage: XMANAGER, NAME, ID
1147Keywords: BACKGROUND CATCH CLEANUP EVENT_HANDLER GROUP_LEADER
1148 JUST_REG MODAL NO_BLOCK
12b86f0e 1149Source: SystemLib [LCSB] /soft1/idl53/lib/xmanager.pro
797c8ebc
CD
1150@end example
1151
a8e833f3
CD
1152@cindex Categories, of routines
1153@cindex Load-path shadows
1154@cindex Shadows, load-path
1155@cindex IDL variable @code{!PATH}
1156@cindex @code{!PATH}, IDL variable
1157@cindex IDL variable @code{!DIR}
1158@cindex @code{!DIR}, IDL variable
1159
1160If a definition of this routine exists in several files accessible to
12b86f0e
S
1161IDLWAVE, several @samp{Source} lines will point to the different
1162files. This may indicate that your routine is shadowing a system
1163library routine, which may or may not be what you want
1164(@pxref{Load-Path Shadows}). The information about the calling
1165sequence and keywords is derived from the first source listed.
1166Library routines are available only if you have scanned your local IDL
1167directories or are using pre-scanned libraries (@pxref{Catalogs}).
1168The source entry consists of a @emph{source category}, a set of
1169@emph{flags} and the path to the @emph{source file}. The following
1170default categories exist:
a8e833f3
CD
1171
1172@multitable @columnfractions .15 .85
1173@item @i{System}
5af23035 1174@tab A system routine of unknown origin. When the system library has
12b86f0e
S
1175been scanned as part of a catalog (@pxref{Catalogs}), this category
1176will automatically split into the next two.
a8e833f3 1177@item @i{Builtin}
5af23035 1178@tab A builtin system routine with no source code available.
a8e833f3 1179@item @i{SystemLib}
5af23035 1180@tab A library system routine in the official lib directory @file{!DIR/lib}.
a8e833f3
CD
1181@item @i{Obsolete}
1182@tab A library routine in the official lib directory @file{!DIR/lib/obsolete}.
1183@item @i{Library}
5af23035 1184@tab A routine in a file on IDL's search path @code{!PATH}.
a8e833f3 1185@item @i{Other}
5af23035 1186@tab Any other routine with a file not known to be on the search path.
a8e833f3 1187@item @i{Unresolved}
4dc5fe62 1188@tab An otherwise unknown routine the shell lists as unresolved
5af23035 1189(referenced, but not compiled).
a8e833f3
CD
1190@end multitable
1191
12b86f0e
S
1192Any routines discovered in library catalogs (@pxref{Library
1193Catalogs}), will display the category assigned during creation,
1194e.g. @samp{NasaLib}. For routines not discovered in this way, you can
1195create additional categories based on the routine's filename using the
1196variable @code{idlwave-special-lib-alist}.
a8e833f3
CD
1197
1198@cindex Flags, in routine info
1199@cindex Duplicate routines
1200@cindex Multiply defined routines
1201@cindex Routine definitions, multiple
12b86f0e
S
1202The flags @code{[LCSB]} indicate the source of the information IDLWAVE
1203has regarding the file: from a library catalog (@w{@code{[L---]}}),
1204from a user catalog (@w{@code{[-C--]}}, from the IDL Shell
1205(@w{@code{[--S-]}}) or from an Emacs buffer (@w{@code{[---B]}}).
1206Combinations are possible (a compiled library routine visited in a
1207buffer might read @w{@code{[L-SB]}}). If a file contains multiple
1208definitions of the same routine, the file name will be prefixed with
1209@samp{(Nx)} where @samp{N} is the number of definitions.
a8e833f3
CD
1210
1211@cindex Online Help from the routine info buffer
1212@cindex Active text, in routine info
1213@cindex Inserting keywords, from routine info
1214@cindex Source file, access from routine info
5af23035
S
1215Some of the text in the @file{*Help*} routine info buffer will be active
1216(it is highlighted when the mouse moves over it). Typically, clicking
1217with the right mouse button invokes online help lookup, and clicking
1218with the middle mouse button inserts keywords or visits files:
a8e833f3
CD
1219
1220@multitable @columnfractions 0.15 0.85
1221@item @i{Usage}
1222@tab If online help is installed, a click with the @emph{right} mouse
1223button on the @i{Usage:} line will access the help for the
12b86f0e 1224routine (@pxref{Online Help}).
a8e833f3
CD
1225@item @i{Keyword}
1226@tab Online help about keywords is also available with the
1227@emph{right} mouse button. Clicking on a keyword with the @emph{middle}
1228mouse button will insert this keyword in the buffer from where
1229@code{idlwave-routine-info} was called. Holding down @key{SHIFT} while
1230clicking also adds the initial @samp{/}.
1231@item @i{Source}
1232@tab Clicking with the @emph{middle} mouse button on a @samp{Source} line
1233finds the source file of the routine and visits it in another window.
1234Another click on the same line switches back to the buffer from which
1235@kbd{C-c ?} was called. If you use the @emph{right} mouse button, the
1236source will not be visited by a buffer, but displayed in the online help
1237window.
aea44e56
CD
1238@item @i{Classes}
1239@tab The @i{Classes} line is only included in the routine info window if
1240the current class inherits from other classes. You can click with the
1241@emph{middle} mouse button to display routine info about the current
5af23035
S
1242method in other classes on the inheritance chain, if such a method
1243exists there.
a8e833f3 1244@end multitable
797c8ebc 1245
a8e833f3 1246@defopt idlwave-resize-routine-help-window (@code{t})
5af23035 1247Non-@code{nil} means resize the Routine-info @file{*Help*} window to
a8e833f3
CD
1248fit the content.
1249@end defopt
797c8ebc 1250
a8e833f3
CD
1251@defopt idlwave-special-lib-alist
1252Alist of regular expressions matching special library directories.
1253@end defopt
797c8ebc 1254
a8e833f3
CD
1255@defopt idlwave-rinfo-max-source-lines (@code{5})
1256Maximum number of source files displayed in the Routine Info window.
1257@end defopt
797c8ebc 1258
797c8ebc 1259
4111a42b 1260@html
12b86f0e 1261<A NAME="ONLINE_HELP"></A>
4111a42b 1262@end html
a8e833f3
CD
1263@node Online Help, Completion, Routine Info, The IDLWAVE Major Mode
1264@section Online Help
1265
1266@cindex Online Help
1267@cindex @file{idlw-help.txt}
1268@cindex @file{idlw-help.el}
a8e833f3
CD
1269@cindex Installing online help
1270@cindex Online Help, Installation
1271@cindex Speed, of online help
4111a42b
S
1272@cindex XML Help Catalog
1273
1274For IDL system routines, extensive documentation is supplied with IDL.
1275IDLWAVE can access the HTML version of this documentation very quickly
1276and accurately, based on the local context. This can be @emph{much}
1277faster than using the IDL online help application, because IDLWAVE
1278usually gets you to the right place in the documentation directly ---
1279e.g. a specific keyword of a routine --- without any additional browsing
1280and scrolling.
1281
1282For this online help to work, an HTML version of the IDL documentation
1283is required. Beginning with IDL 6.2, HTML documentation is distributed
1284directly with IDL, along with an XML-based catalog of routine
1285information. By default, IDLWAVE automatically attempts to convert this
1286XML catalog into a format Emacs can more easily understand, and caches
1287this information in your @code{idlwave_config_directory}
1288(@file{~/.idlwave/}, by default). It also re-scans the XML catalog if
1289it is newer than the current cached version. You can force rescan with
1290the menu entry @code{IDLWAVE->Routine Info->Rescan XML Help Catalog}.
1291
1292Before IDL 6.2, the HTML help was not distributed with IDL, and was not
1293part of the standalone IDLWAVE distribution, but had to be downloaded
1294separately. This is no longer necessary: all help and routine
1295information is supplied with IDL versions 6.2 and later.
1296
1297There are a variety of options for displaying the HTML help: see below.
1298Help for routines without HTML documentation is also available, by using
1299the routine documentation header and/or routine source.
76959b77 1300
a8e833f3 1301@kindex M-?
5af23035
S
1302In any IDL program (or, as with most IDLWAVE commands, in the IDL
1303Shell), press @kbd{M-?} (@code{idlwave-context-help}), or click with
32d4cddb 1304@kbd{S-Mouse-3} to access context sensitive online help. The following
5af23035 1305locations are recognized context for help:
a8e833f3
CD
1306
1307@cindex Context, for online help
1308@multitable @columnfractions .25 .75
4111a42b 1309@item @i{Routine names}
a8e833f3 1310@tab The name of a routine (function, procedure, method).
4111a42b 1311@item @i{Keyword Parameters}
5af23035 1312@tab A keyword parameter of a routine.
4111a42b 1313@item @i{System Variables}
5af23035 1314@tab System variables like @code{!DPI}.
12b86f0e
S
1315@item @i{System Variable Tags}
1316@tab System variables tags like @code{!D.X_SIZE}.
4111a42b 1317@item @i{IDL Statements}
5af23035 1318@tab Statements like @code{PRO}, @code{REPEAT}, @code{COMPILE_OPT}, etc.
4111a42b
S
1319@item @i{IDL Controls}
1320@tab Control structures like @code{FOR}, @code{SWITCH}, etc.
1321@item @i{Class names}
5af23035 1322@tab A class name in an @code{OBJ_NEW} call.
4111a42b 1323@item @i{Class Init Keywords}
5af23035 1324@tab Beyond the class name in an @code{OBJ_NEW} call.
a8e833f3 1325@item @i{Executive Command}
5af23035 1326@tab An executive command like @code{.RUN}. Mostly useful in the shell.
76959b77 1327@item @i{Structure Tags}
12b86f0e
S
1328@tab Structure tags like @code{state.xsize}
1329@item @i{Class Tags}
1330@tab Class tags like @code{self.value}.
a8e833f3
CD
1331@item @i{Default}
1332@tab The routine that would be selected for routine info display.
1333@end multitable
1334
1335@cindex @code{OBJ_NEW}, special online help
1336Note that the @code{OBJ_NEW} function is special in that the help
12b86f0e
S
1337displayed depends on the cursor position. If the cursor is on the
1338@samp{OBJ_NEW}, this function is described. If it is on the class
1339name inside the quotes, the documentation for the class is pulled up.
1340If the cursor is @emph{after} the class name, anywhere in the argument
1341list, the documentation for the corresponding @code{Init} method and
1342its keywords is targeted.
1343
1344Apart from an IDLWAVE buffer or shell, there are two more places from
a8e833f3
CD
1345which online help can be accessed.
1346
1347@itemize @bullet
1348@item
1349Online help for routines and keywords can be accessed through the
32d4cddb 1350Routine Info display. Click with @kbd{Mouse-3} on an item to see the
a8e833f3
CD
1351corresponding help (@pxref{Routine Info}).
1352@item
76959b77
S
1353When using completion and Emacs pops up a @file{*Completions*} buffer
1354with possible completions, clicking with @kbd{Mouse-3} on a completion
1355item invokes help on that item (@pxref{Completion}). Items for which
1356help is available in the online system documentation (vs. just the
1357program source itself) will be emphasized (e.g. colored blue).
a8e833f3
CD
1358@end itemize
1359@noindent
12b86f0e
S
1360In both cases, a blue face indicates that the item is documented in
1361the IDL manual, but an attempt will be made to visit non-blue items
1362directly in the originating source file.
1363
1364
1365@menu
1366* Help with HTML Documentation::
1367* Help with Source::
1368@end menu
a8e833f3 1369
12b86f0e
S
1370@node Help with HTML Documentation, Help with Source, Online Help, Online Help
1371@subsection Help with HTML Documentation
1372@cindex HTML Help
1373@cindex Help using HTML manuals
1374@cindex IDL manual, HTML version
4111a42b 1375@cindex IDL Assistant
12b86f0e
S
1376
1377Help using the HTML documentation is invoked with the built-in Emacs
1378command @code{browse-url}, which displays the relevant help topic in a
4111a42b
S
1379browser of your choosing. Beginning with version 6.2, IDL comes with
1380the help browser @emph{IDL Assistant}, which it uses by default for
1381displaying online help on all supported platforms. This browser
1382offers topical searches, an index, and is also now the default and
1383recommended IDLWAVE help browser. The variable
1384@code{idlwave-help-use-assistant} controls whether this browser is
1385used. Note that, due to limitations in the Assistant, invoking help
1386within IDLWAVE and @code{? topic} within IDL will result in two
1387running copies of Assistant.
1388
1389Aside from the IDL Assistant, there are many possible browsers to choose
12b86f0e 1390among, with differing advantages and disadvantages. The variable
4111a42b
S
1391@code{idlwave-help-browser-function} controls which browser help is sent
1392to (as long as @code{idlwave-help-use-assistant} is not set). This
1393function is used to set the variable @code{browse-url-browser-function}
1394locally for IDLWAVE help only. Customize the latter variable to see
1395what choices of browsers your system offers. Certain browsers like
1396@code{w3} (bundled with many versions of Emacs) and @code{w3m}
1397(@uref{http://emacs-w3m.namazu.org/}) are run within Emacs, and use
1398Emacs buffers to display the HTML help. This can be convenient,
1399especially on small displays, and images can even be displayed in-line
1400on newer Emacs versions. However, better formatting results are often
1401achieved with external browsers, like Mozilla. IDLWAVE assumes any
1402browser function containing "w3" is displayed in a local buffer. If you
1403are using another Emacs-local browser for which this is not true, set
1404the variable @code{idlwave-help-browser-is-local}.
1405
1406With IDL 6.2 or later, it is important to ensure that the variable
1407@code{idlwave-system-directory} is set (@pxref{Catalogs}). One easy way
1408to ensure this is to run the IDL Shell (@kbd{C-c C-s}). It will be
1409queried for this directory, and the results will be cached to file for
1410subsequent use.
12b86f0e
S
1411
1412@xref{HTML Help Browser Tips}, for more information on selecting and
1413configuring a browser for use with IDL's HTML help system.
1414
4111a42b
S
1415@defopt idlwave-html-system-help-location @file{help/online_help}
1416Relative directory of the system-supplied HTML help directory,
1417considered with respect to @code{idlwave-system-directory}. Relevant
1418for IDL 6.2 and greater. Should not change.
1419@end defopt
1420
1421@defopt idlwave-html-help-location @file{/usr/local/etc/}
1422The directory where the @file{idl_html_help} HTML directory live.
1423Obsolete and ignored for IDL 6.2 and greater
1424(@code{idlwave-html-system-help-location} is used instead).
12b86f0e
S
1425@end defopt
1426
4111a42b
S
1427@defopt idlwave-help-use-assistant @code{t}
1428If set, use the IDL Assistant if possible for online HTML help,
1429otherwise use the browser function specified in
1430@code{idlwave-help-browser-function}.
12b86f0e
S
1431@end defopt
1432
1433@defopt idlwave-help-browser-function
1434The browser function to use to display IDLWAVE HTML help. Should be
1435one of the functions available for setting
1436@code{browse-url-browser-function}, which see.
1437@end defopt
1438
1439@defopt idlwave-help-browser-is-local
1440Is the browser selected in @code{idlwave-help-browser-function} run in a
4111a42b
S
1441local Emacs buffer or window? Defaults to @code{t} if the function
1442contains "-w3".
12b86f0e
S
1443@end defopt
1444
1445@defopt idlwave-help-link-face
1446The face for links to IDLWAVE online help.
1447@end defopt
1448
1449@node Help with Source, , Help with HTML Documentation, Online Help
1450@subsection Help with Source
1451@cindex Help using routine source
1452
1453@cindex Source code, as online help
1454@cindex DocLib header, as online help
1455For routines which are not documented in an HTML manual (for example
1456personal or library routines), the source code itself is used as help
1457text. If the requested information can be found in a (more or less)
1458standard DocLib file header, IDLWAVE shows the header (scrolling down to
1459a keyword, if appropriate). Otherwise the routine definition statement
1460(@code{pro}/@code{function}) is shown. The doclib header sections which
1461are searched for include @samp{NAME} and @samp{KEYWORDS}. Localization
1462support can be added by customizing the @code{idlwave-help-doclib-name}
1463and @code{idlwave-help-doclib-keyword} variables.
1464
1465@cindex Structure tags, in online help
1466@cindex Class tags, in online help
1467Help is also available for class structure tags (@code{self.TAG}), and
1468generic structure tags, if structure tag completion is enabled
1469(@pxref{Structure Tag Completion}). This is implemented by visiting the
1470tag within the class or structure definition source itself. Help is not
1471available on built-in system class tags.
1472
1473The help window is normally displayed in the same frame, but can be
1474popped-up in a separate frame. The following commands can be used to
1475navigate inside the help system for source files:
a8e833f3
CD
1476
1477@multitable @columnfractions .15 .85
1478@item @kbd{@key{SPACE}}
1479@tab Scroll forward one page.
1480@item @kbd{@key{RET}}
1481@tab Scroll forward one line.
1482@item @kbd{@key{DEL}}
1483@tab Scroll back one page.
a8e833f3
CD
1484@item @kbd{h}
1485@tab Jump to DocLib Header of the routine whose source is displayed
1486as help.
1487@item @kbd{H}
1488@tab Jump to the first DocLib Header in the file.
1489@item @kbd{.} @r{(Dot)}
1490@tab Jump back and forth between the routine definition (the
1491@code{pro}/@code{function} statement) and the description of the help
1492item in the DocLib header.
1493@item @kbd{F}
1494@tab Fontify the buffer like source code. See the variable @code{idlwave-help-fontify-source-code}.
12b86f0e
S
1495@item @kbd{q}
1496@tab Kill the help window.
a8e833f3
CD
1497@end multitable
1498
797c8ebc 1499
12b86f0e 1500@defopt idlwave-help-use-dedicated-frame (@code{nil})
5af23035 1501Non-@code{nil} means use a separate frame for Online Help if possible.
797c8ebc
CD
1502@end defopt
1503
a8e833f3
CD
1504@defopt idlwave-help-frame-parameters
1505The frame parameters for the special Online Help frame.
1506@end defopt
1507
1508@defopt idlwave-max-popup-menu-items (@code{20})
32d4cddb 1509Maximum number of items per pane in pop-up menus.
a8e833f3
CD
1510@end defopt
1511
1512@defopt idlwave-extra-help-function
1513Function to call for help if the normal help fails.
797c8ebc
CD
1514@end defopt
1515
a8e833f3 1516@defopt idlwave-help-fontify-source-code (@code{nil})
5af23035 1517Non-@code{nil} means fontify source code displayed as help.
a8e833f3 1518@end defopt
797c8ebc 1519
a8e833f3 1520@defopt idlwave-help-source-try-header (@code{t})
12b86f0e
S
1521Non-@code{nil} means try to find help in routine header when
1522displaying source file.
a8e833f3
CD
1523@end defopt
1524
12b86f0e
S
1525@defopt idlwave-help-doclib-name (@code{"name"})
1526The case-insensitive heading word in doclib headers to locate the
1527@emph{name} section. Can be a regexp, e.g. @code{"\\(name\\|nom\\)"}.
a8e833f3
CD
1528@end defopt
1529
12b86f0e
S
1530@defopt idlwave-help-doclib-keyword (@code{"KEYWORD"})
1531The case-insensitive heading word in doclib headers to locate the
1532@emph{keywords} section. Can be a regexp.
aea44e56
CD
1533@end defopt
1534
12b86f0e 1535
a8e833f3 1536@node Completion, Routine Source, Online Help, The IDLWAVE Major Mode
797c8ebc
CD
1537@section Completion
1538@cindex Completion
a8e833f3
CD
1539@cindex Keyword completion
1540@cindex Method completion
1541@cindex Object method completion
1542@cindex Class name completion
1543@cindex Function name completion
1544@cindex Procedure name completion
1545
1546@kindex M-@key{TAB}
1547@kindex C-c C-i
5af23035 1548IDLWAVE offers completion for class names, routine names, keywords,
12b86f0e 1549system variables, system variable tags, class structure tags, regular
4111a42b
S
1550structure tags and file names. As in many programming modes, completion
1551is bound to @kbd{M-@key{TAB}} (or simply @kbd{@key{TAB}} in the IDLWAVE
1552Shell --- @pxref{Using the Shell}). Completion uses exactly the same
1553internal information as routine info, so when necessary (rarely) it can
1554be updated with @kbd{C-c C-i} (@code{idlwave-update-routine-info}).
797c8ebc
CD
1555
1556The completion function is context sensitive and figures out what to
4111a42b
S
1557complete based on the location of the point. Here are example lines and
1558what @kbd{M-@key{TAB}} would try to complete when the cursor is on the
5af23035 1559position marked with a @samp{_}:
797c8ebc
CD
1560
1561@example
5af23035
S
1562plo_ @r{Procedure}
1563x = a_ @r{Function}
1564plot,xra_ @r{Keyword of @code{plot} procedure}
1565plot,x,y,/x_ @r{Keyword of @code{plot} procedure}
1566plot,min(_ @r{Keyword of @code{min} function}
1567obj -> a_ @r{Object method (procedure)}
4111a42b 1568a[2,3] = obj -> a_ @r{Object method (function)}
5af23035
S
1569x = obj_new('IDL_ @r{Class name}
1570x = obj_new('MyCl',a_ @r{Keyword to @code{Init} method in class @code{MyCl}}
1571pro A_ @r{Class name}
1572pro _ @r{Fill in @code{Class::} of first method in this file}
1573!v_ @r{System variable}
1574!version.t_ @r{Structure tag of system variable}
1575self.g_ @r{Class structure tag in methods}
1576state.w_ @r{Structure tag, if tag completion enabled}
1577name = 'a_ @r{File name (default inside quotes)}
797c8ebc
CD
1578@end example
1579
5af23035
S
1580@cindex Completion, ambiguity
1581@cindex Completion, forcing function name
1582The only place where completion is ambiguous is procedure/function
76959b77
S
1583@emph{keywords} versus @emph{functions}. After @samp{plot,x,_}, IDLWAVE
1584will always assume a keyword to @samp{plot}. However, a function is
1585also a possible completion here. You can force completion of a function
1586name at such a location by using a prefix arg: @kbd{C-u M-@key{TAB}}.
5af23035 1587
12b86f0e
S
1588Giving two prefix arguments (@kbd{C-u C-u M-@key{TAB}}) prompts for a
1589regular expression to search among the commands to be completed. As
1590an example, completing a blank line in this way will allow you to
1591search for a procedure matching a regexp.
1592
797c8ebc
CD
1593@cindex Scrolling the @file{*Completions*} window
1594@cindex Completion, scrolling
a8e833f3
CD
1595@cindex Completion, Online Help
1596@cindex Online Help in @file{*Completions*} buffer
797c8ebc
CD
1597If the list of completions is too long to fit in the
1598@file{*Completions*} window, the window can be scrolled by pressing
a8e833f3 1599@kbd{M-@key{TAB}} repeatedly. Online help (if installed) for each
32d4cddb 1600possible completion is available by clicking with @kbd{Mouse-3} on the
a8e833f3 1601item. Items for which system online help (from the IDL manual) is
76959b77
S
1602available will be emphasized (e.g. colored blue). For other items, the
1603corresponding source code or DocLib header will be used as the help
1604text.
1605
1606@cindex Completion, cancelling
1607@cindex Cancelling completion
1608Completion is not a blocking operation --- you are free to continue
1609editing, enter commands, or simply ignore the @file{*Completions*}
1610buffer during a completion operation. If, however, the most recent
1611command was a completion, @kbd{C-g} will remove the buffer and restore
1612the window configuration. You can also remove the buffer at any time
1613with no negative consequences.
5af23035
S
1614
1615@defopt idlwave-keyword-completion-adds-equal (@code{t})
1616Non-@code{nil} means completion automatically adds @samp{=} after
1617completed keywords.
1618@end defopt
1619
1620@defopt idlwave-function-completion-adds-paren (@code{t})
1621Non-@code{nil} means completion automatically adds @samp{(} after
1622completed function. A value of `2' means also add the closing
1623parenthesis and position the cursor between the two.
1624@end defopt
1625
1626@defopt idlwave-completion-restore-window-configuration (@code{t})
1627Non-@code{nil} means restore window configuration after successful
1628completion.
1629@end defopt
797c8ebc 1630
5af23035
S
1631@defopt idlwave-highlight-help-links-in-completion (@code{t})
1632Non-@code{nil} means highlight completions for which system help is
1633available.
1634@end defopt
1635
1636@menu
1637* Case of Completed Words:: CaseOFcomPletedWords
1638* Object Method Completion and Class Ambiguity:: obj->Method, what?
12b86f0e 1639* Object Method Completion in the Shell::
5af23035
S
1640* Class and Keyword Inheritance:: obj->Method, _EXTRA=e
1641* Structure Tag Completion:: Completing state.Tag
1642@end menu
1643
1644@node Case of Completed Words, Object Method Completion and Class Ambiguity, Completion, Completion
1645@subsection Case of Completed Words
797c8ebc 1646@cindex Case of completed words
a8e833f3 1647@cindex Mixed case completion
12b86f0e
S
1648IDL is a case-insensitive language, so casing is a matter of style
1649only. IDLWAVE helps maintain a consistent casing style for completed
1650items. The case of the completed words is determined by what is
1651already in the buffer. As an exception, when the partial word being
1652completed is all lower case, the completion will be lower case as
1653well. If at least one character is upper case, the string will be
1654completed in upper case or mixed case, depending on the value of the
1655variable @code{idlwave-completion-case}. The default is to use upper
1656case for procedures, functions and keywords, and mixed case for object
1657class names and methods, similar to the conventions in the IDL
1658manuals. For instance, to enable mixed-case completion for routines
1659in addition to classes and methods, you need an entry such as
1660@code{(routine . preserve)} in that variable. To enable total control
1661over the case of completed items, independent of buffer context, set
1662@code{idlwave-completion-force-default-case} to non-@code{nil}.
797c8ebc
CD
1663
1664@defopt idlwave-completion-case
5af23035
S
1665Association list setting the case (UPPER/lower/Capitalized/MixedCase...)
1666of completed words.
797c8ebc
CD
1667@end defopt
1668
1669@defopt idlwave-completion-force-default-case (@code{nil})
5af23035
S
1670Non-@code{nil} means completion will always honor the settings in
1671@code{idlwave-completion-case}. When nil (the default), entirely lower
1672case strings will always be completed to lower case, no matter what the
1673settings in @code{idlwave-completion-case}.
797c8ebc
CD
1674@end defopt
1675
1676@defopt idlwave-complete-empty-string-as-lower-case (@code{nil})
5af23035 1677Non-@code{nil} means the empty string is considered lower case for
a8e833f3 1678completion.
797c8ebc
CD
1679@end defopt
1680
76959b77 1681@node Object Method Completion and Class Ambiguity, Object Method Completion in the Shell, Case of Completed Words, Completion
5af23035 1682@subsection Object Method Completion and Class Ambiguity
797c8ebc
CD
1683@cindex Object methods
1684@cindex Class ambiguity
a8e833f3 1685@cindex @code{self} object, default class
797c8ebc 1686An object method is not uniquely determined without the object's class.
4111a42b
S
1687Since the class is almost always omitted in the calling source (as
1688required to obtain the true benefits of object-based programming),
1689IDLWAVE considers all available methods in all classes as possible
1690method name completions. The combined list of keywords of the current
1691method in @emph{all} known classes which contain that method will be
1692considered for keyword completion. In the @file{*Completions*} buffer,
1693the matching classes will be shown next to each item (see option
a8e833f3 1694@code{idlwave-completion-show-classes}). As a special case, the class
5af23035 1695of an object called @samp{self} is always taken to be the class of the
4111a42b
S
1696current routine, when in an IDLWAVE buffer. All inherits classes are
1697considered as well.
797c8ebc 1698
a8e833f3
CD
1699@cindex Forcing class query.
1700@cindex Class query, forcing
797c8ebc
CD
1701You can also call @code{idlwave-complete} with a prefix arg: @kbd{C-u
1702M-@key{TAB}}. IDLWAVE will then prompt you for the class in order to
1703narrow down the number of possible completions. The variable
5af23035
S
1704@code{idlwave-query-class} can be configured to make such prompting the
1705default for all methods (not recommended), or selectively for very
1706common methods for which the number of completing keywords would be too
4111a42b 1707large (e.g. @code{Init,SetProperty,GetProperty}).
76959b77
S
1708
1709@cindex Saving object class on @code{->}
1710@cindex @code{->}
1711After you have specified the class for a particular statement (e.g. when
1712completing the method), IDLWAVE can remember it for the rest of the
1713editing session. Subsequent completions in the same statement
1714(e.g. keywords) can then reuse this class information. This works by
1715placing a text property on the method invocation operator @samp{->},
4111a42b
S
1716after which the operator will be shown in a different face (bold by
1717default). The variable @code{idlwave-store-inquired-class} can be used
1718to turn it off or on.
aea44e56 1719
ea442c62 1720@defopt idlwave-completion-show-classes (@code{1})
12b86f0e
S
1721Non-@code{nil} means show up to that many classes in
1722@file{*Completions*} buffer when completing object methods and
1723keywords.
797c8ebc
CD
1724@end defopt
1725
1726@defopt idlwave-completion-fontify-classes (@code{t})
5af23035 1727Non-@code{nil} means fontify the classes in completions buffer.
797c8ebc
CD
1728@end defopt
1729
1730@defopt idlwave-query-class (@code{nil})
a8e833f3 1731Association list governing query for object classes during completion.
797c8ebc
CD
1732@end defopt
1733
4111a42b 1734@defopt idlwave-store-inquired-class (@code{t})
5af23035 1735Non-@code{nil} means store class of a method call as text property on
a8e833f3 1736@samp{->}.
797c8ebc
CD
1737@end defopt
1738
1739@defopt idlwave-class-arrow-face
4111a42b
S
1740Face to highlight object operator arrows @samp{->} which carry a saved
1741class text property.
797c8ebc
CD
1742@end defopt
1743
76959b77
S
1744@node Object Method Completion in the Shell, Class and Keyword Inheritance, Object Method Completion and Class Ambiguity, Completion
1745@subsection Object Method Completion in the Shell
1746@cindex Method Completion in Shell
1747In the IDLWAVE Shell (@pxref{The IDLWAVE Shell}), objects on which
1748methods are being invoked have a special property: they must exist as
1749variables, and so their class can be determined (for instance, using the
1750@code{obj_class()} function). In the Shell, when attempting completion,
1751routine info, or online help within a method routine, a query is sent to
1752determine the class of the object. If this query is successful, the
1753class found will be used to select appropriate completions, routine
1754info, or help. If unsuccessful, information from all known classes will
4111a42b 1755be used (as in the buffer).
76959b77
S
1756
1757@node Class and Keyword Inheritance, Structure Tag Completion, Object Method Completion in the Shell, Completion
5af23035
S
1758@subsection Class and Keyword Inheritance
1759@cindex Inheritance, class
1760@cindex Keyword inheritance
1761@cindex Inheritance, keyword
1762
1763Class inheritance affects which methods are called in IDL. An object of
1764a class which inherits methods from one or more superclasses can
1765override that method by defining its own method of the same name, extend
1766the method by calling the method(s) of its superclass(es) in its
1767version, or inherit the method directly by making no modifications.
1768IDLWAVE examines class definitions during completion and routine
1769information display, and records all inheritance information it finds.
1770This information is displayed if appropriate with the calling sequence
1771for methods (@pxref{Routine Info}), as long as variable
1772@code{idlwave-support-inheritance} is non-@code{nil}.
1773
1774In many class methods, @emph{keyword} inheritance (@code{_EXTRA} and
1775@code{_REF_EXTRA}) is used hand-in-hand with class inheritance and
1776method overriding. E.g., in a @code{SetProperty} method, this technique
1777allows a single call @code{obj->SetProperty} to set properties up the
1778entire class inheritance chain. This is often referred to as
1779@emph{chaining}, and is characterized by chained method calls like
1780@w{@code{self->MySuperClass::SetProperty,_EXTRA=e}}.
1781
4dc5fe62 1782IDLWAVE can accommodate this special synergy between class and keyword
76959b77 1783inheritance: if @code{_EXTRA} or @code{_REF_EXTRA} is detected among a
12b86f0e
S
1784method's keyword parameters, all keywords of superclass versions of
1785the method being considered can be included in completion. There is
1786of course no guarantee that this type of keyword chaining actually
4dc5fe62 1787occurs, but for some methods it's a very convenient assumption. The
12b86f0e
S
1788variable @code{idlwave-keyword-class-inheritance} can be used to
1789configure which methods have keyword inheritance treated in this
1790simple, class-driven way. By default, only @code{Init} and
1791@code{(Get|Set)Property} are. The completion buffer will label
1792keywords based on their originating class.
5af23035
S
1793
1794@defopt idlwave-support-inheritance (@code{t})
1795Non-@code{nil} means consider inheritance during completion, online help etc.
1796@end defopt
1797
12b86f0e 1798@defopt idlwave-keyword-class-inheritance
5af23035
S
1799A list of regular expressions to match methods for which simple
1800class-driven keyword inheritance will be used for Completion.
1801@end defopt
a8e833f3 1802
5af23035
S
1803@node Structure Tag Completion, , Class and Keyword Inheritance, Completion
1804@subsection Structure Tag Completion
1805@cindex Completion, structure tag
1806@cindex Structure tag completion
1807
1808In many programs, especially those involving widgets, large structures
1809(e.g. the @samp{state} structure) are used to communicate among
1810routines. It is very convenient to be able to complete structure tags,
76959b77
S
1811in the same way as for instance variables (tags) of the @samp{self}
1812object (@pxref{Object Method Completion and Class Ambiguity}). Add-in
1813code for structure tag completion is available in the form of a loadable
5af23035
S
1814completion module: @file{idlw-complete-structtag.el}. Tag completion in
1815structures is highly ambiguous (much more so than @samp{self}
76959b77 1816completion), so @code{idlw-complete-structtag} makes an unusual and very
5af23035 1817specific assumption: the exact same variable name is used to refer to
76959b77
S
1818the structure in all parts of the program. This is entirely unenforced
1819by the IDL language, but is a typical convention. If you consistently
5af23035
S
1820refer to the same structure with the same variable name
1821(e.g. @samp{state}), structure tags which are read from its definition
76959b77 1822in the same file can be used for completion.
5af23035
S
1823
1824Structure tag completion is not enabled by default. To enable it,
1825simply add the following to your @file{.emacs}:
1826
1827@lisp
12b86f0e 1828 (add-hook 'idlwave-load-hook
5af23035
S
1829 (lambda () (require 'idlw-complete-structtag)))
1830@end lisp
1831
76959b77 1832Once enabled, you'll also be able to access online help on the structure
4111a42b
S
1833tags, using the usual methods (@pxref{Online Help}). In addition,
1834structure variables in the shell will be queried for tag names, similar
1835to the way object variables in the shell are queried for method names.
1836So, e.g.:
1837
1838@example
1839IDL> st.[Tab]
1840@end example
1841
1842@noindent will complete with all structure fields of the structure
1843@code{st}.
76959b77 1844
5af23035 1845@node Routine Source, Resolving Routines, Completion, The IDLWAVE Major Mode
a8e833f3
CD
1846@section Routine Source
1847@cindex Routine source file
1848@cindex Module source file
1849@cindex Source file, of a routine
1850@kindex C-c C-v
5af23035 1851In addition to clicking on a @i{Source:} line in the routine info
76959b77
S
1852window, there is another way to quickly visit the source file of a
1853routine. The command @kbd{C-c C-v} (@code{idlwave-find-module}) asks
1854for a module name, offering the same default as
1855@code{idlwave-routine-info} would have used, taken from nearby buffer
1856contents. In the minibuffer, specify a complete routine name (including
1857any class part). IDLWAVE will display the source file in another
4111a42b
S
1858window, positioned at the routine in question. You can also limit this
1859to a routine in the current buffer only, with completion, and a
1860context-sensitive default, by using a single prefix (@kbd{C-u C-c C-v})
1861or the convenience binding @kbd{C-c C-t}.
a8e833f3
CD
1862
1863@cindex Buffers, killing
1864@cindex Killing autoloaded buffers
1865Since getting the source of a routine into a buffer is so easy with
1866IDLWAVE, too many buffers visiting different IDL source files are
1867sometimes created. The special command @kbd{C-c C-k}
76959b77
S
1868(@code{idlwave-kill-autoloaded-buffers}) can be used to easily remove
1869these buffers.
a8e833f3
CD
1870
1871@node Resolving Routines, Code Templates, Routine Source, The IDLWAVE Major Mode
1872@section Resolving Routines
1873@cindex @code{RESOLVE_ROUTINE}
1874@cindex Compiling library modules
1875@cindex Routines, resolving
1876
1877The key sequence @kbd{C-c =} calls the command @code{idlwave-resolve}
1878and sends the line @samp{RESOLVE_ROUTINE, '@var{routine_name}'} to IDL
1879in order to resolve (compile) it. The default routine to be resolved is
4111a42b
S
1880taken from context, but you get a chance to edit it. Usually this is
1881not necessary, since IDL automatically discovers routines on its path.
a8e833f3
CD
1882
1883@code{idlwave-resolve} is one way to get a library module within reach
1884of IDLWAVE's routine info collecting functions. A better way is to
12b86f0e
S
1885keep routine information available in catalogs (@pxref{Catalogs}).
1886Routine info on modules will then be available without the need to
1887compile the modules first, and even without a running shell.
a8e833f3 1888
5af23035 1889@xref{Sources of Routine Info}, for more information on the ways IDLWAVE
a8e833f3
CD
1890collects data about routines, and how to update this information.
1891
5af23035 1892@node Code Templates, Abbreviations, Resolving Routines, The IDLWAVE Major Mode
797c8ebc
CD
1893@section Code Templates
1894@cindex Code templates
797c8ebc
CD
1895@cindex Templates
1896
1897IDLWAVE can insert IDL code templates into the buffer. For a few
32d4cddb 1898templates, this is done with direct key bindings:
797c8ebc
CD
1899
1900@multitable @columnfractions .15 .85
1901@item @kbd{C-c C-c}
1902@tab @code{CASE} statement template
1903@item @kbd{C-c C-f}
1904@tab @code{FOR} loop template
1905@item @kbd{C-c C-r}
1906@tab @code{REPEAT} loop template
1907@item @kbd{C-c C-w}
1908@tab @code{WHILE} loop template
1909@end multitable
1910
5af23035
S
1911All code templates are also available as abbreviations
1912(@pxref{Abbreviations}).
1913
1914@node Abbreviations, Actions, Code Templates, The IDLWAVE Major Mode
1915@section Abbreviations
1916@cindex Abbreviations
1917
1918Special abbreviations exist to enable rapid entry of commonly used
1919commands. Emacs abbreviations are expanded by typing text into the
1920buffer and pressing @key{SPC} or @key{RET}. The special abbreviations
1921used to insert code templates all start with a @samp{\} (the backslash),
1922or, optionally, any other character set in
1923@code{idlwave-abbrev-start-char}. IDLWAVE ensures that abbreviations are
1924only expanded where they should be (i.e., not in a string or comment),
1925and permits the point to be moved after an abbreviation expansion ---
1926very useful for positioning the mark inside of parentheses, etc.
1927
1928Special abbreviations are pre-defined for code templates and other
1929useful items. To visit the full list of abbreviations, use @kbd{M-x
797c8ebc
CD
1930idlwave-list-abbrevs}.
1931
5af23035
S
1932Template abbreviations:
1933
797c8ebc
CD
1934@multitable @columnfractions .15 .85
1935@item @code{\pr}
1936@tab @code{PROCEDURE} template
1937@item @code{\fu}
1938@tab @code{FUNCTION} template
1939@item @code{\c}
1940@tab @code{CASE} statement template
1941@item @code{\f}
1942@tab @code{FOR} loop template
1943@item @code{\r}
1944@tab @code{REPEAT} loop template
1945@item @code{\w}
1946@tab @code{WHILE} loop template
1947@item @code{\i}
1948@tab @code{IF} statement template
1949@item @code{\elif}
1950@tab @code{IF-ELSE} statement template
5af23035
S
1951@end multitable
1952
1953String abbreviations:
1954
1955@multitable @columnfractions .15 .85
1956@item @code{\ap}
1957@tab @code{arg_present()}
797c8ebc 1958@item @code{\b}
5af23035
S
1959@tab @code{begin}
1960@item @code{\cb}
1961@tab @code{byte()}
1962@item @code{\cc}
1963@tab @code{complex()}
1964@item @code{\cd}
1965@tab @code{double()}
1966@item @code{\cf}
1967@tab @code{float()}
1968@item @code{\cl}
1969@tab @code{long()}
1970@item @code{\co}
1971@tab @code{common}
1972@item @code{\cs}
1973@tab @code{string()}
1974@item @code{\cx}
1975@tab @code{fix()}
1976@item @code{\e}
1977@tab @code{else}
1978@item @code{\ec}
1979@tab @code{endcase}
1980@item @code{\ee}
1981@tab @code{endelse}
1982@item @code{\ef}
1983@tab @code{endfor}
1984@item @code{\ei}
1985@tab @code{endif else if}
1986@item @code{\el}
1987@tab @code{endif else}
1988@item @code{\en}
1989@tab @code{endif}
1990@item @code{\er}
1991@tab @code{endrep}
1992@item @code{\es}
1993@tab @code{endswitch}
1994@item @code{\ew}
1995@tab @code{endwhile}
1996@item @code{\g}
1997@tab @code{goto,}
1998@item @code{\h}
1999@tab @code{help,}
2000@item @code{\ik}
2001@tab @code{if keyword_set() then}
2002@item @code{\iap}
2003@tab @code{if arg_present() then}
2004@item @code{\ine}
2005@tab @code{if n_elements() eq 0 then}
2006@item @code{\inn}
2007@tab @code{if n_elements() ne 0 then}
2008@item @code{\k}
2009@tab @code{keyword_set()}
2010@item @code{\n}
2011@tab @code{n_elements()}
2012@item @code{\np}
2013@tab @code{n_params()}
2014@item @code{\oi}
2015@tab @code{on_ioerror,}
2016@item @code{\or}
2017@tab @code{openr,}
2018@item @code{\ou}
2019@tab @code{openu,}
2020@item @code{\ow}
2021@tab @code{openw,}
2022@item @code{\p}
2023@tab @code{print,}
2024@item @code{\pt}
2025@tab @code{plot,}
4111a42b
S
2026@item @code{\pv}
2027@tab @code{ptr_valid()}
5af23035
S
2028@item @code{\re}
2029@tab @code{read,}
2030@item @code{\rf}
2031@tab @code{readf,}
2032@item @code{\rt}
2033@tab @code{return}
2034@item @code{\ru}
2035@tab @code{readu,}
2036@item @code{\s}
2037@tab @code{size()}
2038@item @code{\sc}
2039@tab @code{strcompress()}
2040@item @code{\sl}
2041@tab @code{strlowcase()}
2042@item @code{\sm}
2043@tab @code{strmid()}
2044@item @code{\sn}
2045@tab @code{strlen()}
2046@item @code{\sp}
2047@tab @code{strpos()}
2048@item @code{\sr}
2049@tab @code{strtrim()}
2050@item @code{\st}
2051@tab @code{strput()}
2052@item @code{\su}
2053@tab @code{strupcase()}
2054@item @code{\t}
2055@tab @code{then}
2056@item @code{\u}
2057@tab @code{until}
2058@item @code{\wc}
2059@tab @code{widget_control,}
2060@item @code{\wi}
2061@tab @code{widget_info()}
2062@item @code{\wu}
2063@tab @code{writeu,}
797c8ebc 2064@end multitable
ea442c62 2065
5af23035 2066@noindent You can easily add your own abbreviations or override existing
32d4cddb 2067abbrevs with @code{define-abbrev} in your mode hook, using the
5af23035
S
2068convenience function @code{idlwave-define-abbrev}:
2069
2070@lisp
2071(add-hook 'idlwave-mode-hook
2072 (lambda ()
2073 (idlwave-define-abbrev "wb" "widget_base()"
76959b77
S
2074 (idlwave-keyword-abbrev 1))
2075 (idlwave-define-abbrev "ine" "IF N_Elements() EQ 0 THEN"
2076 (idlwave-keyword-abbrev 11))))
5af23035
S
2077@end lisp
2078
2079Notice how the abbreviation (here @emph{wb}) and its expansion
76959b77 2080(@emph{widget_base()}) are given as arguments, and the single argument to
5af23035
S
2081@code{idlwave-keyword-abbrev} (here @emph{1}) specifies how far back to
2082move the point upon expansion (in this example, to put it between the
2083parentheses).
2084
2085The abbreviations are expanded in upper or lower case, depending upon
76959b77
S
2086the variables @code{idlwave-abbrev-change-case} and, for reserved word
2087templates, @code{idlwave-reserved-word-upcase} (@pxref{Case Changes}).
ea442c62 2088
aea44e56 2089@defopt idlwave-abbrev-start-char (@code{"\"})
76959b77
S
2090A single character string used to start abbreviations in abbrev mode.
2091Beware of common characters which might naturally occur in sequence with
2092abbreviation strings.
797c8ebc
CD
2093@end defopt
2094
2095@defopt idlwave-abbrev-move (@code{t})
2096Non-@code{nil} means the abbrev hook can move point, e.g. to end up
76959b77 2097between the parentheses of a function call.
797c8ebc
CD
2098@end defopt
2099
5af23035 2100@node Actions, Doc Header, Abbreviations, The IDLWAVE Major Mode
797c8ebc
CD
2101@section Actions
2102@cindex Actions
2103@cindex Coding standards, enforcing
2104
76959b77
S
2105@emph{Actions} are special formatting commands which are executed
2106automatically while you write code in order to check the structure of
2107the program or to enforce coding standards. Most actions which have
2108been implemented in IDLWAVE are turned off by default, assuming that the
2109average user wants her code the way she writes it. But if you are a
2110lazy typist and want your code to adhere to certain standards, actions
2111can be helpful.
797c8ebc 2112
5af23035 2113Actions can be applied in three ways:
a8e833f3 2114
797c8ebc
CD
2115@itemize @bullet
2116@item
2117Some actions are applied directly while typing. For example, pressing
2118@samp{=} can run a check to make sure that this operator is surrounded
2119by spaces and insert these spaces if necessary. Pressing @key{SPC}
2120after a reserved word can call a command to change the word to upper
a8e833f3 2121case.
797c8ebc
CD
2122@item
2123When a line is re-indented with @key{TAB}, actions can be applied to the
2124entire line. To enable this, the variable @code{idlwave-do-actions}
a8e833f3 2125must be non-@code{nil}.
797c8ebc
CD
2126@item
2127@cindex Foreign code, adapting
2128@cindex Actions, applied to foreign code
5af23035
S
2129Actions can also be applied to a larger piece of code, e.g. to convert
2130foreign code to your own style. To do this, mark the relevant part of
2131the code and execute @kbd{M-x expand-region-abbrevs}. Useful marking
2132commands are @kbd{C-x h} (the entire file) or @kbd{C-M-h} (the current
2133subprogram). @xref{Code Indentation}, for information how to adjust the
2134indentation of the code.
797c8ebc
CD
2135@end itemize
2136
2137@defopt idlwave-do-actions (@code{nil})
12b86f0e
S
2138Non-@code{nil} means performs actions when indenting. Individual action
2139settings are described below and set separately.
797c8ebc
CD
2140@end defopt
2141
2142@menu
76959b77 2143* Block Boundary Check:: Is the END statement correct?
797c8ebc
CD
2144* Padding Operators:: Enforcing space around `=' etc
2145* Case Changes:: Enforcing upper case keywords
2146@end menu
2147
2148@node Block Boundary Check, Padding Operators, Actions, Actions
2149@subsection Block Boundary Check
2150@cindex Block boundary check
2151@cindex @code{END} type checking
2152@cindex @code{END}, automatic insertion
a8e833f3 2153@cindex @code{END}, expanding
797c8ebc
CD
2154@cindex Block, closing
2155@cindex Closing a block
2156
2157Whenever you type an @code{END} statement, IDLWAVE finds the
2158corresponding start of the block and the cursor blinks back to that
2159location for a second. If you have typed a specific @code{END}, like
5af23035 2160@code{ENDIF} or @code{ENDCASE}, you get a warning if that terminator
a8e833f3 2161does not match the type of block it terminates.
797c8ebc
CD
2162
2163Set the variable @code{idlwave-expand-generic-end} in order to have all
5af23035
S
2164generic @code{END} statements automatically expanded to the appropriate
2165type. You can also type @kbd{C-c ]} to close the current block by
2166inserting the appropriate @code{END} statement.
797c8ebc
CD
2167
2168@defopt idlwave-show-block (@code{t})
2169Non-@code{nil} means point blinks to block beginning for
a8e833f3 2170@code{idlwave-show-begin}.
797c8ebc
CD
2171@end defopt
2172
aea44e56 2173@defopt idlwave-expand-generic-end (@code{t})
797c8ebc
CD
2174Non-@code{nil} means expand generic END to ENDIF/ENDELSE/ENDWHILE etc.
2175@end defopt
2176
a8e833f3 2177@defopt idlwave-reindent-end (@code{t})
5af23035 2178Non-@code{nil} means re-indent line after END was typed.
a8e833f3
CD
2179@end defopt
2180
797c8ebc
CD
2181@node Padding Operators, Case Changes, Block Boundary Check, Actions
2182@subsection Padding Operators
2183@cindex Padding operators with spaces
2184@cindex Operators, padding with spaces
a8e833f3 2185@cindex Space, around operators
797c8ebc
CD
2186
2187Some operators can be automatically surrounded by spaces. This can
5af23035 2188happen when the operator is typed, or later when the line is indented.
4111a42b
S
2189IDLWAVE can pad the operators @samp{<}, @samp{>}, @samp{,}, @samp{=},
2190and @samp{->}, as well as the modified assignment operators
2191(@samp{AND=}, @samp{OR=}, etc.). This feature is turned off by default.
2192If you want to turn it on, customize the variables
2193@code{idlwave-surround-by-blank} and @code{idlwave-do-actions} and turn
2194both on. You can also define similar actions for other operators by
2195using the function @code{idlwave-action-and-binding} in the mode hook.
2196For example, to enforce space padding of the @samp{+} and @samp{*}
2197operators (outside of strings and comments, of course), try this in
2198@file{.emacs}
797c8ebc
CD
2199
2200@lisp
2201(add-hook 'idlwave-mode-hook
2202 (lambda ()
2203 (setq idlwave-surround-by-blank t) ; Turn this type of actions on
2204 (idlwave-action-and-binding "*" '(idlwave-surround 1 1))
2205 (idlwave-action-and-binding "+" '(idlwave-surround 1 1))))
2206@end lisp
2207
4111a42b
S
2208Note that the modified assignment operators which begin with a word
2209(@samp{AND=}, @samp{OR=}, @samp{NOT=}, etc.) require a leading space to
4dc5fe62 2210be recognized (e.g @code{vAND=4} would be interpreted as a variable
4111a42b
S
2211@code{vAND}). Also note that, since e.g., @code{>} and @code{>=} are
2212both valid operators, it is impossible to surround both by blanks while
2213they are being typed. Similarly with @code{&} and @code{&&}. For
2214these, a compromise is made: the padding is placed on the left, and if
2215the longer operator is keyed in, on the right as well (otherwise you
2216must insert spaces to pad right yourself, or press simply press Tab to
2217repad everything if @code{idlwave-do-actions} is on).
2218
797c8ebc 2219@defopt idlwave-surround-by-blank (@code{nil})
5af23035 2220Non-@code{nil} means enable @code{idlwave-surround}. If non-@code{nil},
4111a42b
S
2221@samp{=}, @samp{<}, @samp{>}, @samp{&}, @samp{,}, @samp{->}, and the
2222modified assignment operators (@samp{AND=}, @samp{OR=}, etc.) are
a8e833f3 2223surrounded with spaces by @code{idlwave-surround}.
797c8ebc
CD
2224@end defopt
2225
2226@defopt idlwave-pad-keyword (@code{t})
4111a42b 2227Non-@code{nil} means space-pad the @samp{=} in keyword assignments.
797c8ebc
CD
2228@end defopt
2229
2230@node Case Changes, , Padding Operators, Actions
2231@subsection Case Changes
2232@cindex Case changes
a8e833f3
CD
2233@cindex Upcase, enforcing for reserved words
2234@cindex Downcase, enforcing for reserved words
797c8ebc
CD
2235
2236Actions can be used to change the case of reserved words or expanded
2237abbreviations by customizing the variables
2238@code{idlwave-abbrev-change-case} and
2239@code{idlwave-reserved-word-upcase}. If you want to change the case of
2240additional words automatically, put something like the following into
a8e833f3 2241your @file{.emacs} file:
797c8ebc
CD
2242
2243@lisp
2244(add-hook 'idlwave-mode-hook
2245 (lambda ()
2246 ;; Capitalize system vars
2247 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)
2248 ;; Capitalize procedure name
2249 (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
2250 '(capitalize-word 1) t)
2251 ;; Capitalize common block name
12b86f0e 2252 (idlwave-action-and-binding "\\<common\\>[ \t]+\\<"
797c8ebc
CD
2253 '(capitalize-word 1) t)))
2254@end lisp
2255
2256For more information, see the documentation string for the function
5af23035
S
2257@code{idlwave-action-and-binding}. For information on controlling the
2258case of routines, keywords, classes, and methods as they are completed, see
2259@ref{Completion}.
797c8ebc
CD
2260
2261@defopt idlwave-abbrev-change-case (@code{nil})
2262Non-@code{nil} means all abbrevs will be forced to either upper or lower
2cbd16b9 2263case. Valid values are @code{nil}, @code{t}, and @code{down}.
797c8ebc
CD
2264@end defopt
2265
2266@defopt idlwave-reserved-word-upcase (@code{nil})
5af23035 2267Non-@code{nil} means reserved words will be made upper case via abbrev
797c8ebc
CD
2268expansion.
2269@end defopt
2270
2271
2272@node Doc Header, Motion Commands, Actions, The IDLWAVE Major Mode
2273@section Documentation Header
2274@cindex Documentation header
a8e833f3 2275@cindex DocLib header
797c8ebc
CD
2276@cindex Modification timestamp
2277@cindex Header, for file documentation
2278@cindex Timestamp, in doc header.
12b86f0e 2279@cindex Changelog, in doc header.
797c8ebc 2280
a8e833f3
CD
2281@kindex C-c C-h
2282@kindex C-c C-m
797c8ebc 2283The command @kbd{C-c C-h} inserts a standard routine header into the
5af23035
S
2284buffer, with the usual fields for documentation (a different header can
2285be specified with @code{idlwave-file-header}). One of the keywords is
797c8ebc
CD
2286@samp{MODIFICATION HISTORY} under which the changes to a routine can be
2287recorded. The command @kbd{C-c C-m} jumps to the @samp{MODIFICATION
5af23035
S
2288HISTORY} of the current routine or file and inserts the user name with a
2289timestamp.
797c8ebc
CD
2290
2291@defopt idlwave-file-header
2292The doc-header template or a path to a file containing it.
2293@end defopt
2294
5af23035
S
2295@defopt idlwave-header-to-beginning-of-file (@code{nil})
2296Non-@code{nil} means the documentation header will always be at start
2297of file.
2298@end defopt
2299
797c8ebc
CD
2300@defopt idlwave-timestamp-hook
2301The hook function used to update the timestamp of a function.
2302@end defopt
2303
2304@defopt idlwave-doc-modifications-keyword
2305The modifications keyword to use with the log documentation commands.
2306@end defopt
2307
2308@defopt idlwave-doclib-start
2309Regexp matching the start of a document library header.
2310@end defopt
2311
2312@defopt idlwave-doclib-end
2313Regexp matching the start of a document library header.
2314@end defopt
2315
2316@node Motion Commands, Misc Options, Doc Header, The IDLWAVE Major Mode
2317@section Motion Commands
2318@cindex Motion commands
2319@cindex Program structure, moving through
2320@cindex Code structure, moving through
a8e833f3
CD
2321@cindex @file{Func-menu}, XEmacs package
2322@cindex @file{Imenu}, Emacs package
2323@cindex Function definitions, jumping to
2324@cindex Procedure definitions, jumping to
2325
2326IDLWAVE supports both @file{Imenu} and @file{Func-menu}, two packages
2327which make it easy to jump to the definitions of functions and
5af23035
S
2328procedures in the current file with a pop-up selection. To bind
2329@file{Imenu} to a mouse-press, use in your @file{.emacs}:
2330
2331@lisp
2332(define-key global-map [S-down-mouse-3] 'imenu)
2333@end lisp
2334
2335@cindex @file{Speedbar}, Emacs package
797c8ebc 2336
5af23035
S
2337In addition, @file{Speedbar} support allows convenient navigation of a
2338source tree of IDL routine files, quickly stepping to routine
2339definitions. See @code{Tools->Display Speedbar}.
2340
2341Several commands allow you to move quickly through the structure of an
2342IDL program:
797c8ebc
CD
2343
2344@multitable @columnfractions .15 .85
2345@item @kbd{C-M-a}
2346@tab Beginning of subprogram
2347@item @kbd{C-M-e}
2348@tab End of subprogram
2349@item @kbd{C-c @{}
2350@tab Beginning of block (stay inside the block)
2351@item @kbd{C-c @}}
2352@tab End of block (stay inside the block)
718fb8a1 2353@item @kbd{C-M-n}
797c8ebc 2354@tab Forward block (on same level)
718fb8a1 2355@item @kbd{C-M-p}
797c8ebc 2356@tab Backward block (on same level)
718fb8a1 2357@item @kbd{C-M-d}
797c8ebc 2358@tab Down block (enters a block)
718fb8a1 2359@item @kbd{C-M-u}
797c8ebc
CD
2360@tab Backward up block (leaves a block)
2361@item @kbd{C-c C-n}
2362@tab Next Statement
2363@end multitable
2364
2365
2366@node Misc Options, , Motion Commands, The IDLWAVE Major Mode
2367@section Miscellaneous Options
a8e833f3 2368@cindex Hooks
797c8ebc
CD
2369
2370@defopt idlwave-help-application
2371The external application providing reference help for programming.
2372@end defopt
2373
2374@defopt idlwave-startup-message (@code{t})
2375Non-@code{nil} means display a startup message when @code{idlwave-mode}'
2376is first called.
2377@end defopt
2378
2379@defopt idlwave-mode-hook
2380Normal hook. Executed when a buffer is put into @code{idlwave-mode}.
2381@end defopt
2382
2383@defopt idlwave-load-hook
2384Normal hook. Executed when @file{idlwave.el} is loaded.
2385@end defopt
2386
4111a42b 2387@node The IDLWAVE Shell, Acknowledgements, The IDLWAVE Major Mode, Top
797c8ebc
CD
2388@chapter The IDLWAVE Shell
2389@cindex IDLWAVE shell
2390@cindex Major mode, @code{idlwave-shell-mode}
a8e833f3
CD
2391@cindex IDL, as Emacs subprocess
2392@cindex Subprocess of Emacs, IDL
2393@cindex Comint, Emacs package
2394@cindex Windows
2395@cindex MacOS
5af23035
S
2396
2397The IDLWAVE shell is an Emacs major mode which permits running the IDL
2398program as an inferior process of Emacs, and works closely with the
2399IDLWAVE major mode in buffers. It can be used to work with IDL
2400interactively, to compile and run IDL programs in Emacs buffers and to
12b86f0e 2401debug these programs. The IDLWAVE shell is built on @file{comint}, an
5af23035 2402Emacs packages which handles the communication with the IDL program.
4111a42b
S
2403Unfortunately, IDL for Windows does not have command-prompt versions and
2404thus do not allow the interaction with Emacs --- so the IDLWAVE shell
2405currently only works under Unix and MacOSX.
797c8ebc
CD
2406
2407@menu
2408* Starting the Shell:: How to launch IDL as a subprocess
2409* Using the Shell:: Interactively working with the Shell
12b86f0e
S
2410* Commands Sent to the Shell::
2411* Debugging IDL Programs::
2412* Examining Variables::
2413* Custom Expression Examination::
797c8ebc
CD
2414@end menu
2415
2416@node Starting the Shell, Using the Shell, The IDLWAVE Shell, The IDLWAVE Shell
2417@section Starting the Shell
2418@cindex Starting the shell
2419@cindex Shell, starting
2420@cindex Dedicated frame, for shell buffer
2421@cindex Frame, for shell buffer
a8e833f3 2422@cindex Subprocess of Emacs, IDL
797c8ebc 2423
a8e833f3 2424@kindex C-c C-s
797c8ebc
CD
2425The IDLWAVE shell can be started with the command @kbd{M-x
2426idlwave-shell}. In @code{idlwave-mode} the function is bound to
2427@kbd{C-c C-s}. It creates a buffer @file{*idl*} which is used to
12b86f0e
S
2428interact with the shell. If the shell is already running, @kbd{C-c
2429C-s} will simply switch to the shell buffer. The command @kbd{C-c
2430C-l} (@code{idlwave-shell-recenter-shell-window}) displays the shell
2431window without selecting it. The shell can also be started
2432automatically when another command tries to send a command to it. To
2433enable auto start, set the variable
2434@code{idlwave-shell-automatic-start} to @code{t}.
797c8ebc
CD
2435
2436In order to create a separate frame for the IDLWAVE shell buffer, call
2437@code{idlwave-shell} with a prefix argument: @kbd{C-u C-c C-s} or
2438@kbd{C-u C-c C-l}. If you always want a dedicated frame for the shell
2439window, configure the variable
12b86f0e 2440@code{idlwave-shell-use-dedicated-frame}.
797c8ebc 2441
12b86f0e
S
2442To launch a quick IDLWAVE shell directly from a shell prompt without
2443an IDLWAVE buffer (e.g., as a replacement for running inside an
2444xterm), define a system alias with the following content:
5af23035
S
2445
2446@example
2447emacs -geometry 80x32 -eval "(idlwave-shell 'quick)"
2448@end example
797c8ebc 2449
5af23035
S
2450Replace the @samp{-geometry 80x32} option with @samp{-nw} if you prefer
2451the Emacs process to run directly inside the terminal window.
2452
12b86f0e
S
2453@cindex ENVI
2454@cindex IDL> Prompt
2455
2456To use IDLWAVE with ENVI or other custom packages which change the
2457@samp{IDL> } prompt, you must change the
2458@code{idlwave-shell-prompt-pattern}, which defaults to @samp{"^ ?IDL>
2459"}. Normally, you can just replace the @samp{IDL} in this expression
2460with the prompt you see. A suitable pattern which matches the prompt
2461for both ENVI and IDL simultaneously is @samp{"^ ?\\(ENVI\\|IDL\\)> "}.
2462
5af23035 2463@defopt idlwave-shell-explicit-file-name (@file{idl})
797c8ebc
CD
2464This is the command to run IDL.
2465@end defopt
2466
2467@defopt idlwave-shell-command-line-options
2468A list of command line options for calling the IDL program.
2469@end defopt
2470
2471@defopt idlwave-shell-prompt-pattern
2472Regexp to match IDL prompt at beginning of a line.
2473@end defopt
2474
2475@defopt idlwave-shell-process-name
2476Name to be associated with the IDL process.
2477@end defopt
2478
5af23035 2479@defopt idlwave-shell-automatic-start (@code{nil})
797c8ebc
CD
2480Non-@code{nil} means attempt to invoke idlwave-shell if not already
2481running.
2482@end defopt
2483
2484@defopt idlwave-shell-initial-commands
2485Initial commands, separated by newlines, to send to IDL.
2486@end defopt
2487
5af23035
S
2488@defopt idlwave-shell-save-command-history (@code{t})
2489Non-@code{nil} means preserve command history between sessions.
2490@end defopt
2491
12b86f0e 2492@defopt idlwave-shell-command-history-file (@file{~/.idlwave/.idlwhist})
5af23035 2493The file in which the command history of the idlwave shell is saved.
12b86f0e
S
2494Unless it's an absolute path, it goes in
2495@code{idlwave-config-directory}.
5af23035 2496@end defopt
12b86f0e 2497
797c8ebc 2498@defopt idlwave-shell-use-dedicated-frame (@code{nil})
12b86f0e 2499Non-@code{nil} means IDLWAVE should use a special frame to display the
177c0ea7 2500shell buffer.
797c8ebc
CD
2501@end defopt
2502
4111a42b
S
2503@defopt idlwave-shell-use-dedicated-window (@code{nil})
2504Non-@code{nil} means use a dedicated window for the shell, taking care
2505not it replace it with other buffers.
2506@end defopt
2507
797c8ebc
CD
2508@defopt idlwave-shell-frame-parameters
2509The frame parameters for a dedicated idlwave-shell frame.
2510@end defopt
2511
5af23035
S
2512@defopt idlwave-shell-raise-frame (@code{t})
2513Non-@code{nil} means `idlwave-shell' raises the frame showing the shell
2514window.
2515@end defopt
2516
797c8ebc 2517@defopt idlwave-shell-temp-pro-prefix
a8e833f3 2518The prefix for temporary IDL files used when compiling regions.
797c8ebc
CD
2519@end defopt
2520
a8e833f3 2521@cindex Hooks
797c8ebc
CD
2522@defopt idlwave-shell-mode-hook
2523Hook for customizing @code{idlwave-shell-mode}.
2524@end defopt
2525
76959b77 2526@node Using the Shell, Commands Sent to the Shell, Starting the Shell, The IDLWAVE Shell
797c8ebc 2527@section Using the Shell
a8e833f3 2528@cindex Comint
797c8ebc
CD
2529@cindex Shell, basic commands
2530
2531The IDLWAVE shell works in the same fashion as other shell modes in
2532Emacs. It provides command history, command line editing and job
aea44e56
CD
2533control. The @key{UP} and @key{DOWN} arrows cycle through the input
2534history just like in an X terminal@footnote{This is different from
2535normal Emacs/Comint behavior, but more like an xterm. If you prefer the
2536default comint functionality, check the variable
5af23035
S
2537@code{idlwave-shell-arrows-do-history}.}. The history is preserved
2538between emacs and IDL sessions. Here is a list of commonly used
2539commands:
797c8ebc
CD
2540
2541@multitable @columnfractions .12 .88
76959b77 2542@item @key{UP}, @key{M-p}
aea44e56 2543@tab Cycle backwards in input history
76959b77 2544@item @key{DOWN}, @key{M-n}
aea44e56 2545@tab Cycle forwards in input history
797c8ebc
CD
2546@item @kbd{M-r}
2547@tab Previous input matching a regexp
2548@item @kbd{M-s}
76959b77 2549@tab Next input matching a regexp
797c8ebc
CD
2550@item @kbd{return}
2551@tab Send input or copy line to current prompt
2552@item @kbd{C-c C-a}
2553@tab Beginning of line; skip prompt
2554@item @kbd{C-c C-u}
2555@tab Kill input to beginning of line
2556@item @kbd{C-c C-w}
2557@tab Kill word before cursor
2558@item @kbd{C-c C-c}
2559@tab Send ^C
2560@item @kbd{C-c C-z}
2561@tab Send ^Z
2562@item @kbd{C-c C-\}
2563@tab Send ^\
2564@item @kbd{C-c C-o}
2565@tab Delete last batch of process output
2566@item @kbd{C-c C-r}
2567@tab Show last batch of process output
2568@item @kbd{C-c C-l}
2569@tab List input history
2570@end multitable
2571
2572In addition to these standard @file{comint} commands,
76959b77
S
2573@code{idlwave-shell-mode} provides many of the same commands which
2574simplify writing IDL code available in IDLWAVE buffers. This includes
2575abbreviations, online help, and completion. See @ref{Routine Info} and
2576@ref{Online Help} and @ref{Completion} for more information on these
2577commands.
a8e833f3
CD
2578
2579@cindex Completion, in the shell
2580@cindex Routine info, in the shell
2581@cindex Online Help, in the shell
797c8ebc
CD
2582@multitable @columnfractions .12 .88
2583@item @kbd{@key{TAB}}
5af23035
S
2584@tab Completion of file names (between quotes and after executive
2585commands @samp{.run} and @samp{.compile}), routine names, class names,
2586keywords, system variables, system variable tags etc.
2587(@code{idlwave-shell-complete}).
797c8ebc
CD
2588@item @kbd{M-@key{TAB}}
2589@tab Same as @key{TAB}
2590@item @kbd{C-c ?}
2591@tab Routine Info display (@code{idlwave-routine-info})
2592@item @kbd{M-?}
2593@tab IDL online help on routine (@code{idlwave-routine-info-from-idlhelp})
2594@item @kbd{C-c C-i}
2595@tab Update routine info from buffers and shell
2596(@code{idlwave-update-routine-info})
2597@item @kbd{C-c C-v}
2598@tab Find the source file of a routine (@code{idlwave-find-module})
4111a42b
S
2599@item @kbd{C-c C-t}
2600@tab Find the source file of a routine in the currently visited file
2601(@code{idlwave-find-module-this-file}).
797c8ebc
CD
2602@item @kbd{C-c =}
2603@tab Compile a library routine (@code{idlwave-resolve})
2604@end multitable
2605
aea44e56
CD
2606@defopt idlwave-shell-arrows-do-history (@code{t})
2607Non-@code{nil} means @key{UP} and @key{DOWN} arrows move through command
2608history like xterm.
2609@end defopt
2610
5af23035
S
2611@defopt idlwave-shell-comint-settings
2612Alist of special settings for the comint variables in the IDLWAVE Shell.
2613@end defopt
2614
797c8ebc
CD
2615@defopt idlwave-shell-file-name-chars
2616The characters allowed in file names, as a string. Used for file name
a8e833f3
CD
2617completion.
2618@end defopt
2619
aea44e56
CD
2620@defopt idlwave-shell-graphics-window-size
2621Size of IDL graphics windows popped up by special IDLWAVE command.
2622@end defopt
2623
a8e833f3
CD
2624@cindex Input mode
2625@cindex Character input mode (Shell)
2626@cindex Line input mode (Shell)
2627@cindex Magic spells, for input mode
2628@cindex Spells, magic
2629IDLWAVE works in line input mode: You compose a full command line, using
2630all the power Emacs gives you to do this. When you press @key{RET}, the
2631whole line is sent to IDL. Sometimes it is necessary to send single
2632characters (without a newline), for example when an IDL program is
2633waiting for single character input with the @code{GET_KBRD} function.
2634You can send a single character to IDL with the command @kbd{C-c C-x}
2635(@code{idlwave-shell-send-char}). When you press @kbd{C-c C-y}
2636(@code{idlwave-shell-char-mode-loop}), IDLWAVE runs a blocking loop
2637which accepts characters and immediately sends them to IDL. The loop
2638can be exited with @kbd{C-g}. It terminates also automatically when the
2639current IDL command is finished. Check the documentation of the two
2640variables described below for a way to make IDL programs trigger
2641automatic switches of the input mode.
2642
2643@defopt idlwave-shell-use-input-mode-magic (@code{nil})
5af23035
S
2644Non-@code{nil} means IDLWAVE should check for input mode spells in
2645output.
a8e833f3
CD
2646@end defopt
2647
2648@defopt idlwave-shell-input-mode-spells
2649The three regular expressions which match the magic spells for input
2650modes.
797c8ebc
CD
2651@end defopt
2652
76959b77
S
2653@node Commands Sent to the Shell, Debugging IDL Programs, Using the Shell, The IDLWAVE Shell
2654@section Commands Sent to the Shell
2655@cindex Commands in shell, showing
2656@cindex Showing commands in shell
2657
2658The IDLWAVE buffers and shell interact very closely. In addition to the
2659normal commands you enter at the @code{IDL>} prompt, many other special
2660commands are sent to the shell, sometimes as a direct result of invoking
2661a key command, menu item, or toolbar button, but also automatically, as
2662part of the normal flow of information updates between the buffer and
2663shell.
2664
2665The commands sent include @code{breakpoint}, @code{.step} and other
2666debug commands (@pxref{Debugging IDL Programs}), @code{.run} and other
2667compilation statements (@pxref{Compiling Programs}), examination
2668commands like @code{print} and @code{help} (@pxref{Examining
2669Variables}), and other special purpose commands designed to keep
2670information on the running shell current.
2671
2672By default, much of this background shell input and output is hidden
2673from the user, but this is configurable. The custom variable
2674@code{idlwave-abbrev-show-commands} allows you to configure which
2675commands sent to the shell are shown there. For a related customization
12b86f0e 2676for separating the output of @emph{examine} commands, see @ref{Examining
76959b77
S
2677Variables}.
2678
2679@defopt idlwave-shell-show-commands (@code{'(run misc breakpoint)})
2680A list of command types to echo in the shell when sent. Possible values
2681are @code{run} for @code{.run}, @code{.compile} and other run commands,
12b86f0e
S
2682@code{misc} for lesser used commands like @code{window},
2683@code{retall},@code{close}, etc., @code{breakpoint} for breakpoint
2684setting and clearing commands, and @code{debug} for other debug,
2685stepping, and continue commands. In addition, if the variable is set to
2686the single symbol @code{'everything}, all the copious shell input is
2687displayed (which is probably only useful for debugging purposes).
2688N.B. For hidden commands which produce output by side-effect, that
2689output remains hidden (e.g., stepping through a @code{print} command).
2690As a special case, any error message in the output will be displayed
2691(e.g., stepping to an error).
76959b77
S
2692@end defopt
2693
2694@node Debugging IDL Programs, Examining Variables, Commands Sent to the Shell, The IDLWAVE Shell
797c8ebc
CD
2695@section Debugging IDL Programs
2696@cindex Debugging
2697@cindex Keybindings for debugging
2698@cindex Toolbar
2699
2700Programs can be compiled, run, and debugged directly from the source
12b86f0e
S
2701buffer in Emacs, walking through arbitrarily deeply nested code,
2702printing expressions and skipping up and down the calling stack along
2703the way. IDLWAVE makes compiling and debugging IDL programs far less
2704cumbersome by providing a full-featured, key/menu/toolbar-driven
2705interface to commands like @code{breakpoint}, @code{.step},
2706@code{.run}, etc. It can even perform complex debug operations not
2707natively supported by IDL (like continuing to the line at the cursor).
2708
2709The IDLWAVE shell installs key bindings both in the shell buffer and
2710in all IDL code buffers of the current Emacs session, so debug
2711commands work in both places (in the shell, commands operate on the
2712last file compiled). On Emacs versions which support it, a debugging
2713toolbar is also installed. The toolbar display can be toggled with
2714@kbd{C-c C-d C-t} (@code{idlwave-shell-toggle-toolbar}).
2715
76959b77
S
2716
2717@defopt idlwave-shell-use-toolbar (@code{t})
2718Non-@code{nil} means use the debugging toolbar in all IDL related
2719buffers.
2720@end defopt
2721
2722@menu
12b86f0e
S
2723* A Tale of Two Modes::
2724* Debug Key Bindings::
2725* Breakpoints and Stepping::
2726* Compiling Programs::
2727* Walking the Calling Stack::
2728* Electric Debug Mode::
76959b77
S
2729@end menu
2730
12b86f0e
S
2731
2732@node A Tale of Two Modes, Debug Key Bindings, Debugging IDL Programs, Debugging IDL Programs
2733@subsection A Tale of Two Modes
2734@cindex Electric Debug Mode
2735@cindex Debugging Interface
2736
2737The many debugging, compiling, and examination commands provided in
2738IDLWAVE are available simultaneously through two different interfaces:
2739the original, multi-key command interface, and the new Electric Debug
16f2cab7
S
2740Mode. The functionality they offer is similar, but the way you interact
2741with them is quite different. The main difference is that, in Electric
2742Debug Mode, the source buffers are made read-only, and single
2743key-strokes are used to step through, examine expressions, set and
2744remove breakpoints, etc. The same variables, prefix arguments, and
2745settings apply to both versions, and both can be used interchangeably.
2746By default, when breakpoints are hit, Electric Debug Mode is enabled.
2747The traditional interface is described first. @xref{Electric Debug
2748Mode}, for more on that mode. Note that electric debug mode can be
2749prevented from activating automatically by customizing the variable
2750@code{idlwave-shell-automatic-electric-debug}.
12b86f0e
S
2751
2752@node Debug Key Bindings, Breakpoints and Stepping, A Tale of Two Modes, Debugging IDL Programs
76959b77
S
2753@subsection Debug Key Bindings
2754@kindex C-c C-d
2755@cindex Key bindings
797c8ebc 2756
12b86f0e
S
2757The standard debugging key bindings are always available by default on
2758the prefix key @kbd{C-c C-d}, so, for example, setting a breakpoint is
2759done with @kbd{C-c C-d C-b}, and compiling a source file with @kbd{C-c
2760C-d C-c}. You can also easily configure IDLWAVE to use one or more
76959b77
S
2761modifier keys not in use by other commands, in lieu of the prefix
2762@kbd{C-c C-d} (though these bindings will typically also be available
12b86f0e
S
2763--- see @code{idlwave-shell-activate-prefix-keybindings}). For
2764example, if you include in @file{.emacs}:
aea44e56
CD
2765
2766@lisp
2767(setq idlwave-shell-debug-modifiers '(control shift))
2768@end lisp
2769
12b86f0e 2770@noindent a breakpoint can then be set by pressing @kbd{b} while holding down
aea44e56 2771@kbd{shift} and @kbd{control} keys, i.e. @kbd{C-S-b}. Compiling a
5af23035 2772source file will be on @kbd{C-S-c}, deleting a breakpoint @kbd{C-S-d},
12b86f0e
S
2773etc. In the remainder of this chapter we will assume that the
2774@kbd{C-c C-d} bindings are active, but each of these bindings will
2775have an equivalent shortcut if modifiers are given in the
2776@code{idlwave-shell-debug-modifiers} variable (@pxref{Lesson II --
2777Customization}). A much simpler and faster form of debugging for
2778running code is also available by default --- see @ref{Electric Debug
2779Mode}.
797c8ebc 2780
a8e833f3 2781@defopt idlwave-shell-prefix-key (@kbd{C-c C-d})
797c8ebc 2782The prefix key for the debugging map
a8e833f3 2783@code{idlwave-shell-mode-prefix-map}.
797c8ebc
CD
2784@end defopt
2785
2786@defopt idlwave-shell-activate-prefix-keybindings (@code{t})
5af23035 2787Non-@code{nil} means debug commands will be bound to the prefix
797c8ebc
CD
2788key, like @kbd{C-c C-d C-b}.
2789@end defopt
2790
aea44e56 2791@defopt idlwave-shell-debug-modifiers (@code{nil})
12b86f0e
S
2792List of modifier keys to use for additional, alternative binding of
2793debugging commands in the shell and source buffers. Can be one or
2794more of @code{control}, @code{meta}, @code{super}, @code{hyper},
2795@code{alt}, and @code{shift}.
797c8ebc
CD
2796@end defopt
2797
12b86f0e 2798@node Breakpoints and Stepping, Compiling Programs, Debug Key Bindings, Debugging IDL Programs
797c8ebc
CD
2799@subsection Breakpoints and Stepping
2800@cindex Breakpoints
2801@cindex Stepping
a8e833f3 2802@cindex Execution, controlled
797c8ebc 2803
a8e833f3
CD
2804@kindex C-c C-d C-b
2805@kindex C-c C-d C-b
12b86f0e
S
2806IDLWAVE helps you set breakpoints and step through code. Setting a
2807breakpoint in the current line of the source buffer is accomplished
2808with @kbd{C-c C-d C-b} (@code{idlwave-shell-break-here}). With a
2809prefix arg of 1 (i.e. @kbd{C-1 C-c C-d C-b}), the breakpoint gets a
76959b77 2810@code{/ONCE} keyword, meaning that it will be deleted after first use.
12b86f0e
S
2811With a numeric prefix greater than one (e.g. @kbd{C-4 C-c C-d C-b}),
2812the breakpoint will only be active the @code{nth} time it is hit.
2813With a single non-numeric prefix (i.e. @kbd{C-u C-c C-d C-b}), prompt
4dc5fe62 2814for a condition --- an IDL expression to be evaluated and trigger the
76959b77 2815breakpoint only if true. To clear the breakpoint in the current line,
12b86f0e
S
2816use @kbd{C-c C-d C-d} (@code{idlwave-clear-current-bp}). When
2817executed from the shell window, the breakpoint where IDL is currently
2818stopped will be deleted. To clear all breakpoints, use @kbd{C-c C-d
2819C-a} (@code{idlwave-clear-all-bp}). Breakpoints can also be disabled
2820and re-enabled: @kbd{C-c C-d C-\}
2821(@code{idlwave-shell-toggle-enable-current-bp}).
2822
4111a42b
S
2823Breakpoint lines are highlighted or indicated with an icon in the source
2824code (different icons for conditional, after, and other break types).
2825Disabled breakpoints are @emph{grayed out} by default. Note that IDL
2826places breakpoints as close as possible on or after the line you
2827specify. IDLWAVE queries the shell for the actual breakpoint location
2828which was set, so the exact line you specify may not be marked. You can
2829re-sync the breakpoint list and update the display at any time (e.g., if
2830you add or remove some on the command line) using @kbd{C-c C-d C-l}.
2831
2832In recent IDLWAVE versions, the breakpoint line is highlighted when the
2833mouse is moved over it, and a tooltip pops up describing the break
2834details. @kbd{Mouse-3} on the breakpoint line pops up a menu of
2835breakpoint actions, including clearing, disabling, and adding or
2836changing break conditions or ``after'' break count.
5af23035
S
2837
2838Once the program has stopped somewhere, you can step through it. The
2839most important stepping commands are @kbd{C-c C-d C-s} to execute one
2840line of IDL code ("step into"); @kbd{C-c C-d C-n} to step a single line,
2841treating procedure and function calls as a single step ("step over");
2842@kbd{C-c C-d C-h} to continue execution to the line at the cursor and
76959b77
S
2843@kbd{C-c C-d C-r} to continue execution. @xref{Commands Sent to the
2844Shell}, for information on displaying or hiding the breakpoint and
2845stepping commands the shell receives. Here is a summary of the
5af23035 2846breakpoint and stepping commands:
797c8ebc 2847
a8e833f3 2848@multitable @columnfractions .23 .77
797c8ebc
CD
2849@item @kbd{C-c C-d C-b}
2850@tab Set breakpoint (@code{idlwave-shell-break-here})
2851@item @kbd{C-c C-d C-i}
4111a42b 2852@tab Set breakpoint in module named here (@code{idlwave-shell-break-in})
797c8ebc
CD
2853@item @kbd{C-c C-d C-d}
2854@tab Clear current breakpoint (@code{idlwave-shell-clear-current-bp})
2855@item @kbd{C-c C-d C-a}
2856@tab Clear all breakpoints (@code{idlwave-shell-clear-all-bp})
12b86f0e
S
2857@item @kbd{C-c C-d [}
2858@tab Go to the previous breakpoint (@code{idlwave-shell-goto-previous-bp})
2859@item @kbd{C-c C-d ]}
2860@tab Go to the next breakpoint (@code{idlwave-shell-goto-next-bp})
2861@item @kbd{C-c C-d C-\}
2862@tab Disable/Enable current breakpoint (@code{idlwave-shell-toggle-enable-current-bp})
2863@item @kbd{C-c C-d C-j}
2864@tab Set a breakpoint at the beginning of the enclosing routine.
797c8ebc
CD
2865@item @kbd{C-c C-d C-s}
2866@tab Step, into function calls (@code{idlwave-shell-step})
2867@item @kbd{C-c C-d C-n}
2868@tab Step, over function calls (@code{idlwave-shell-stepover})
2869@item @kbd{C-c C-d C-k}
2870@tab Skip one statement (@code{idlwave-shell-skip})
2871@item @kbd{C-c C-d C-u}
2872@tab Continue to end of block (@code{idlwave-shell-up})
2873@item @kbd{C-c C-d C-m}
2874@tab Continue to end of function (@code{idlwave-shell-return})
2875@item @kbd{C-c C-d C-o}
2876@tab Continue past end of function (@code{idlwave-shell-out})
2877@item @kbd{C-c C-d C-h}
2878@tab Continue to line at cursor position (@code{idlwave-shell-to-here})
2879@item @kbd{C-c C-d C-r}
12b86f0e 2880@tab Continue execution to next breakpoint, if any (@code{idlwave-shell-cont})
797c8ebc
CD
2881@item @kbd{C-c C-d C-up}
2882@tab Show higher level in calling stack (@code{idlwave-shell-stack-up})
2883@item @kbd{C-c C-d C-down}
2884@tab Show lower level in calling stack (@code{idlwave-shell-stack-down})
2885@end multitable
2886
12b86f0e 2887All of these commands have equivalents in Electric Debug Mode, which
4111a42b
S
2888provides faster single-key access (@pxref{Electric Debug Mode}).
2889
2890The line where IDL is currently stopped, at breakpoints, halts, and
2891errors, etc., is marked with a color overlay or arrow, depending on the
2892setting in @code{idlwave-shell-mark-stop-line}. If an overlay face is
2893used to mark the stop line (as it is by default), when stepping through
2894code, the face color is temporarily changed to gray, until IDL completes
2895the next command and moves to the new line.
12b86f0e 2896
797c8ebc 2897@defopt idlwave-shell-mark-breakpoints (@code{t})
5af23035 2898Non-@code{nil} means mark breakpoints in the source file buffers. The
2cbd16b9 2899value indicates the preferred method. Valid values are @code{nil},
797c8ebc
CD
2900@code{t}, @code{face}, and @code{glyph}.
2901@end defopt
2902
2903@defopt idlwave-shell-breakpoint-face
2904The face for breakpoint lines in the source code if
a8e833f3 2905@code{idlwave-shell-mark-breakpoints} has the value @code{face}.
797c8ebc
CD
2906@end defopt
2907
4111a42b
S
2908@defopt idlwave-shell-breakpoint-popup-menu (@code{t})
2909Whether to pop-up a menu and present a tooltip description on
2910breakpoint lines.
2911@end defopt
2912
2913@defopt idlwave-shell-mark-stop-line (@code{t})
2914Non-@code{nil} means mark the source code line where IDL is currently
2915stopped. The value specifies the preferred method. Valid values are
2916@code{nil}, @code{t}, @code{arrow}, and @code{face}.
2917@end defopt
2918
2919@defopt idlwave-shell-overlay-arrow (@code{">"})
2920The overlay arrow to display at source lines where execution halts, if
2921configured in @code{idlwave-shell-mark-stop-line}.
2922@end defopt
2923
2924@defopt idlwave-shell-stop-line-face
2925The face which highlights the source line where IDL is stopped, if
2926configured in @code{idlwave-shell-mark-stop-line}.
2927@end defopt
2928
2929
12b86f0e
S
2930@node Compiling Programs, Walking the Calling Stack, Breakpoints and Stepping, Debugging IDL Programs
2931@subsection Compiling Programs
2932@cindex Compiling programs
2933@cindex Programs, compiling
2934@cindex Default command line, executing
2935@cindex Executing a default command line
2936
2937@kindex C-c C-d C-c
2938In order to compile the current buffer under the IDLWAVE shell, press
2939@kbd{C-c C-d C-c} (@code{idlwave-save-and-run}). This first saves the
2940current buffer and then sends the command @samp{.run path/to/file} to the
2941shell. You can also execute @kbd{C-c C-d C-c} from the shell buffer, in
2942which case the most recently compiled buffer will be saved and
2943re-compiled.
2944
2945When developing or debugging a program, it is often necessary to execute
2946the same command line many times. A convenient way to do this is
2947@kbd{C-c C-d C-y} (@code{idlwave-shell-execute-default-command-line}).
2948This command first resets IDL from a state of interrupted execution by
2949closing all files and returning to the main interpreter level. Then a
2950default command line is send to the shell. To edit the default command
2951line, call @code{idlwave-shell-execute-default-command-line} with a
2952prefix argument: @kbd{C-u C-c C-d C-y}. If no default command line has
2953been set (or you give two prefix arguments), the last command on the
2954@code{comint} input history is sent.
2955
12b86f0e 2956@node Walking the Calling Stack, Electric Debug Mode, Compiling Programs, Debugging IDL Programs
5af23035
S
2957@subsection Walking the Calling Stack
2958@cindex Calling stack, walking
2959
2960While debugging a program, it can be very useful to check the context in
2961which the current routine was called, for instance to help understand
2962the value of the arguments passed. To do so conveniently you need to
2963examine the calling stack. If execution is stopped somewhere deep in a
2964program, you can use the commands @kbd{C-c C-d C-@key{UP}}
2965(@code{idlwave-shell-stack-up}) and @kbd{C-c C-d C-@key{DOWN}}
2966(@code{idlwave-shell-stack-down}), or the corresponding toolbar buttons,
2967to move up or down through the calling stack. The mode line of the
2968shell window will indicate the position within the stack with a label
2969like @samp{[-3:MYPRO]}. The line of IDL code at that stack position
2970will be highlighted. If you continue execution, IDLWAVE will
2971automatically return to the current level. @xref{Examining Variables},
2972for information how to examine the value of variables and expressions on
2973higher calling stack levels.
2974
4111a42b 2975@html
12b86f0e 2976<A NAME="EDEBUG"></A>
4111a42b 2977@end html
12b86f0e
S
2978@node Electric Debug Mode, , Walking the Calling Stack, Debugging IDL Programs
2979@subsection Electric Debug Mode
2980@cindex Electric Debug Mode
2981@cindex @samp{*Debugging*}
2982
2983Even with a convenient debug key prefix enabled, repetitive stepping,
4111a42b
S
2984variable examination (@pxref{Examining Variables}), and other debugging
2985activities can be awkward and slow using commands which require multiple
2986keystrokes. Luckily, there's a better way, inspired by the lisp e-debug
2987mode, and available through the @emph{Electric Debug Mode}. By default,
2988as soon as a breakpoint is hit, this minor mode is enabled. The buffer
2989showing the line where execution has halted is switched to Electric
2990Debug Mode. This mode is visible as @samp{*Debugging*} in the mode
2991line, and a different face (violet by default, if color is available)
2992for the line stopped at point. The buffer is made read-only and
2993single-character bindings for the most commonly used debugging commands
2994are enabled. These character commands (a list of which is available
2995with @kbd{C-?}) are:
12b86f0e
S
2996
2997@multitable @columnfractions .2 .8
2998@item @kbd{a}
2999@tab Clear all breakpoints (@code{idlwave-shell-clear-all-bp})
3000@item @kbd{b}
3001@tab Set breakpoint, @kbd{C-u b} for a conditional break, @kbd{C-n b} for nth hit (@code{idlwave-shell-break-here})
3002@item @kbd{d}
3003@tab Clear current breakpoint (@code{idlwave-shell-clear-current-bp})
4111a42b
S
3004@item @kbd{e}
3005@tab Prompt for expression to print (@code{idlwave-shell-clear-current-bp}).
12b86f0e
S
3006@item @kbd{h}
3007@tab Continue to the line at cursor position (@code{idlwave-shell-to-here})
3008@item @kbd{i}
4111a42b 3009@tab Set breakpoint in module named here (@code{idlwave-shell-break-in})
12b86f0e
S
3010@item @kbd{[}
3011@tab Go to the previous breakpoint in the file (@code{idlwave-shell-goto-previous-bp})
3012@item @kbd{]}
3013@tab Go to the next breakpoint in the file
3014(@code{idlwave-shell-goto-next-bp})
3015@item @kbd{\}
3016@tab Disable/Enable current breakpoint (@code{idlwave-shell-toggle-enable-current-bp})
3017@item @kbd{j}
3018@tab Set breakpoint at beginning of enclosing routine (@code{idlwave-shell-break-this-module})
3019@item @kbd{k}
3020@tab Skip one statement (@code{idlwave-shell-skip})
3021@item @kbd{m}
3022@tab Continue to end of function (@code{idlwave-shell-return})
3023@item @kbd{n}
3024@tab Step, over function calls (@code{idlwave-shell-stepover})
3025@item @kbd{o}
3026@tab Continue past end of function (@code{idlwave-shell-out})
3027@item @kbd{p}
3028@tab Print expression near point or in region with @kbd{C-u p} (@code{idlwave-shell-print})
3029@item @kbd{q}
3030@tab End the debugging session and return to the Shell's main level
3031(@code{idlwave-shell-retall})
3032@item @kbd{r}
3033@tab Continue execution to next breakpoint, if any (@code{idlwave-shell-cont})
3034@item @kbd{s} or @kbd{@key{SPACE}}
3035@tab Step, into function calls (@code{idlwave-shell-step})
3036@item @kbd{t}
3037@tab Print a calling-level traceback in the shell
3038@item @kbd{u}
3039@tab Continue to end of block (@code{idlwave-shell-up})
3040@item @kbd{v}
3041@tab Turn Electric Debug Mode off
3042(@code{idlwave-shell-electric-debug-mode})
3043@item @kbd{x}
3044@tab Examine expression near point (or in region with @kbd{C-u x})
3045with shortcut of examine type.
3046@item @kbd{z}
3047@tab Reset IDL (@code{idlwave-shell-reset})
3048@item @kbd{+} or @kbd{=}
3049@tab Show higher level in calling stack (@code{idlwave-shell-stack-up})
3050@item @kbd{-} or @kbd{_}
3051@tab Show lower level in calling stack (@code{idlwave-shell-stack-down})
3052@item @kbd{?}
3053@tab Help on expression near point or in region with @kbd{C-u ?}
3054(@code{idlwave-shell-help-expression})
3055@item @kbd{C-?}
3056@tab Show help on the commands available.
3057@end multitable
3058
3059Most single-character electric debug bindings use the final keystroke
3060of the equivalent multiple key commands (which are of course also
4111a42b 3061still available), but some differ (e.g. @kbd{e},@kbd{t},@kbd{q},@kbd{x}).
12b86f0e
S
3062Some have additional convenience bindings (like @kbd{@key{SPACE}} for
3063stepping). All prefix and other argument options described in this
3064section for the commands invoked by electric debug bindings are still
3065valid. For example, @kbd{C-u b} sets a conditional breakpoint, just
3066as it did with @kbd{C-u C-c C-d C-b}.
3067
3068You can toggle the electric debug mode at any time in a buffer using
3069@kbd{C-c C-d C-v} (@kbd{v} to turn it off while in the mode), or from
3070the Debug menu. Normally the mode will be enabled and disabled at the
4dc5fe62 3071appropriate times, but occasionally you might want to edit a file
12b86f0e
S
3072while still debugging it, or switch to the mode for conveniently
3073setting lots of breakpoints.
3074
3075To quickly abandon a debugging session and return to normal editing at
3076the Shell's main level, use @kbd{q} (@code{idlwave-shell-retall}).
3077This disables electric debug mode in all IDLWAVE buffers@footnote{Note
3078that this binding is not symmetric: @kbd{C-c C-d C-q} is bound to
3079@code{idlwave-shell-quit}, which quits your IDL session.}. Help is
3080available for the command shortcuts with @kbd{C-?}. If you find this
3081mode gets in your way, you can keep it from automatically activating
3082by setting the variable @code{idlwave-shell-automatic-electric-debug}
3083to @code{nil}, or @code{'breakpoint}. If you'd like the convenient
3084electric debug shortcuts available also when run-time errors are
3085encountered, set to @code{t}.
3086
3087@defopt idlwave-shell-automatic-electric-debug (@code{'breakpoint})
3088Whether to enter electric debug mode automatically when a breakpoint
3089or run-time error is encountered, and then disable it in all buffers
3090when the $MAIN$ level is reached (either through normal program
3091execution, or retall). In addition to @code{nil} for never, and
3092@code{t} for both breakpoints and errors, this can be
3093@code{'breakpoint} (the default) to enable it only at breakpoint
3094halts.
3095@end defopt
3096
4111a42b
S
3097@defopt idlwave-shell-electric-stop-color (Violet)
3098Default color of the stopped line overlay when in electric debug mode.
3099@end defopt
3100
3101@defopt idlwave-shell-electric-stop-line-face
3102The face to use for the stopped line. Defaults to a face similar to the
3103modeline, with color @code{idlwave-shell-electric-stop-color}.
3104@end defopt
3105
12b86f0e
S
3106@defopt idlwave-shell-electric-zap-to-file (@code{t})
3107If set, when entering electric debug mode, select the window displaying
3108the file where point is stopped. This takes point away from the shell
3109window, but is useful for immediate stepping, etc.
3110@end defopt
3111
4111a42b 3112@html
76959b77 3113<A NAME="EXAMINE"></A>
4111a42b 3114@end html
5af23035
S
3115@node Examining Variables, Custom Expression Examination, Debugging IDL Programs, The IDLWAVE Shell
3116@section Examining Variables
797c8ebc
CD
3117@cindex @code{PRINT} expressions
3118@cindex @code{HELP}, on expressions
12b86f0e
S
3119@cindex Expressions, printing & help
3120@cindex Examining expressions
5af23035 3121@cindex Printing expressions
797c8ebc
CD
3122@cindex Mouse binding to print expressions
3123
a8e833f3 3124@kindex C-c C-d C-p
4111a42b
S
3125Do you find yourself repeatedly typing, e.g. @code{print,n_elements(x)},
3126and similar statements to remind yourself of the
3127type/size/structure/value/etc. of variables and expressions in your code
3128or at the command line? IDLWAVE has a suite of special commands to
3129automate these types of variable or expression examinations. They work
3130by sending statements to the shell formatted to include the indicated
3131expression, and can be accessed in several ways.
3132
3133These @emph{examine} commands can be used in the shell or buffer at any
5af23035
S
3134time (as long as the shell is running), and are very useful when
3135execution is stopped in a buffer due to a triggered breakpoint or error,
3136or while composing a long command in the IDLWAVE shell. In the latter
3137case, the command is sent to the shell and its output is visible, but
3138point remains unmoved in the command being composed --- you can inspect
4dc5fe62 3139the constituents of a command you're building without interrupting the
5af23035
S
3140process of building it! You can even print arbitrary expressions from
3141older input or output further up in the shell window --- any expression,
3142variable, number, or function you see can be examined.
3143
3144If the variable @code{idlwave-shell-separate-examine-output} is
3145non-@code{nil} (the default), all examine output will be sent to a
3146special @file{*Examine*} buffer, rather than the shell. The output of
4111a42b
S
3147prior examine commands is saved in this buffer. In this buffer @key{c}
3148clears the contents, and @key{q} hides the buffer.
5af23035
S
3149
3150The two most basic examine commands are bound to @kbd{C-c C-d C-p}, to
3151print the expression at point, and @kbd{C-c C-d ?}, to invoke help on
12b86f0e
S
3152this expression@footnote{Available as @kbd{p} and @kbd{?} in Electric
3153Debug Mode (@pxref{Electric Debug Mode})}. The expression at point is
4111a42b
S
3154either an array expression or a function call, or the contents of a pair
3155of parentheses. The chosen expression is highlighted, and
3156simultaneously the resulting output is highlighted in the shell or
3157separate output buffer. Calling the above commands with a prefix
3158argument will use the current region as expression instead of using the
3159one at point. which can be useful for examining complicated, multi-line
3160expressions. Two prefix arguments (@kbd{C-u C-u C-c C-d C-p}) will
3161prompt for an expression to print directly. By default, when invoking
3162print, only an initial portion of long arrays will be printed, up to
3163@code{idlwave-shell-max-print-length}.
5af23035
S
3164
3165For added speed and convenience, there are mouse bindings which allow
3166you to click on expressions and examine their values. Use
32d4cddb 3167@kbd{S-Mouse-2} to print an expression and @kbd{C-M-Mouse-2} to invoke
5af23035
S
3168help (i.e. you need to hold down @key{META} and @key{CONTROL} while
3169clicking with the middle mouse button). If you simply click, the
3170nearest expression will be selected in the same manner as described
12b86f0e
S
3171above. You can also @emph{drag} the mouse in order to highlight
3172exactly the specific expression or sub-expression you want to examine.
3173For custom expression examination, and the powerful customizable
3174pop-up examine selection, @xref{Custom Expression Examination}.
5af23035 3175
a8e833f3
CD
3176@cindex Printing expressions, on calling stack
3177@cindex Restrictions for expression printing
5af23035
S
3178The same variable inspection commands work both in the IDL Shell and
3179IDLWAVE buffers, and even for variables at higher levels of the calling
3180stack. For instance, if you're stopped at a breakpoint in a routine,
3181you can examine the values of variables and expressions inside its
3182calling routine, and so on, all the way up through the calling stack.
3183Simply step up the stack, and print variables as you see them
3184(@pxref{Walking the Calling Stack}, for information on stepping back
3185through the calling stack). The following restrictions apply for all
3186levels except the current:
ea442c62
CD
3187
3188@itemize @bullet
3189@item
3190Array expressions must use the @samp{[ ]} index delimiters. Identifiers
3191with a @samp{( )} will be interpreted as function calls.
3192@item
ea442c62 3193@cindex ROUTINE_NAMES, IDL procedure
5af23035
S
3194N.B.: printing values of expressions on higher levels of the calling
3195stack uses the @emph{unsupported} IDL routine @code{ROUTINE_NAMES},
12b86f0e
S
3196which may or may not be available in future versions of IDL. Caveat
3197Examinor.
ea442c62
CD
3198@end itemize
3199
797c8ebc
CD
3200@defopt idlwave-shell-expression-face
3201The face for @code{idlwave-shell-expression-overlay}.
3202Allows you to choose the font, color and other properties for
3203the expression printed by IDL.
3204@end defopt
3205
5af23035 3206@defopt idlwave-shell-output-face
12b86f0e 3207The face for @code{idlwave-shell-output-overlay}.
5af23035
S
3208Allows to choose the font, color and other properties for the most
3209recent output of IDL when examining an expression."
3210@end defopt
3211
3212@defopt idlwave-shell-separate-examine-output (@code{t})
3213If non-@code{nil}, re-direct the output of examine commands to a special
12b86f0e 3214@file{*Examine*} buffer, instead of in the shell itself.
5af23035
S
3215@end defopt
3216
4111a42b
S
3217@defopt idlwave-shell-max-print-length (200)
3218The maximum number of leading array entries to print, when examining
3219array expressions.
3220@end defopt
3221
5af23035
S
3222@node Custom Expression Examination, , Examining Variables, The IDLWAVE Shell
3223@section Custom Expression Examination
3224@cindex Expressions, custom examination
3225@cindex Custom expression examination
3226
3227The variety of possible variable and expression examination commands is
3228endless (just look, for instance, at the keyword list to
3229@code{widget_info()}). Rather than attempt to include them all, IDLWAVE
3230provides two easy methods to customize your own commands, with a special
3231mouse examine command, and two macros for generating your own examine
12b86f0e
S
3232key and mouse bindings.
3233
3234The most powerful and flexible mouse examine command of all is
3235available on @kbd{C-S-Mouse-2}. Just as for all the other mouse
3236examine commands, it permits click or drag expression selection, but
3237instead of sending hard-coded commands to the shell, it pops-up a
3238customizable selection list of examine functions to choose among,
3239configured with the @code{idlwave-shell-examine-alist}
3240variable@footnote{In Electric Debug Mode (@pxref{Electric Debug
3241Mode}), the key @kbd{x} provides a single-character shortcut interface
3242to the same examine functions for the expression at point or marked by
3243the region.}. This variable is a list of key-value pairs (an
3244@emph{alist} in Emacs parlance), where the key gives a name to be
3245shown for the examine command, and the value is the command strings
3246itself, in which the text @code{___} (three underscores) will be
3247replaced by the selected expression before being sent to the shell.
3248An example might be key @code{Structure Help} with value
3249@code{help,___,/STRUCTURE}. In that case, you'd be prompted with
3250@emph{Structure Help}, which might send something like
3251@code{help,var,/STRUCTURE} to the shell for output.
3252@code{idlwave-shell-examine-alist} comes configured by default with a
3253large list of examine commands, but you can easily customize it to add
3254your own.
3255
3256In addition to configuring the functions available to the pop-up mouse
3257command, you can easily create your own customized bindings to inspect
3258expressions using the two convenience macros
3259@code{idlwave-shell-examine} and @code{idlwave-shell-mouse-examine}.
3260These create keyboard or mouse-based custom inspections of variables,
3261sharing all the same properties of the built-in examine commands.
3262Both functions take a single string argument sharing the syntax of the
5af23035 3263@code{idlwave-shell-examine-alist} values, e.g.:
797c8ebc 3264
5af23035
S
3265@lisp
3266(add-hook 'idlwave-shell-mode-hook
3267 (lambda ()
12b86f0e
S
3268 (idlwave-shell-define-key-both [s-down-mouse-2]
3269 (idlwave-shell-mouse-examine
5af23035
S
3270 "print, size(___,/DIMENSIONS)"))
3271 (idlwave-shell-define-key-both [f9] (idlwave-shell-examine
3272 "print, size(___,/DIMENSIONS)"))
12b86f0e 3273 (idlwave-shell-define-key-both [f10] (idlwave-shell-examine
5af23035
S
3274 "print,size(___,/TNAME)"))
3275 (idlwave-shell-define-key-both [f11] (idlwave-shell-examine
3276 "help,___,/STRUCTURE"))))
12b86f0e
S
3277@end lisp
3278
5af23035
S
3279@noindent Now pressing @key{f9}, or middle-mouse dragging with the
3280@key{SUPER} key depressed, will print the dimensions of the nearby or
3281highlighted expression. Pressing @key{f10} will give the type string,
3282and @key{f11} will show the contents of a nearby structure. As you can
3283see, the possibilities are only marginally finite.
3284
3285@defopt idlwave-shell-examine-alist
12b86f0e
S
3286An alist of examine commands in which the keys name the command and
3287are displayed in the selection pop-up, and the values are custom IDL
3288examine command strings to send, after all instances of @code{___}
3289(three underscores) are replaced by the indicated expression.
5af23035
S
3290@end defopt
3291
215a5cd0 3292@node Acknowledgements, Sources of Routine Info, The IDLWAVE Shell, Top
5af23035
S
3293@chapter Acknowledgements
3294@cindex Acknowledgements
a8e833f3
CD
3295@cindex Maintainer, of IDLWAVE
3296@cindex Authors, of IDLWAVE
3297@cindex Contributors, to IDLWAVE
3298@cindex Email address, of Maintainer
797c8ebc
CD
3299@cindex Thanks
3300
a8e833f3
CD
3301@noindent
3302The main contributors to the IDLWAVE package have been:
797c8ebc 3303
a8e833f3
CD
3304@itemize @minus
3305@item
aea44e56
CD
3306@uref{mailto:chase@@att.com, @b{Chris Chase}}, the original author.
3307Chris wrote @file{idl.el} and @file{idl-shell.el} and maintained them
3308for several years.
a8e833f3
CD
3309
3310@item
5af23035
S
3311@uref{mailto:dominik@@astro.uva.nl, @b{Carsten Dominik}} was in charge
3312of the package from version 3.0, during which time he overhauled almost
3313everything, modernized IDLWAVE with many new features, and developed the
df59879c 3314manual.
a8e833f3 3315
12b86f0e 3316@item
5af23035
S
3317@uref{mailto:jdsmith@@as.arizona.edu, @b{J.D. Smith}}, the current
3318maintainer, as of version 4.10, helped shape object method completion
4111a42b
S
3319and most new features introduced in versions 4.x, and introduced many
3320new features for IDLWAVE versions 5.x and 6.x.
a8e833f3
CD
3321@end itemize
3322
3323@noindent
3324The following people have also contributed to the development of IDLWAVE
3325with patches, ideas, bug reports and suggestions.
797c8ebc
CD
3326
3327@itemize @minus
3328@item
12b86f0e 3329Ulrik Dickow <dickow__at__nbi.dk>
797c8ebc 3330@item
12b86f0e 3331Eric E. Dors <edors__at__lanl.gov>
797c8ebc 3332@item
12b86f0e 3333Stein Vidar H. Haugan <s.v.h.haugan__at__astro.uio.no>
797c8ebc 3334@item
12b86f0e 3335David Huenemoerder <dph__at__space.mit.edu>
797c8ebc 3336@item
12b86f0e 3337Kevin Ivory <Kevin.Ivory__at__linmpi.mpg.de>
797c8ebc 3338@item
12b86f0e 3339Dick Jackson <dick__at__d-jackson.com>
5af23035 3340@item
12b86f0e 3341Xuyong Liu <liu__at__stsci.edu>
797c8ebc 3342@item
12b86f0e 3343Simon Marshall <Simon.Marshall__at__esrin.esa.it>
797c8ebc 3344@item
12b86f0e 3345Craig Markwardt <craigm__at__cow.physics.wisc.edu>
aea44e56 3346@item
12b86f0e 3347Laurent Mugnier <mugnier__at__onera.fr>
797c8ebc 3348@item
12b86f0e 3349Lubos Pochman <lubos__at__rsinc.com>
797c8ebc 3350@item
12b86f0e 3351Bob Portmann <portmann__at__al.noaa.gov>
76959b77 3352@item
12b86f0e 3353Patrick M. Ryan <pat__at__jaameri.gsfc.nasa.gov>
797c8ebc 3354@item
12b86f0e 3355Marty Ryba <ryba__at__ll.mit.edu>
797c8ebc 3356@item
12b86f0e 3357Phil Williams <williams__at__irc.chmcc.org>
797c8ebc 3358@item
12b86f0e
S
3359Phil Sterne <sterne__at__dublin.llnl.gov>
3360@item
3361Paul Sorenson <aardvark62__at__msn.com>
797c8ebc
CD
3362@end itemize
3363
4111a42b
S
3364Doug Dirks was instrumental in providing the crucial IDL XML catalog to
3365support HTML help with IDL v6.2 and later, and Ali Bahrami provided
3366scripts and documentation to interface with the IDL Assistant.
3367
a8e833f3
CD
3368@noindent
3369Thanks to everyone!
3370
12b86f0e 3371@node Sources of Routine Info, HTML Help Browser Tips, Acknowledgements, Top
797c8ebc
CD
3372@appendix Sources of Routine Info
3373
a8e833f3 3374@cindex Sources of routine information
5af23035
S
3375In @ref{Routine Info} and @ref{Completion} we showed how IDLWAVE
3376displays the calling sequence and keywords of routines, and completes
3377routine names and keywords. For these features to work, IDLWAVE must
3378know about the accessible routines.
797c8ebc
CD
3379
3380@menu
3381* Routine Definitions:: Where IDL Routines are defined.
a8e833f3 3382* Routine Information Sources:: So how does IDLWAVE know about...
12b86f0e 3383* Catalogs::
a8e833f3
CD
3384* Load-Path Shadows:: Routines defined in several places
3385* Documentation Scan:: Scanning the IDL Manuals
797c8ebc
CD
3386@end menu
3387
3388@node Routine Definitions, Routine Information Sources, Sources of Routine Info, Sources of Routine Info
5af23035 3389@appendixsec Routine Definitions
797c8ebc 3390@cindex Routine definitions
a8e833f3
CD
3391@cindex IDL variable @code{!PATH}
3392@cindex @code{!PATH}, IDL variable
3393@cindex @code{CALL_EXTERNAL}, IDL routine
3394@cindex @code{LINKIMAGE}, IDL routine
3395@cindex External routines
797c8ebc 3396
5af23035
S
3397@noindent Routines which can be used in an IDL program can be defined in
3398several places:
797c8ebc
CD
3399
3400@enumerate
12b86f0e 3401@item
4111a42b
S
3402@emph{Builtin routines} are defined inside IDL itself. The source code
3403of such routines is not available, but instead are learned about through
3404the IDL documentation.
797c8ebc 3405@item
76959b77
S
3406Routines which are @emph{part of the current program}, are defined in a
3407file explicitly compiled by the user. This file may or may not be
3408located on the IDL search path.
12b86f0e 3409@item
5af23035 3410@emph{Library routines} are defined in files located on IDL's search
4111a42b
S
3411path. When a library routine is called for the first time, IDL will
3412find the source file and compile it dynamically. A special sub-category
3413of library routines are the @emph{system routines} distributed with IDL,
3414and usually available in the @file{lib} subdirectory of the IDL
3415distribution.
797c8ebc
CD
3416@item
3417External routines written in other languages (like Fortran or C) can be
3418called with @code{CALL_EXTERNAL}, linked into IDL via @code{LINKIMAGE},
3419or included as dynamically loaded modules (DLMs). Currently IDLWAVE
4111a42b
S
3420cannot provide routine info and completion for such external routines,
3421except by querying the Shell for calling information (DLMs only).
797c8ebc
CD
3422@end enumerate
3423
12b86f0e 3424@node Routine Information Sources, Catalogs, Routine Definitions, Sources of Routine Info
5af23035 3425@appendixsec Routine Information Sources
797c8ebc 3426@cindex Routine info sources
a8e833f3
CD
3427@cindex Builtin list of routines
3428@cindex Updating routine info
3429@cindex Scanning buffers for routine info
3430@cindex Buffers, scanning for routine info
3431@cindex Shell, querying for routine info
797c8ebc 3432
5af23035
S
3433@noindent To maintain the most comprehensive information about all IDL
3434routines on a system, IDLWAVE collects data from many sources:
797c8ebc
CD
3435
3436@enumerate
3437
3438@item
12b86f0e
S
3439It has a @emph{builtin list} with information about the routines IDL
3440ships with. IDLWAVE @value{VERSION} is distributed with a list of
4111a42b
S
3441@value{NSYSROUTINES} routines, reflecting IDL version
3442@value{IDLVERSION}. As of IDL v6.2, the routine info is distributed
3443directly with IDL in the form of an XML catalog which IDLWAVE scans.
3444Formerly, this list was created by scanning the IDL manuals to produce
3445the file @file{idlw-rinfo.el}.
797c8ebc 3446
12b86f0e 3447@item
4111a42b
S
3448IDLWAVE @emph{scans} all its @emph{buffers} in the current Emacs session
3449for routine definitions. This is done automatically when routine
a8e833f3 3450information or completion is first requested by the user. Each new
12b86f0e
S
3451buffer and each buffer saved after making changes is also scanned. The
3452command @kbd{C-c C-i} (@code{idlwave-update-routine-info}) can be used
3453at any time to rescan all buffers.
797c8ebc
CD
3454
3455@item
5af23035
S
3456If you have an IDLWAVE-Shell running in the Emacs session, IDLWAVE will
3457@emph{query the shell} for compiled routines and their arguments. This
3458happens automatically when routine information or completion is first
4111a42b
S
3459requested by the user. Each time an Emacs buffer is compiled with
3460@kbd{C-c C-d C-c}, the routine info for that file is queried. Though
3461rarely necessary, the command @kbd{C-c C-i}
3462(@code{idlwave-update-routine-info}) can be used to explicitly update
3463the shell routine data.
797c8ebc
CD
3464
3465@item
4111a42b
S
3466Many popular libraries are distributed with routine information already
3467scanned into @emph{library catalogs} (@pxref{Library Catalogs}). These
3468per-directory catalog files can also be built by the user with the
3469supplied @file{idlwave_catalog} tool. They are automatically discovered
3470by IDLWAVE.
12b86f0e
S
3471
3472@item
3473IDLWAVE can scan selected directories of source files and store the
3474result in a single @emph{user catalog} file which will be
3475automatically loaded just like @file{idlw-rinfo.el}. @xref{User
3476Catalog}, for information on how to scan files in this way.
797c8ebc
CD
3477@end enumerate
3478
4111a42b
S
3479Loading all the routine and catalog information can be a time consuming
3480process, especially over slow networks. Depending on the system and
3481network configuration it could take up to 30 seconds (though locally on
3482fast systems is usually only a few seconds). In order to minimize the
12b86f0e
S
3483wait time upon your first completion or routine info command in a
3484session, IDLWAVE uses Emacs idle time to do the initialization in six
3485steps, yielding to user input in between. If this gets into your way,
3486set the variable @code{idlwave-init-rinfo-when-idle-after} to 0 (zero).
3487The more routines documented in library and user catalogs, the slower
3488the loading will be, so reducing this number can help alleviate any long
3489load times.
5af23035
S
3490
3491@defopt idlwave-init-rinfo-when-idle-after (@code{10})
3492Seconds of idle time before routine info is automatically initialized.
3493@end defopt
3494
797c8ebc 3495@defopt idlwave-scan-all-buffers-for-routine-info (@code{t})
5af23035 3496Non-@code{nil} means scan all buffers for IDL programs when updating
a8e833f3 3497info.
797c8ebc
CD
3498@end defopt
3499
3500@defopt idlwave-query-shell-for-routine-info (@code{t})
3501Non-@code{nil} means query the shell for info about compiled routines.
3502@end defopt
3503
a8e833f3
CD
3504@defopt idlwave-auto-routine-info-updates
3505Controls under what circumstances routine info is updated automatically.
3506@end defopt
797c8ebc 3507
4111a42b 3508@html
12b86f0e 3509<A NAME="CATALOGS"></A>
4111a42b 3510@end html
12b86f0e
S
3511@node Catalogs, Load-Path Shadows, Routine Information Sources, Sources of Routine Info
3512@appendixsec Catalogs
3513@cindex Catalogs
3514
3515@emph{Catalogs} are files containing scanned information on individual
3516routines, including arguments and keywords, calling sequence, file path,
3517class and procedure vs. function type, etc. They represent a way of
3518extending the internal built-in information available for IDL system
3519routines (@pxref{Routine Info}) to other source collections.
3520
3521Starting with version 5.0, there are two types of catalogs available
3522with IDLWAVE. The traditional @emph{user catalog} and the newer
3523@emph{library catalogs}. Although they can be used interchangeably, the
3524library catalogs are more flexible, and preferred. There are few
3525occasions when a user catalog might be preferred --- read below. Both
3526types of catalogs can coexist without causing problems.
3527
3528To facilitate the catalog systems, IDLWAVE stores information it gathers
3529from the shell about the IDL search paths, and can write this
3530information out automatically, or on-demand (menu @code{Debug->Save Path
3531Info}). On systems with no shell from which to discover the path
3532information (e.g. Windows), a library path must be specified in
3533@code{idlwave-library-path} to allow library catalogs to be located, and
3534to setup directories for user catalog scan (@pxref{User Catalog} for
4111a42b
S
3535more on this variable). Note that, before the shell is running, IDLWAVE
3536can only know about the IDL search path by consulting the file pointed
3537to by @code{idlwave-path-file} (@file{~/.idlwave/idlpath.el}, by
3538default). If @code{idlwave-auto-write-path} is enabled (which is the
3539default), the paths are written out whenever the IDLWAVE shell is
3540started.
12b86f0e
S
3541
3542@defopt idlwave-auto-write-path (@code{t})
3543Write out information on the !PATH and !DIR paths from IDL automatically
3544when they change and when the Shell is closed. These paths are needed
3545to locate library catalogs.
3546@end defopt
3547
3548@defopt idlwave-library-path
4111a42b
S
3549IDL library path for Windows and MacOS. Under Unix/MacOSX, will be
3550obtained from the Shell when run.
12b86f0e
S
3551@end defopt
3552
3553@defopt idlwave-system-directory
4111a42b
S
3554The IDL system directory for Windows and MacOS. Also needed for
3555locating HTML help and the IDL Assistant for IDL v6.2 and later. Under
3556Unix/MacOSX, will be obtained from the Shell and recorded, if run.
12b86f0e
S
3557@end defopt
3558
3559@defopt idlwave-config-directory (@file{~/.idlwave})
4111a42b
S
3560Default path where IDLWAVE saves configuration information, a user
3561catalog (if any), and a cached scan of the XML catalog (IDL v6.2 and
3562later).
12b86f0e
S
3563@end defopt
3564
3565@menu
3566* Library Catalogs::
3567* User Catalog::
3568@end menu
3569
4111a42b 3570@html
12b86f0e 3571<A NAME="LIBRARY_CATALOGS"></A>
4111a42b 3572@end html
12b86f0e
S
3573@node Library Catalogs, User Catalog, Catalogs, Catalogs
3574@appendixsubsec Library Catalogs
3575@cindex @file{.idlwave_catalog}
3576@cindex Library catalogs
3577@cindex @code{idlwave_catalog}
3578
4111a42b
S
3579Library catalogs consist of files named @file{.idlwave_catalog} stored
3580in directories containing @code{.pro} routine files. They are
3581discovered on the IDL search path and loaded automatically when routine
3582information is read. Each catalog file documents the routines found in
3583that directory --- one catalog per directory. Every catalog has a
3584library name associated with it (e.g. @emph{AstroLib}). This name will
3585be shown briefly when the catalog is found, and in the routine info of
3586routines it documents.
12b86f0e
S
3587
3588Many popular libraries of routines are shipped with IDLWAVE catalog
3589files by default, and so will be automatically discovered. Library
3590catalogs are scanned externally to Emacs using a tool provided with
3591IDLWAVE. Each catalog can be re-scanned independently of any other.
3592Catalogs can easily be made available system-wide with a common source
3593repository, providing uniform routine information, and lifting the
3594burden of scanning from the user (who may not even know they're using a
3595scanned catalog). Since all catalogs are independent, they can be
3596re-scanned automatically to gather updates, e.g. in a @file{cron} job.
3597Scanning is much faster than with the built-in user catalog method. One
3598minor disadvantage: the entire IDL search path is scanned for catalog
4111a42b
S
3599files every time IDLWAVE starts up, which might be slow if accessing IDL
3600routines over a slow network.
12b86f0e
S
3601
3602A Perl tool to create library catalogs is distributed with IDLWAVE:
3603@code{idlwave_catalog}. It can be called quite simply:
3604@example
3605idlwave_catalog MyLib
3606@end example
3607
4111a42b 3608@noindent This will scan all directories recursively beneath the current and
12b86f0e 3609populate them with @file{.idlwave_catalog} files, tagging the routines
4111a42b
S
3610found there with the name library ``MyLib''. The full usage
3611information:
12b86f0e
S
3612
3613@example
3614Usage: idlwave_catalog [-l] [-v] [-d] [-s] [-f] [-h] libname
3615 libname - Unique name of the catalog (4 or more alphanumeric
3616 characters).
3617 -l - Scan local directory only, otherwise recursively
3618 catalog all directories at or beneath this one.
3619 -v - Print verbose information.
3620 -d - Instead of scanning, delete all .idlwave_catalog files
3621 here or below.
3622 -s - Be silent.
3623 -f - Force overwriting any catalogs found with a different
3624 library name.
3625 -h - Print this usage.
3626@end example
3627
3628To re-load the library catalogs on the IDL path, force a system routine
3629info update using a single prefix to @code{idlwave-update-routine-info}:
3630@kbd{C-u C-c C-i}.
3631
3632@defopt idlwave-use-library-catalogs (@code{t})
4111a42b
S
3633Whether to search for and load library catalogs. Disable if load
3634performance is a problem and/or the catalogs are not needed.
12b86f0e
S
3635@end defopt
3636
3637@node User Catalog, , Library Catalogs, Catalogs
3638@appendixsubsec User Catalog
3639@cindex User catalog
797c8ebc 3640@cindex IDL library routine info
a8e833f3
CD
3641@cindex Windows
3642@cindex MacOS
a8e833f3
CD
3643@cindex IDL variable @code{!DIR}
3644@cindex @code{!DIR}, IDL variable
3645
12b86f0e
S
3646The user catalog is the old routine catalog system. It is produced
3647within Emacs, and stored in a single file in the user's home directory
3648(@file{.idlwave/idlusercat.el} by default). Although library catalogs
3649are more flexible, there may be reasons to prefer a user catalog
3650instead, including:
3651
3652@itemize @bullet
3653@item The scan is internal to Emacs, so you don't need a working Perl
3654installation, as you do for library catalogs.
3655@item Can be used to scan directories for which the user has no write
3656privileges.
3657@item Easy widget-based path selection.
3658@end itemize
3659
3660However, no routine info is available in the user catalog by default;
3661the user must actively complete a scan. In addition, this type of
3662catalog is all or nothing: if a single routine changes, the entire
3663catalog must be rescanned to update it. Creating the user catalog is
3664also much slower than scanning library catalogs.
797c8ebc 3665
12b86f0e
S
3666You can scan any of the directories on the currently known path. Under
3667Windows and MacOS (not OSX), you need to specify the IDL search path in
3668the variable @code{idlwave-library-path}, and the location of the IDL
3669directory (the value of the @code{!DIR} system variable) in the variable
3670@code{idlwave-system-directory}, like this@footnote{The initial @samp{+}
3671leads to recursive expansion of the path, just like in IDL}:
5af23035
S
3672
3673@lisp
3674(setq idlwave-library-path
12b86f0e
S
3675 '("+c:/RSI/IDL56/lib/" "+c:/user/me/idllibs"))
3676(setq idlwave-system-directory "c:/RSI/IDL56/")
5af23035
S
3677@end lisp
3678
4111a42b
S
3679@noindent Under GNU/Linux and UNIX, these values will be automatically
3680gathered from the IDLWAVE shell, if run.
797c8ebc 3681
12b86f0e 3682The command @kbd{M-x idlwave-create-user-catalog-file} (or the menu item
4111a42b 3683@samp{IDLWAVE->Routine Info->Select Catalog Directories}) can then be
12b86f0e
S
3684used to create a user catalog. It brings up a widget in which you can
3685select some or all directories on the search path. Directories which
3686already contain a library catalog are marked with @samp{[LIB]}, and need
3687not be scanned (although there is no harm if you do so, other than the
3688additional memory used for the duplication).
a8e833f3
CD
3689
3690After selecting directories, click on the @w{@samp{[Scan & Save]}}
3691button in the widget to scan all files in the selected directories and
12b86f0e
S
3692write out the resulting routine information. In order to update the
3693library information using the directory selection, call the command
797c8ebc 3694@code{idlwave-update-routine-info} with a double prefix argument:
a8e833f3 3695@w{@kbd{C-u C-u C-c C-i}}. This will rescan files in the previously
12b86f0e
S
3696selected directories, write an updated version of the user catalog file
3697and rebuild IDLWAVE's internal lists. If you give three prefix
3698arguments @w{@kbd{C-u C-u C-u C-c C-i}}, updating will be done with a
3699background job@footnote{Unix systems only, I think.}. You can continue
3700to work, and the library catalog will be re-read when it is ready. If
3701you find you need to update the user catalog often, you should consider
3702building a library catalog for your routines instead (@pxref{Library
3703Catalogs}).
a8e833f3
CD
3704
3705@defopt idlwave-special-lib-alist
12b86f0e
S
3706Alist of regular expressions matching special library directories for
3707labeling in routine-info display.
a8e833f3
CD
3708@end defopt
3709
12b86f0e 3710@node Load-Path Shadows, Documentation Scan, Catalogs, Sources of Routine Info
5af23035 3711@appendixsec Load-Path Shadows
a8e833f3
CD
3712@cindex Load-path shadows
3713@cindex Shadows, load-path
3714@cindex Duplicate routines
3715@cindex Multiply defined routines
3716@cindex Routine definitions, multiple
3717@cindex Application, testing for shadowing
3718@cindex Buffer, testing for shadowing
3719
12b86f0e
S
3720IDLWAVE can compile a list of routines which are (re-)defined in more
3721than one file. Since one definition will hide (shadow) the others
a8e833f3
CD
3722depending on which file is compiled first, such multiple definitions are
3723called "load-path shadows". IDLWAVE has several routines to scan for
aea44e56 3724load path shadows. The output is placed into the special buffer
a8e833f3 3725@file{*Shadows*}. The format of the output is identical to the source
aea44e56 3726section of the routine info buffer (@pxref{Routine Info}). The
12b86f0e
S
3727different definitions of a routine are ordered by @emph{likelihood of
3728use}. So the first entry will be most likely the one you'll get if an
3729unsuspecting command uses that routine. Before listing shadows, you
3730should make sure that routine info is up-to-date by pressing @kbd{C-c
3731C-i}. Here are the different routines (also available in the Menu
3732@samp{IDLWAVE->Routine Info}):
a8e833f3
CD
3733
3734@table @asis
3735@item @kbd{M-x idlwave-list-buffer-load-path-shadows}
3736This commands checks the names of all routines defined in the current
3737buffer for shadowing conflicts with other routines accessible to
3738IDLWAVE. The command also has a key binding: @kbd{C-c C-b}
3739@item @kbd{M-x idlwave-list-shell-load-path-shadows}.
3740Checks all routines compiled under the shell for shadowing. This is
3741very useful when you have written a complete application. Just compile
3742the application, use @code{RESOLVE_ALL} to compile any routines used by
3743your code, update the routine info inside IDLWAVE with @kbd{C-c C-i} and
3744then check for shadowing.
3745@item @kbd{M-x idlwave-list-all-load-path-shadows}
aea44e56 3746This command checks all routines accessible to IDLWAVE for conflicts.
a8e833f3
CD
3747@end table
3748
12b86f0e
S
3749For these commands to work fully you need to scan the entire load path
3750in either a user or library catalog. Also, IDLWAVE should be able to
3751distinguish between the system library files (normally installed in
a8e833f3 3752@file{/usr/local/rsi/idl/lib}) and any site specific or user specific
5af23035
S
3753files. Therefore, such local files should not be installed inside the
3754@file{lib} directory of the IDL directory. This is also advisable for
3755many other reasons.
a8e833f3
CD
3756
3757@cindex Windows
3758@cindex MacOS
3759@cindex IDL variable @code{!DIR}
3760@cindex @code{!DIR}, IDL variable
4111a42b 3761Users of Windows and MacOS (not X) also must set the variable
a8e833f3
CD
3762@code{idlwave-system-directory} to the value of the @code{!DIR} system
3763variable in IDL. IDLWAVE appends @file{lib} to the value of this
3764variable and assumes that all files found on that path are system
3765routines.
3766
3767Another way to find out if a specific routine has multiple definitions
3768on the load path is routine info display (@pxref{Routine Info}).
3769
3770@node Documentation Scan, , Load-Path Shadows, Sources of Routine Info
12b86f0e
S
3771@appendixsec Documentation Scan
3772@cindex @file{get_html_rinfo}
c142ce81 3773@cindex @file{idlw-rinfo.el}
a8e833f3 3774@cindex Scanning the documentation
c142ce81 3775@cindex Perl program, to create @file{idlw-rinfo.el}
797c8ebc 3776
4111a42b
S
3777@strong{Starting with version 6.2, IDL is distributed directly with HTML
3778online help, and an XML-based catalog of routine information}. This
3779makes scanning the manuals with the tool @file{get_html_rinfo}, and the
3780@file{idlw-rinfo.el} file it produced, as described here, entirely
3781unnecessary. The information is left here for users wishing to produce
3782a catalog of older IDL versions' help.
3783
3784
12b86f0e 3785IDLWAVE derives its knowledge about system routines from the IDL
a8e833f3 3786manuals. The file @file{idlw-rinfo.el} contains the routine information
12b86f0e
S
3787for the IDL system routines, and links to relevant sections of the HTML
3788documentation. The Online Help feature of IDLWAVE requires HTML
4111a42b
S
3789versions of the IDL manuals to be available; the HTML documentation is
3790not distributed with IDLWAVE by default, but must be downloaded
5a2881c2 3791separately.
12b86f0e
S
3792
3793The HTML files and related images can be produced from the
3794@file{idl.chm} HTMLHelp file distributed with IDL using the free
3795Microsoft HTML Help Workshop. If you are lucky, the maintainer of
4111a42b
S
3796IDLWAVE will always have access to the newest version of IDL and provide
3797updates. The IDLWAVE distribution also contains the Perl program
3798@file{get_html_rinfo} which constructs the @file{idlw-rinfo.el} file by
3799scanning the HTML documents produced from the IDL documentation.
3800Instructions on how to use @file{get_html_rinfo} are in the program
3801itself.
12b86f0e
S
3802
3803@node HTML Help Browser Tips, Configuration Examples, Sources of Routine Info, Top
3804@appendix HTML Help Browser Tips
3805@cindex Browser Tips
3806
3807There are a wide variety of possible browsers to use for displaying
3808the online HTML help available with IDLWAVE (starting with version
4111a42b
S
38095.0). Since IDL v6.2, a single cross-platform HTML help browser, the
3810@emph{IDL Assistant} is distributed with IDL. If this help browser is
3811available, it is the preferred choice, and the default. The variable
3812@code{idlwave-help-use-assistant}, enabled by default, controls
3813whether this help browser is used. If you use the IDL Assistant, the
3814tips here are not relevant.
3815
3816Since IDLWAVE runs on a many different system types, a single browser
3817configuration is not possible, but choices abound. On many systems,
3818the default browser configured in @code{browse-url-browser-function},
3819and hence inherited by default by
3820@code{idlwave-help-browser-function}, is Netscape. Unfortunately, the
3821HTML manuals decompiled from the original source contain formatting
3822structures which Netscape 4.x does not handle well, though they are
3823still readable. A much better choice is Mozilla, or one of the
3824Mozilla-derived browsers such as
215a5cd0 3825@uref{http://galeon.sourceforge.net/,Galeon} (GNU/Linux),
12b86f0e
S
3826@uref{http://www.mozilla.org/projects/camino/,Camino} (MacOSX), or
3827@uref{http://www.mozilla.org/projects/firebird/,Firebird} (all
3828platforms). Newer versions of Emacs provide a browser-function choice
3829@code{browse-url-gnome-moz} which uses the Gnome-configured browser.
3830
4111a42b
S
3831Note that the HTML files decompiled from the help sources contain
3832specific references to the @samp{Symbol} font, which by default is not
3833permitted in normal encodings (it's invalid, technically). Though it
3834only impacts a few symbols, you can trick Mozilla-based browsers into
12b86f0e 3835recognizing @samp{Symbol} by following the directions
4111a42b
S
3836@uref{http://hutchinson.belmont.ma.us/tth/Xfonts.html, here}. With
3837this fix in place, HTML help pages look almost identical to their PDF
3838equivalents (yet can be bookmarked, browsed as history, searched,
3839etc.).
12b86f0e
S
3840
3841@noindent Individual platform recommendations:
3842
3843@itemize @bullet
12b86f0e
S
3844@item Unix/MacOSX: The @uref{http://www.w3m.org,@code{w3m}} browser
3845and its associated
3846@uref{http://emacs-w3m.namazu.org/,@code{emacs-w3m}} emacs mode
3847provide in-buffer browsing with image display, and excellent speed and
3848formatting. Both the Emacs mode and the browser itself must be
3849downloaded separately. To use this browser, include
3850
3851@lisp
3852(setq idlwave-help-browser-function 'w3m-browse-url)
3853@end lisp
3854
3855in your @file{.emacs}. Setting a few other nice @code{w3m} options
3856cuts down on screen clutter:
3857
3858@lisp
3859(setq w3m-use-tab nil
3860 w3m-use-header-line nil
3861 w3m-use-toolbar nil)
3862@end lisp
3863
3864If you use a dedicated frame for help, you might want to add the
3865following, to get consistent behavior with the @kbd{q} key:
3866
3867@lisp
3868;; Close my help window when w3m closes.
3869(defadvice w3m-close-window (after idlwave-close activate)
3870 (if (boundp 'idlwave-help-frame)
3871 (idlwave-help-quit)))
3872@end lisp
3873
3874Note that you can open the file in an external browser from within
3875@code{w3m} using @kbd{M}.
3876@end itemize
3877
3878@node Configuration Examples, Windows and MacOS, HTML Help Browser Tips, Top
797c8ebc
CD
3879@appendix Configuration Examples
3880@cindex Configuration examples
3881@cindex Example configuration
a8e833f3
CD
3882@cindex @file{.emacs}
3883@cindex Default settings, of options
3884@cindex Interview, with the maintainer
797c8ebc
CD
3885
3886@noindent
5af23035
S
3887@b{Question:} You have all these complicated configuration options in
3888your package, but which ones do @emph{you} as the maintainer actually
3889set in your own configuration?
797c8ebc
CD
3890
3891@noindent
5af23035
S
3892@b{Answer:} Not many, beyond custom key bindings. I set most defaults
3893the way that seems best. However, the default settings do not turn on
3894features which:
a8e833f3 3895
797c8ebc
CD
3896@itemize @minus
3897@item
5af23035 3898are not self-evident (i.e. too magic) when used by an unsuspecting user.
797c8ebc 3899@item
5af23035 3900are too intrusive.
797c8ebc 3901@item
5af23035 3902will not work properly on all Emacs installations.
797c8ebc 3903@item
a8e833f3 3904break with widely used standards.
5af23035
S
3905@item
3906use function or other non-standard keys.
3907@item
3908are purely personal customizations, like additional key bindings, and
3909library names.
797c8ebc
CD
3910@end itemize
3911
5af23035
S
3912@noindent To see what I mean, here is the @emph{entire} configuration
3913the old maintainer had in his @file{.emacs}:
797c8ebc
CD
3914
3915@lisp
aea44e56 3916(setq idlwave-shell-debug-modifiers '(control shift)
797c8ebc
CD
3917 idlwave-store-inquired-class t
3918 idlwave-shell-automatic-start t
a8e833f3 3919 idlwave-main-block-indent 2
5af23035 3920 idlwave-init-rinfo-when-idle-after 2
a8e833f3
CD
3921 idlwave-help-dir "~/lib/emacs/idlwave"
3922 idlwave-special-lib-alist '(("/idl-astro/" . "AstroLib")
3923 ("/jhuapl/" . "JHUAPL-Lib")
3924 ("/dominik/lib/idl/" . "MyLib")))
797c8ebc
CD
3925@end lisp
3926
3927However, if you are an Emacs power-user and want IDLWAVE to work
5af23035
S
3928completely differently, you can change almost every aspect of it. Here
3929is an example of a much more extensive configuration of IDLWAVE. The
a8e833f3 3930user is King!
797c8ebc
CD
3931
3932@example
3933;;; Settings for IDLWAVE mode
3934
3935(setq idlwave-block-indent 3) ; Indentation settings
3936(setq idlwave-main-block-indent 3)
3937(setq idlwave-end-offset -3)
3938(setq idlwave-continuation-indent 1)
12b86f0e 3939(setq idlwave-begin-line-comment "^;[^;]") ; Leave ";" but not ";;"
797c8ebc
CD
3940 ; anchored at start of line.
3941(setq idlwave-surround-by-blank t) ; Turn on padding ops =,<,>
3942(setq idlwave-pad-keyword nil) ; Remove spaces for keyword '='
3943(setq idlwave-expand-generic-end t) ; convert END to ENDIF etc...
3944(setq idlwave-reserved-word-upcase t) ; Make reserved words upper case
3945 ; (with abbrevs only)
3946(setq idlwave-abbrev-change-case nil) ; Don't force case of expansions
3947(setq idlwave-hang-indent-regexp ": ") ; Change from "- " for auto-fill
3948(setq idlwave-show-block nil) ; Turn off blinking to begin
3949(setq idlwave-abbrev-move t) ; Allow abbrevs to move point
5af23035
S
3950(setq idlwave-query-class '((method-default . nil) ; No query for method
3951 (keyword-default . nil); or keyword completion
3952 ("INIT" . t) ; except for these
3953 ("CLEANUP" . t)
3954 ("SETPROPERTY" .t)
3955 ("GETPROPERTY" .t)))
797c8ebc 3956
12b86f0e
S
3957;; Using w3m for help (must install w3m and emacs-w3m)
3958(autoload 'w3m-browse-url "w3m" "Interface for w3m on Emacs." t)
3959(setq idlwave-help-browser-function 'w3m-browse-url
3960 w3m-use-tab nil ; no tabs, location line, or toolbar
3961 w3m-use-header-line nil
3962 w3m-use-toolbar nil)
3963
3964;; Close my help window or frame when w3m closes with `q'
3965(defadvice w3m-close-window (after idlwave-close activate)
3966 (if (boundp 'idlwave-help-frame)
3967 (idlwave-help-quit)))
3968
797c8ebc 3969;; Some setting can only be done from a mode hook. Here is an example:
797c8ebc
CD
3970(add-hook 'idlwave-mode-hook
3971 (lambda ()
797c8ebc
CD
3972 (setq case-fold-search nil) ; Make searches case sensitive
3973 ;; Run other functions here
3974 (font-lock-mode 1) ; Turn on font-lock mode
3975 (idlwave-auto-fill-mode 0) ; Turn off auto filling
12b86f0e 3976 (setq idlwave-help-browser-function 'browse-url-w3)
5af23035 3977
32d4cddb 3978 ;; Pad with 1 space (if -n is used then make the
797c8ebc
CD
3979 ;; padding a minimum of n spaces.) The defaults use -1
3980 ;; instead of 1.
3981 (idlwave-action-and-binding "=" '(idlwave-expand-equal 1 1))
3982 (idlwave-action-and-binding "<" '(idlwave-surround 1 1))
3983 (idlwave-action-and-binding ">" '(idlwave-surround 1 1 '(?-)))
3984 (idlwave-action-and-binding "&" '(idlwave-surround 1 1))
5af23035 3985
797c8ebc
CD
3986 ;; Only pad after comma and with exactly 1 space
3987 (idlwave-action-and-binding "," '(idlwave-surround nil 1))
ea442c62 3988 (idlwave-action-and-binding "&" '(idlwave-surround 1 1))
5af23035 3989
ea442c62
CD
3990 ;; Pad only after `->', remove any space before the arrow
3991 (idlwave-action-and-binding "->" '(idlwave-surround 0 -1 nil 2))
5af23035 3992
797c8ebc
CD
3993 ;; Set some personal bindings
3994 ;; (In this case, makes `,' have the normal self-insert behavior.)
3995 (local-set-key "," 'self-insert-command)
5af23035
S
3996 (local-set-key [f5] 'idlwave-shell-break-here)
3997 (local-set-key [f6] 'idlwave-shell-clear-current-bp)
3998
797c8ebc
CD
3999 ;; Create a newline, indenting the original and new line.
4000 ;; A similar function that does _not_ reindent the original
4001 ;; line is on "\C-j" (The default for emacs programming modes).
4002 (local-set-key "\n" 'idlwave-newline)
4003 ;; (local-set-key "\C-j" 'idlwave-newline) ; My preference.
5af23035
S
4004
4005 ;; Some personal abbreviations
12b86f0e 4006 (define-abbrev idlwave-mode-abbrev-table
5af23035
S
4007 (concat idlwave-abbrev-start-char "wb") "widget_base()"
4008 (idlwave-keyword-abbrev 1))
12b86f0e 4009 (define-abbrev idlwave-mode-abbrev-table
5af23035
S
4010 (concat idlwave-abbrev-start-char "on") "obj_new()"
4011 (idlwave-keyword-abbrev 1))
797c8ebc
CD
4012 ))
4013
4014;;; Settings for IDLWAVE SHELL mode
4015
4016(setq idlwave-shell-overlay-arrow "=>") ; default is ">"
4017(setq idlwave-shell-use-dedicated-frame t) ; Make a dedicated frame
4018(setq idlwave-shell-prompt-pattern "^WAVE> ") ; default is "^IDL> "
4019(setq idlwave-shell-explicit-file-name "wave")
4020(setq idlwave-shell-process-name "wave")
797c8ebc 4021(setq idlwave-shell-use-toolbar nil) ; No toolbar
5af23035
S
4022
4023;; Most shell interaction settings can be done from the shell-mode-hook.
4024(add-hook 'idlwave-shell-mode-hook
4025 (lambda ()
4026 ;; Set up some custom key and mouse examine commands
12b86f0e
S
4027 (idlwave-shell-define-key-both [s-down-mouse-2]
4028 (idlwave-shell-mouse-examine
5af23035
S
4029 "print, size(___,/DIMENSIONS)"))
4030 (idlwave-shell-define-key-both [f9] (idlwave-shell-examine
4031 "print, size(___,/DIMENSIONS)"))
12b86f0e 4032 (idlwave-shell-define-key-both [f10] (idlwave-shell-examine
5af23035
S
4033 "print,size(___,/TNAME)"))
4034 (idlwave-shell-define-key-both [f11] (idlwave-shell-examine
4035 "help,___,/STRUCTURE"))))
797c8ebc
CD
4036@end example
4037
4111a42b 4038@html
76959b77 4039<A NAME="WIN_MAC"></A>
4111a42b 4040@end html
12b86f0e 4041@node Windows and MacOS, Troubleshooting, Configuration Examples, Top
5af23035
S
4042@appendix Windows and MacOS
4043@cindex Windows
4044@cindex MacOS
12b86f0e 4045@cindex MacOSX
5af23035 4046
12b86f0e
S
4047IDLWAVE was developed on a UNIX system. However, thanks to the
4048portability of Emacs, much of IDLWAVE does also work under different
4049operating systems like Windows (with NTEmacs or NTXEmacs) or MacOS.
5af23035 4050
4111a42b
S
4051The only real problem is that there is no command-line version of IDL
4052for Windows or MacOS(<=9) with which IDLWAVE can interact. As a
4053result, the IDLWAVE Shell does not work and you have to rely on IDLDE
4054to run and debug your programs. However, editing IDL source files
4055with Emacs/IDLWAVE works with all bells and whistles, including
4056routine info, completion and fast online help. Only a small amount of
4057additional information must be specified in your @file{.emacs} file:
4058the path names which, on a UNIX system, are automatically gathered by
4059talking to the IDL program.
5af23035
S
4060
4061Here is an example of the additional configuration needed for a Windows
4062system. I am assuming that IDLWAVE has been installed in
4063@w{@samp{C:\Program Files\IDLWAVE}} and that IDL is installed in
4111a42b 4064@w{@samp{C:\RSI\IDL62}}.
5af23035
S
4065
4066@lisp
4111a42b
S
4067;; location of the lisp files (only needed if IDLWAVE is not part of
4068;; your default X/Emacs installation)
5af23035
S
4069(setq load-path (cons "c:/program files/IDLWAVE" load-path))
4070
4111a42b 4071;; The location of the IDL library directories, both standard, and your own.
5af23035
S
4072;; note that the initial "+" expands the path recursively
4073(setq idlwave-library-path
4111a42b 4074 '("+c:/RSI/IDL55/lib/" "+c:/path/to/my/idllibs" ))
5af23035
S
4075
4076;; location of the IDL system directory (try "print,!DIR")
4111a42b 4077(setq idlwave-system-directory "c:/RSI/IDL62/")
5af23035 4078
5af23035
S
4079@end lisp
4080
4081@noindent Furthermore, Windows sometimes tries to outsmart you --- make
4082sure you check the following things:
4083
4084@itemize @bullet
12b86f0e
S
4085@item When you download the IDLWAVE distribution, make sure you save the
4086file under the names @file{idlwave.tar.gz}.
5af23035
S
4087@item M-TAB switches among running programs --- use Esc-TAB
4088instead.
4089@item Other issues as yet unnamed...
4090@end itemize
4091
12b86f0e
S
4092Windows users who'd like to make use of IDLWAVE's context-aware HTML
4093help can skip the browser and use the HTMLHelp functionality directly.
4094@xref{Help with HTML Documentation}.
4095
4111a42b 4096@html
12b86f0e 4097<A NAME="TROUBLE"></A>
4111a42b 4098@end html
12b86f0e
S
4099@node Troubleshooting, Index, Windows and MacOS, Top
4100@appendix Troubleshooting
4101@cindex Troubleshooting
4102
4103Although IDLWAVE usually installs and works without difficulty, a few
4104common problems and their solutions are documented below.
4105
4106@enumerate
4107
4108@item @strong{Whenever an IDL error occurs or a breakpoint is hit, I get
4109errors or strange behavior when I try to type anything into some of my
4110IDLWAVE buffers.}
4111
4112This is a @emph{feature}, not an error. You're in @emph{Electric
4113Debug Mode} (@pxref{Electric Debug Mode}). You should see
4114@code{*Debugging*} in the mode-line. The buffer is read-only and all
4115debugging and examination commands are available as single keystrokes;
4116@kbd{C-?} lists these shortcuts. Use @kbd{q} to quit the mode, and
4117customize the variable @code{idlwave-shell-automatic-electric-debug}
4118if you prefer not to enter electric debug on breakpoints@dots{} but
4119you really should try it before you disable it! You can also
4120customize this variable to enter debug mode when errors are
4111a42b 4121encountered.
12b86f0e
S
4122
4123@item @strong{I get errors like @samp{Searching for program: no such
4124file or directory, idl} when attempting to start the IDL shell.}
4125
4126IDLWAVE needs to know where IDL is in order to run it as a process.
4127By default, it attempts to invoke it simply as @samp{idl}, which
4128presumes such an executable is on your search path. You need to
4129ensure @samp{idl} is on your @samp{$PATH}, or specify the full
4130pathname to the idl program with the variable
4131@code{idlwave-shell-explicit-file-name}. Note that you may need to
4132set your shell search path in two places when running Emacs as an Aqua
4133application with MacOSX; see the next topic.
4134
4135@item @strong{IDLWAVE is disregarding my @samp{IDL_PATH} which I set
4136under MacOSX}
4137
4138If you run Emacs directly as an Aqua application, rather than from the
4139console shell, the environment is set not from your usual shell
4140configuration files (e.g. @file{.cshrc}), but from the file
4141@file{~/.MacOSX/environment.plist}. Either include your path settings
4142there, or start Emacs and IDLWAVE from the shell.
4143
4144@item @strong{I get errors like @samp{Symbol's function is void:
4111a42b 4145overlayp}}
12b86f0e
S
4146
4147You don't have the @samp{fsf-compat} package installed, which IDLWAVE
4111a42b
S
4148needs to run under XEmacs. Install it, or find an XEmacs distribution
4149which includes it by default.
12b86f0e
S
4150
4151@item @strong{I'm getting errors like @samp{Symbol's value as variable is void:
4152cl-builtin-gethash} on completion or routine info.}
4153
4154This error arises if you upgraded Emacs from 20.x to 21.x without
4155re-installing IDLWAVE. Old Emacs and new Emacs are not byte-compatible
4156in compiled lisp files. Presumably, you kept the original .elc files in
4157place, and this is the source of the error. If you recompile (or just
4158"make; make install") from source, it should resolve this problem.
4159Another option is to recompile the @file{idlw*.el} files by hand using
4111a42b 4160@kbd{M-x byte-compile-file}.
12b86f0e
S
4161
4162@item @strong{@kbd{M-@key{TAB}} doesn't complete words, it switches
4163windows on my desktop.}
4164
4165Your system is trapping @kbd{M-@key{TAB}} and using it for its own
4166nefarious purposes: Emacs never sees the keystrokes. On many Unix
4167systems, you can reconfigure your window manager to use another key
4168sequence for switching among windows. Another option is to use the
4169equivalent sequence @kbd{@key{ESC}-@key{TAB}}.
4170
4171@item @strong{When stopping at breakpoints or errors, IDLWAVE does not
4172seem to highlight the relevant line in the source.}
4173
4174IDLWAVE scans for error and halt messages and highlights the stop
4175location in the correct file. However, if you've changed the system
4176variable @samp{!ERROR_STATE.MSG_PREFIX}, it is unable to parse these
4177message correctly. Don't do that.
4178
4179@item @strong{IDLWAVE doesn't work correctly when using ENVI.}
4180
4181Though IDLWAVE was not written with ENVI in mind, it works just fine
4182with it, as long as you update the prompt it's looking for (@samp{IDL>
4183} by default). You can do this with the variable
4184@code{idlwave-shell-prompt-pattern} (@pxref{Starting the Shell}), e.g.,
4185in your @file{.emacs}:
4186
4187@lisp
4111a42b 4188(setq idlwave-shell-prompt-pattern "^\r? ?\\(ENVI\\|IDL\\)> ")
12b86f0e
S
4189@end lisp
4190
4191@item @strong{Attempts to set breakpoints fail: no breakpoint is
4192indicated in the IDLWAVE buffer.}
4193
4194IDL changed its breakpoint reporting format starting with IDLv5.5. The
4195first version of IDLWAVE to support the new format is IDLWAVE v4.10. If
4196you have an older version and are using IDL >v5.5, you need to upgrade,
4197and/or make sure your recent version of IDLWAVE is being found on the
4198Emacs load-path (see the next entry). You can list the version being
4199used with @kbd{C-h v idlwave-mode-version @key{RET}}.
4200
4201@item @strong{I installed a new version of IDLWAVE, but the old
4202version is still being used} or @strong{IDLWAVE works, but when I
4203tried to install the optional modules @file{idlw-roprompt.el} or
4204@file{idlw-complete-structtag}, I get errors like @samp{Cannot open
4205load file}}.
4206
4207The problem is that your Emacs is not finding the version of IDLWAVE you
4208installed. Many Emacsen come with an older bundled copy of IDLWAVE
4209(e.g. v4.7 for Emacs 21.x), which is likely what's being used instead.
4210You need to make sure your Emacs @emph{load-path} contains the directory
4211where IDLWAVE is installed (@file{/usr/local/share/emacs/site-lisp}, by
4212default), @emph{before} Emacs' default search directories. You can
4213accomplish this by putting the following in your @file{.emacs}:
4214
4215@lisp
4216(setq load-path (cons "/usr/local/share/emacs/site-lisp" load-path))
4217@end lisp
4218
4219@noindent You can check on your load-path value using @kbd{C-h v
4111a42b
S
4220load-path @key{RET}}, and @kbd{C-h m} in an IDLWAVE buffer should show
4221you the version Emacs is using.
5af23035 4222
12b86f0e
S
4223@item @strong{IDLWAVE is screwing up the formatting of my @file{.idl} files.}
4224
4225Actually, this isn't IDLWAVE at all, but @samp{idl-mode}, an unrelated
4226programming mode for CORBA's Interface Definition Language (you should
4227see @samp{(IDL)}, not @samp{(IDLWAVE)} in the mode-line). One
4228solution: don't name your file @file{.idl}, but rather @file{.pro}.
4229Another solution: make sure @file{.idl} files load IDLWAVE instead of
4230@samp{idl-mode} by adding the following to your @file{.emacs}:
4231
4232@lisp
4233(setcdr (rassoc 'idl-mode auto-mode-alist) 'idlwave-mode)
4234@end lisp
4235
4236@item @strong{The routine info for my local routines is out of date!}
4237
4238IDLWAVE collects routine info from various locations (@pxref{Routine
4239Information Sources}). Routines in files visited in a buffer or
4240compiled in the shell should be up to date. For other routines, the
4241information is only as current as the most recent scan. If you have a
4242rapidly changing set of routines, and you'd like the latest routine
4111a42b
S
4243information to be available for it, one powerful technique is to make
4244use of the library catalog tool, @samp{idlwave_catalog}. Simply add a
4245line to your @samp{cron} file (@samp{crontab -e} will let you edit this
4246on some systems), like this
12b86f0e
S
4247
4248@example
424945 3 * * 1-5 (cd /path/to/myidllib; /path/to/idlwave_catalog MyLib)
4250@end example
4251
4252@noindent where @samp{MyLib} is the name of your library. This will
4253rescan all @file{.pro} files at or below @file{/path/to/myidllib} every
4254week night at 3:45am. You can even scan site-wide libraries with this
4255method, and the most recent information will be available to all users.
4111a42b 4256Since the scanning is very fast, there is very little impact.
12b86f0e
S
4257
4258@item @strong{All the Greek-font characters in the HTML help are
4259displayed as Latin characters!}
4260
4111a42b 4261Unfortunately, the HTMLHelp files RSI provides attempt to switch to
12b86f0e
S
4262@samp{Symbol} font to display Greek characters, which is not really an
4263permitted method for doing this in HTML. There is a "workaround" for
4111a42b 4264some browsers: @xref{HTML Help Browser Tips}.
12b86f0e
S
4265
4266@item @strong{In the shell, my long commands are truncated at 256 characters!}
4267
4268This actually happens when running IDL in an XTerm as well. There are
4dc5fe62 4269a couple of workarounds: @code{define_key,/control,'^d'} (e.g. in
12b86f0e
S
4270your @file{$IDL_STARTUP} file) will disable the @samp{EOF} character
4271and give you a 512 character limit. You won't be able to use
4272@key{C-d} to quit the shell, however. Another possibility is
4273@code{!EDIT_INPUT=0}, which gives you an @emph{infinite} limit (OK, a
4274memory-bounded limit), but disables the processing of background
4275widget events (those with @code{/NO_BLOCK} passed to @code{XManager}).
4276
4111a42b
S
4277@item @strong{When I invoke IDL HTML help on a routine, the page which
4278is loaded is one page off, e.g. for @code{CONVERT_COORD}, I get
4279@code{CONTOUR}.}
4280
4281You have a mismatch between your help index and the HTML help package
4282you downloaded. You need to ensure you download a ``downgrade kit'' if
4283you are using anything older than the latest HTML help package. A new
4dc5fe62 4284help package appears with each IDL release (assuming the documentation
4111a42b 4285is updated).
5a2881c2 4286Starting with IDL 6.2, the HTML help and its catalog are
4111a42b
S
4287distributed with IDL, and so should never be inconsistent.
4288
4289@item @strong{I get errors such as @samp{void-variable
4290browse-url-browser-function} or similar when attempting to load IDLWAVE
4291under XEmacs.}
4292
4293You don't have the @samp{browse-url} (or other required) XEmacs package.
4294Unlike GNU Emacs, XEmacs distributes many packages separately from the
4295main program. IDLWAVE is actually among these, but is not always the
4296most up to date. When installing IDLWAVE as an XEmacs package, it
4297should prompt you for required additional packages. When installing it
4298from source, it won't and you'll get this error. The easiest solution
4299is to install all the packages when you install XEmacs (the so-called
4300@samp{sumo} bundle). The minimum set of XEmacs packages required by
4301IDLWAVE is @samp{fsf-compat, xemacs-base, mail-lib}.
4302
12b86f0e
S
4303@end enumerate
4304
4305@node Index, , Troubleshooting, Top
797c8ebc
CD
4306@unnumbered Index
4307@printindex cp
4308
797c8ebc 4309@bye
667832a1
MB
4310
4311@ignore
4312 arch-tag: f1d73958-1423-4127-b8aa-f7b953d64492
4313@end ignore