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