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