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