idlwave.texi 171 KB

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