annotate lisp/progmodes/idlwave.el @ 34342:9e4506dd912e

Update copyright.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 07 Dec 2000 13:44:15 +0000
parents dd613770eb0f
children 31e98a1ac98f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1 ;;; idlwave.el --- IDL and WAVE CL editing mode for GNU Emacs
34342
9e4506dd912e Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
2
9e4506dd912e Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
3 ;; Copyright (c) 1994, 1995, 1997, 1999, 2000 Free Software Foundation
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5 ;; Author: Chris Chase <chase@att.com>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6 ;; Maintainer: Carsten Dominik <dominik@strw.leidenuniv.nl>
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
7 ;; Version: 4.2
34342
9e4506dd912e Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
8 ;; Date: $Date: 2000/12/06 19:46:15 $
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
9 ;; Keywords: languages
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
10
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
11 ;; This file is part of the GNU Emacs.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
12
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
16 ;; any later version.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
17
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
21 ;; GNU General Public License for more details.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
22
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
27
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
28 ;;; Commentary:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
29
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
30 ;; In distant past, based on pascal.el. Though bears little
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
31 ;; resemblance to that now.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
32 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
33 ;; Incorporates many ideas, such as abbrevs, action routines, and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
34 ;; continuation line indenting, from wave.el.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
35 ;; wave.el original written by Lubos Pochman, Precision Visuals, Boulder.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
36 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
37 ;; See the mode description ("C-h m" in idlwave-mode or "C-h f idlwave-mode")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
38 ;; for features, key bindings, and info.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
39 ;; Also, Info format documentation is available with `M-x idlwave-info'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
40 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
41 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
42 ;; INSTALLATION
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
43 ;; ============
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
44 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
45 ;; Follow the instructions in the INSTALL file of the distribution.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
46 ;; In short, put this file on your load path and add the following
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
47 ;; lines to your .emacs file:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
48 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
49 ;; (autoload 'idlwave-mode "idlwave" "IDLWAVE Mode" t)
27107
7b2b73f13427 Renamed idlwave-*.el into idlw-*.el.
Eli Zaretskii <eliz@gnu.org>
parents: 26956
diff changeset
50 ;; (autoload 'idlwave-shell "idlw-shell" "IDLWAVE Shell" t)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
51 ;; (setq auto-mode-alist (cons '("\\.pro\\'" . idlwave-mode) auto-mode-alist))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
52 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
53 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
54 ;; SOURCE
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
55 ;; ======
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
56 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
57 ;; The newest version of this file is available from the maintainers
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
58 ;; Webpage.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
59 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
60 ;; http://www.strw.leidenuniv.el/~dominik/Tools/idlwave
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
61 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
62 ;; DOCUMENTATION
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
63 ;; =============
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
64 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
65 ;; IDLWAVE is documented online in info format.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
66 ;; A printable version of the documentation is available from the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
67 ;; maintainers webpage (see under SOURCE)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
68 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
69 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
70 ;; ACKNOWLEDGMENTS
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
71 ;; ===============
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
72 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
73 ;; Thanks to the following people for their contributions and comments:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
74 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
75 ;; Ulrik Dickow <dickow@nbi.dk>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
76 ;; Eric E. Dors <edors@lanl.gov>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
77 ;; Stein Vidar H. Haugan <s.v.h.haugan@astro.uio.no>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
78 ;; David Huenemoerder <dph@space.mit.edu>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
79 ;; Kevin Ivory <Kevin.Ivory@linmpi.mpg.de>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
80 ;; Xuyong Liu <liu@stsci.edu>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
81 ;; Simon Marshall <Simon.Marshall@esrin.esa.it>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
82 ;; Laurent Mugnier <mugnier@onera.fr>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
83 ;; Lubos Pochman <lubos@rsinc.com>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
84 ;; Patrick M. Ryan <pat@jaameri.gsfc.nasa.gov>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
85 ;; Marty Ryba <ryba@ll.mit.edu>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
86 ;; Phil Williams <williams@irc.chmcc.org>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
87 ;; J.D. Smith <jdsmith@astrosun.tn.cornell.edu>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
88 ;; Phil Sterne <sterne@dublin.llnl.gov>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
89 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
90 ;; CUSTOMIZATION:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
91 ;; =============
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
92 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
93 ;; IDLWAVE has customize support - so if you want to learn about the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
94 ;; variables which control the behavior of the mode, use
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
95 ;; `M-x idlwave-customize'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
96 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
97 ;; You can set your own preferred values with Customize, or with Lisp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
98 ;; code in .emacs. For an example of what to put into .emacs, check
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
99 ;; the TexInfo documentation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
100 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
101 ;; KNOWN PROBLEMS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
102 ;; ==============
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
103 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
104 ;; Moving the point backwards in conjunction with abbrev expansion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
105 ;; does not work as I would like it, but this is a problem with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
106 ;; emacs abbrev expansion done by the self-insert-command. It ends
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
107 ;; up inserting the character that expanded the abbrev after moving
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
108 ;; point backward, e.g., "\cl" expanded with a space becomes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
109 ;; "LONG( )" with point before the close paren. This is solved by
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
110 ;; using a temporary function in `post-command-hook' - not pretty,
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
111 ;; but it works.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
112 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
113 ;; Tabs and spaces are treated equally as whitespace when filling a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
114 ;; comment paragraph. To accomplish this, tabs are permanently
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
115 ;; replaced by spaces in the text surrounding the paragraph, which
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
116 ;; may be an undesirable side-effect. Replacing tabs with spaces is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
117 ;; limited to comments only and occurs only when a comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
118 ;; paragraph is filled via `idlwave-fill-paragraph'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
119 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
120 ;; "&" is ignored when parsing statements.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
121 ;; Avoid muti-statement lines (using "&") on block begin and end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
122 ;; lines. Multi-statement lines can mess up the formatting, for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
123 ;; example, multiple end statements on a line: endif & endif.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
124 ;; Using "&" outside of block begin/end lines should be okay.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
125 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
126 ;; It is possible that the parser which decides what to complete has
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
127 ;; problems with pointer dereferencing statements. I don't use
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
128 ;; pointers often enough to find out - please report any problems.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
129 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
130 ;; Completion and Routine Info do not know about inheritance. Thus,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
131 ;; Keywords inherited from superclasses are not displayed and cannot
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
132 ;; completed.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
133 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
134 ;; When forcing completion of method keywords, the initial
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
135 ;; query for a method has multiple entries for some methods. Would
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
136 ;; be too difficult to fix this hardly used case.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
137 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
138
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
139 ;;; Code:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
140
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
141 (eval-when-compile (require 'cl))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
142
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
143 (eval-and-compile
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
144 ;; Kludge to allow `defcustom' for Emacs 19.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
145 (condition-case () (require 'custom) (error nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
146 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
147 nil ;; We've got what we needed
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
148 ;; We have the old or no custom-library, hack around it!
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
149 (defmacro defgroup (&rest args) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
150 (defmacro defcustom (var value doc &rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
151 (` (defvar (, var) (, value) (, doc))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
152
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
153 (defgroup idlwave nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
154 "Major mode for editing IDL/WAVE CL .pro files"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
155 :tag "IDLWAVE"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
156 :link '(url-link :tag "Home Page"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
157 "http://strw.leidenuniv.nl/~dominik/Tools/idlwave")
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
158 :link '(emacs-commentary-link :tag "Commentary in idlw-shell.el"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
159 "idlw-shell.el")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
160 :link '(emacs-commentary-link :tag "Commentary in idlwave.el" "idlwave.el")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
161 :link '(custom-manual "(idlwave)Top")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
162 :prefix "idlwave"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
163 :group 'languages)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
164
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
165 ;;; Variables for indentation behavior ---------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
166
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
167 (defgroup idlwave-code-formatting nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
168 "Indentation and formatting options for IDLWAVE mode."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
169 :group 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
170
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
171 (defcustom idlwave-main-block-indent 0
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
172 "*Extra indentation for the main block of code.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
173 That is the block between the FUNCTION/PRO statement and the END
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
174 statement for that program unit."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
175 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
176 :type 'integer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
177
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
178 (defcustom idlwave-block-indent 4
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
179 "*Extra indentation applied to block lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
180 If you change this, you probably also want to change `idlwave-end-offset'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
181 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
182 :type 'integer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
183
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
184 (defcustom idlwave-end-offset -4
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
185 "*Extra indentation applied to block END lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
186 A value equal to negative `idlwave-block-indent' will make END lines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
187 line up with the block BEGIN lines."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
188 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
189 :type 'integer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
190
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
191 (defcustom idlwave-continuation-indent 2
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
192 "*Extra indentation applied to continuation lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
193 This extra offset applies to the first of a set of continuation lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
194 The following lines receive the same indentation as the first.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
195 Also, the value of this variable applies to continuation lines inside
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
196 parenthesis. When the current line contains an open unmatched ([{,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
197 the next line is indented to that parenthesis plus the value of this variable."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
198 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
199 :type 'integer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
200
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
201 (defcustom idlwave-hanging-indent t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
202 "*If set non-nil then comment paragraphs are indented under the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
203 hanging indent given by `idlwave-hang-indent-regexp' match in the first line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
204 of the paragraph."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
205 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
206 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
207
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
208 (defcustom idlwave-hang-indent-regexp "- "
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
209 "*Regular expression matching the position of the hanging indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
210 in the first line of a comment paragraph. The size of the indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
211 extends to the end of the match for the regular expression."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
212 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
213 :type 'regexp)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
214
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
215 (defcustom idlwave-use-last-hang-indent nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
216 "*If non-nil then use last match on line for `idlwave-indent-regexp'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
217 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
218 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
219
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
220 (defcustom idlwave-fill-comment-line-only t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
221 "*If non-nil then auto fill will only operate on comment lines."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
222 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
223 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
224
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
225 (defcustom idlwave-auto-fill-split-string t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
226 "*If non-nil then auto fill will split strings with the IDL `+' operator.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
227 When the line end falls within a string, string concatenation with the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
228 '+' operator will be used to distribute a long string over lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
229 If nil and a string is split then a terminal beep and warning are issued.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
230
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
231 This variable is ignored when `idlwave-fill-comment-line-only' is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
232 non-nil, since in this case code is not auto-filled."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
233 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
234 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
235
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
236 (defcustom idlwave-split-line-string t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
237 "*If non-nil then `idlwave-split-line' will split strings with `+'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
238 When the splitting point of a line falls inside a string, split the string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
239 using the `+' string concatenation operator. If nil and a string is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
240 split then a terminal beep and warning are issued."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
241 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
242 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
243
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
244 (defcustom idlwave-no-change-comment ";;;"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
245 "*The indentation of a comment that starts with this regular
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
246 expression will not be changed. Note that the indentation of a comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
247 at the beginning of a line is never changed."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
248 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
249 :type 'string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
250
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
251 (defcustom idlwave-begin-line-comment nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
252 "*A comment anchored at the beginning of line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
253 A comment matching this regular expression will not have its
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
254 indentation changed. If nil the default is \"^;\", i.e., any line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
255 beginning with a \";\". Expressions for comments at the beginning of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
256 the line should begin with \"^\"."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
257 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
258 :type '(choice (const :tag "Any line beginning with `;'" nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
259 'regexp))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
260
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
261 (defcustom idlwave-code-comment ";;[^;]"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
262 "*A comment that starts with this regular expression on a line by
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
263 itself is indented as if it is a part of IDL code. As a result if
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
264 the comment is not preceded by whitespace it is unchanged."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
265 :group 'idlwave-code-formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
266 :type 'regexp)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
267
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
268 ;; Comments not matching any of the above will be indented as a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
269 ;; right-margin comment, i.e., to a minimum of `comment-column'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
270
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
271
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
272 ;;; Routine Info and Completion ---------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
273
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
274 (defgroup idlwave-routine-info nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
275 "Routine Info options for IDLWAVE mode."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
276 :group 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
277
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
278 (defcustom idlwave-scan-all-buffers-for-routine-info t
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
279 "*Non-nil means, scan buffers for IDL programs when updating info.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
280 The scanning is done by the command `idlwave-update-routine-info'.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
281 The following values are allowed:
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
282
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
283 nil Don't scan any buffers.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
284 t Scan all idlwave-mode buffers in the current editing session.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
285 current Scan only the current buffer, but no other buffers."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
286 :group 'idlwave-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
287 :type '(choice
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
288 (const :tag "No buffer" nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
289 (const :tag "All buffers" t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
290 (const :tag "Current buffer only" 'current)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
291
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
292 (defcustom idlwave-query-shell-for-routine-info t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
293 "*Non-nil means query the shell for info about compiled routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
294 Querying the shell is useful to get information about compiled modules,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
295 and it is turned on by default. However, when you have a complete library
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
296 scan, this is not necessary."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
297 :group 'idlwave-routine-info
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
298 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
299
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
300 (defcustom idlwave-auto-routine-info-updates
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
301 '(find-file save-buffer kill-buffer compile-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
302 "*Controls under what circumstances routine info is updated automatically.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
303 Possible values:
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
304 nil Never
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
305 t All available
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
306 (...) A list of circumstances. Allowed members are:
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
307 find-file Add info for new IDLWAVE buffers.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
308 save-buffer Update buffer info when buffer is saved
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
309 kill-buffer Remove buffer info when buffer gets killed
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
310 compile-buffer Update shell info after `idlwave-shell-save-and...'"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
311 :group 'idlwave-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
312 :type '(choice
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
313 (const :tag "Never" nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
314 (const :tag "As often as possible" t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
315 (set :tag "Checklist" :greedy t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
316 (const :tag "When visiting a file" find-file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
317 (const :tag "When saving a buffer" save-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
318 (const :tag "After a buffer was killed" kill-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
319 (const :tag "After a buffer was compiled successfully, update shell info" compile-buffer))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
320
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
321 (defcustom idlwave-rinfo-max-source-lines 5
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
322 "*Maximum number of source files displayed in the Routine Info window.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
323 When an integer, it is the maximum number of source files displayed.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
324 t means to show all source files."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
325 :group 'idlwave-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
326 :type 'integer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
327
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
328 (defcustom idlwave-library-path nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
329 "Library path for Windows and MacOS. Not needed under Unix.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
330 When selecting the directories to scan for IDL library routine info,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
331 IDLWAVE can under UNIX query the shell for the exact search path.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
332 However, under Windows and MacOS, the IDLWAVE shell does not work. In this
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
333 case, this variable specifies the path where IDLWAVE can find library files.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
334 The shell will only be asked when this variable is nil.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
335 The value is a list of directories. A directory preceeded by a `+' will
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
336 be searched recursively. If you set this variable on a UNIX system, the shell
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
337 will not be asked.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
338 See also `idlwave-system-directory'."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
339 :group 'idlwave-routine-info
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
340 :type '(repeat (directory)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
341
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
342 (defcustom idlwave-system-directory ""
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
343 "The IDL system directory for Windows and MacOS. Not needed under UNIX.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
344 Set this to the value of the `!DIR' system variable in IDL. IDLWAVE uses
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
345 this to find out which of the library routines belong to the official system
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
346 library. All files inside the `lib' subdirectory are considered system
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
347 library files - so don't install private stuff in this directory.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
348 On UNIX systems, IDLWAVE queries the shell for the value of `!DIR'.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
349 See also `idlwave-library-path'."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
350 :group 'idlwave-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
351 :type 'directory)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
352
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
353 (defcustom idlwave-libinfo-file "~/.idlcat.el"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
354 "*File for routine information of the IDL library.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
355 When this points to a file, the file will be loaded when IDLWAVE first
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
356 accesses routine info (or does completion).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
357 When you scan the library with `idlwave-create-libinfo-file', this file
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
358 will be used to store the result."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
359 :group 'idlwave-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
360 :type 'file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
361
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
362 (defcustom idlwave-special-lib-alist nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
363 "Alist of regular expressions matching special library directories.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
364 When listing routine source locations, IDLWAVE gives a short hint where
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
365 the file defining the routine is located. By default it lists `SystemLib'
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
366 for routines in the system library `!DIR/lib' and `Library' for anything
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
367 else. This variable can define additional types. The car of each entry
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
368 is a regular expression matching the file name (they normally will match
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
369 on the path). The cdr is the string to be used as identifier. Max 10
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
370 chars are allowed."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
371 :group 'idlwave-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
372 :type '(repeat
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
373 (cons regexp string)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
374
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
375 (defgroup idlwave-online-help nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
376 "Online Help options for IDLWAVE mode."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
377 :group 'idlwave)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
378
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
379 (defcustom idlwave-help-directory ""
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
380 "The directory where idlw-help.txt and idlw-help.el are stored."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
381 :group 'idlwave-online-help
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
382 :type 'file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
383
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
384 (defcustom idlwave-help-use-dedicated-frame t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
385 "*Non-nil means, use a separate frame for Online Help if possible."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
386 :group 'idlwave-online-help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
387 :type 'boolean)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
388
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
389 (defcustom idlwave-help-frame-parameters
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
390 '((height . 20) (unsplittable . t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
391 "The frame parameters for the special Online Help frame.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
392 See also `idlwave-help-use-dedicated-frame'.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
393 If you do not set the frame width here, the value specified in
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
394 `idlw-help.el' will be used."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
395 :group 'idlwave-online-help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
396 :type '(repeat
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
397 (cons symbol sexp)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
398
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
399 (defcustom idlwave-max-popup-menu-items 20
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
400 "Maximum number of items per pane in popup menus.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
401 Currently only used for class selection during completion help."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
402 :group 'idlwave-online-help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
403 :type 'integer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
404
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
405 (defcustom idlwave-extra-help-function 'idlwave-help-with-source
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
406 "The function to call for online help if the normal help fails.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
407 Online help works only for system routines which are described in the
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
408 IDL manuals. A function may be specified to access help from other sources.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
409
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
410 The function must accept four arguments: NAME, TYPE, CLASS, KEYWORD.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
411 The Help buffer is current when this function is called, and the help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
412 text should be loaded into this buffer. If help is found, the function
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
413 should return the buffer position which should be used as `window-start'
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
414 in the help window. Also, the variable `idlwave-help-mode-line-indicator'
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
415 should be set to a useful string, which will be displayed in the mode line
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
416 of the help window. If should also set the variable `idlwave-min-frame-width'
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
417 to a positive integer. IDLWAVE will ensure that the help frame is at
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
418 least that many columns wide.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
419 Failure to find help should be indicated by throwing an error.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
420
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
421 When this variable is non-nil, IDLWAVE will allow the mouse-3 help click
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
422 for every routine and keyword, even though the item may not be highlighted
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
423 in blue (indicating the availability of system documentation).
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
424
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
425 The default value for this function is `idlwave-help-with-source' which
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
426 loads the routine source file into the help buffer. If you try to write
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
427 a different function which accesses a special help file or so, it is
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
428 probably a good idea to still call this function as a fallback."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
429 :group 'idlwave-online-help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
430 :type 'symbol)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
431
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
432 (defcustom idlwave-help-fontify-source-code nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
433 "*Non-nil means, fontify source code displayed as help like normal code."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
434 :group 'idlwave-online-help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
435 :type 'boolean)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
436
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
437 (defcustom idlwave-help-source-try-header t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
438 "*Non-nil means, try to find help in routine header when displaying source.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
439 Routines which are not documented in the system manual use their source as
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
440 help text. When this variable is non-nil, we try to find a description of
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
441 the help item in the first routine doclib header above the routine definition.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
442 If the variable is nil, or if we cannot find/parse the header, the routine
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
443 definition is displayed instead."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
444 :group 'idlwave-online-help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
445 :type 'boolean)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
446
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
447 (defface idlwave-help-link-face
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
448 '((((class color)) (:foreground "Blue"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
449 (t (:bold t)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
450 "Face for highlighting links into IDLWAVE online help."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
451 :group 'idlwave-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
452
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
453 (defgroup idlwave-completion nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
454 "Completion options for IDLWAVE mode."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
455 :prefix "idlwave"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
456 :group 'idlwave)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
457
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
458 (eval-and-compile
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
459 (defconst idlwave-tmp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
460 '(choice :tag "by applying the function"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
461 (const upcase)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
462 (const downcase)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
463 (const capitalize)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
464 (const preserve)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
465 (symbol :tag "Other"))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
466
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
467 (defcustom idlwave-completion-case '((routine . upcase)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
468 (keyword . upcase)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
469 (class . preserve)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
470 (method . preserve))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
471 "Association list setting the case of completed words.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
472
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
473 This variable determines the case (UPPER/lower/Capitalized...) of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
474 words inserted into the buffer by completion. The preferred case can
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
475 be specified separately for routine names, keywords, classes and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
476 methods.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
477 This alist should therefore have entries for `routine' (normal
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
478 functions and procedures, i.e. non-methods), `keyword', `class', and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
479 `method'. Plausible values are
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
480
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
481 upcase upcase whole word, like `BOX_CURSOR'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
482 downcase downcase whole word, like `read_ppm'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
483 capitalize capitalize each part, like `Widget_Control'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
484 preserve preserve case as is, like `IDLgrView'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
485
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
486 The value can also be any Emacs Lisp function which transforms the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
487 case of characters in a string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
488
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
489 A value of `preserve' means that the case of the completed word is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
490 identical to the way it was written in the definition statement of the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
491 routine. This was implemented to allow for mixed-case completion, in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
492 particular of object classes and methods.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
493 If a completable word is defined in multiple locations, the meaning of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
494 `preserve' is not unique since the different definitions might be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
495 cased differently. Therefore IDLWAVE always takes the case of the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
496 *first* definition it encounters during routine info collection and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
497 uses the case derived from it consistently.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
498
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
499 Note that a lowercase-only string in the buffer will always be completed in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
500 lower case (but see the variable `idlwave-completion-force-default-case').
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
501
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
502 After changing this variable, you need to either restart Emacs or press
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
503 `C-u C-c C-i' to update the internal lists."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
504 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
505 :type `(repeat
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
506 (cons (symbol :tag "Derive completion case for")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
507 ,idlwave-tmp)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
508
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
509 (defcustom idlwave-completion-force-default-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
510 "*Non-nil means, completion will always honor `idlwave-completion-case'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
511 When nil, only the completion of a mixed case or upper case string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
512 will honor the default settings in `idlwave-completion-case', while
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
513 the completion of lower case strings will be completed entirely in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
514 lower case."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
515 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
516 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
517
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
518 (defcustom idlwave-complete-empty-string-as-lower-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
519 "*Non-nil means, the empty string is considered downcase for completion.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
520 The case of what is already in the buffer determines the case of completions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
521 When this variable is non-nil, the empty string is considered to be downcase.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
522 Completing on the empty string then offers downcase versions of the possible
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
523 completions."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
524 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
525 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
526
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
527 (defvar idlwave-default-completion-case-is-down nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
528 "Obsolete variable. See `idlwave-complete-empty-string-as-lower-case' and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
529 `idlwave-completion-case'.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
530
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
531 (defcustom idlwave-buffer-case-takes-precedence nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
532 "*Non-nil means, the case of tokens in buffers dominates over system stuff.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
533 To make this possible, we need to re-case everything each time we update
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
534 the routine info from the buffers. This is slow.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
535 The default is to consider the case given in the system and library files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
536 first which makes updating much faster."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
537 :group 'idlwave-completion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
538 :type 'boolean)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
539
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
540 (defcustom idlwave-highlight-help-links-in-completion t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
541 "*Non-nil means, highlight completions for which system help is available.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
542 Help can then be accessed with mouse-3.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
543 This option is only effective when the online help system is installed."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
544 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
545 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
546
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
547 (defcustom idlwave-completion-show-classes 1
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
548 "*Number of classes to show when completing object methods and keywords.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
549 When completing methods or keywords for an object with unknown class,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
550 the *Completions* buffer will show the legal classes for each completion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
551 like this:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
552
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
553 MyMethod <Class1,Class2,Class3>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
554
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
555 The value of this variable may be nil to inhibit display, or an integer to
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
556 indicate the maximum number of classes to display.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
557
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
558 On XEmacs, a full list of classes will also be placed into a `help-echo'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
559 property on the competion items, so that the list of classes for the current
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
560 item is displayed in the echo area. If the value of this variable is a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
561 negative integer, the `help-echo' property will be suppressed."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
562 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
563 :type '(choice (const :tag "Don't show" nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
564 (integer :tag "Number of classes shown" 1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
565
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
566 (defcustom idlwave-completion-fontify-classes t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
567 "*Non-nil means, fontify the classes in completions buffer.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
568 This makes it easier to distinguish the completion items from the extra
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
569 class info listed. See `idlwave-completion-show-classes'."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
570 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
571 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
572
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
573 (defcustom idlwave-query-class '((method-default . nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
574 (keyword-default . nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
575 "Association list governing specification of object classes for completion.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
576
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
577 When IDLWAVE is trying to complete items which belong to the object
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
578 oriented part of IDL, it usually cannot determine the class of a given
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
579 object from context. In order to provide the user with a correct list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
580 of methods or keywords, it would have to determine the appropriate
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
581 class. IDLWAVE has two ways to deal with this problem.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
582
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
583 1. One possibility is to combine the items of all available
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
584 classes for the purpose of completion. So when completing a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
585 method, all methods of all classes are available, and when
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
586 completing a keyword, all keywords allowed for this method in any
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
587 class will be possible completions. This behavior is very much
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
588 like normal completion and is therefore the default. It works much
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
589 better than one might think - only for the INIT, GETPROPERTY and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
590 SETPROPERTY the keyword lists become uncomfortably long.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
591 See also `idlwave-completion-show-classes'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
592
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
593 2. The second possibility is to ask the user on each occasion. To
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
594 make this less interruptive, IDLWAVE can store the class as a text
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
595 property on the object operator `->'. For a given object in the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
596 source code, class selection will then be needed only once
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
597 - for example to complete the method. Keywords to the method can
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
598 then be completed directly, because the class is already known.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
599 You will have to turn on the storage of the selected class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
600 explicitly with the variable `idlwave-store-inquired-class'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
601
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
602 This variable allows to configure IDLWAVE's behavior during
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
603 completion. Its value is an alist, which should contain at least two
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
604 elements: (method-default . VALUE) and (keyword-default . VALUE),
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
605 where VALUE is either t or nil. These specify if the class should be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
606 determined during method and keyword completion, respectively.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
607
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
608 The alist may have additional entries specifying exceptions from the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
609 keyword completion rule for specific methods, like INIT or
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
610 GETPROPERTY. In order to turn on class specification for the INIT
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
611 method, add an entry (\"INIT\" . t). The method name must be ALL-CAPS."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
612 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
613 :type '(list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
614 (cons (const method-default)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
615 (boolean :tag "Determine class when completing METHODS "))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
616 (cons (const keyword-default)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
617 (boolean :tag "Determine class when completing KEYWORDS "))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
618 (repeat
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
619 :tag "Exceptions to defaults"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
620 :inline t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
621 (cons (string :tag "MODULE" :value "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
622 (boolean :tag "Determine class for this method")))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
623
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
624 (defcustom idlwave-store-inquired-class nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
625 "*Non-nil means, store class of a method call as text property on `->'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
626 IDLWAVE sometimes has to ask the user for the class associated with a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
627 particular object method call. This happens during the commands
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
628 `idlwave-routine-info' and `idlwave-complete', depending upon the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
629 value of the variable `idlwave-query-class'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
630
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
631 When you specify a class, this information can be stored as a text
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
632 property on the `->' arrow in the source code, so that during the same
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
633 editing session, IDLWAVE will not have to ask again. When this
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
634 variable is non-nil, IDLWAVE will store and reuse the class information.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
635 The class stored can be checked and removed with `\\[idlwave-routine-info]'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
636 on the arrow.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
637
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
638 The default of this variable is nil, since the result of commands then
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
639 is more predictable. However, if you know what you are doing, it can
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
640 be nice to turn this on.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
641
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
642 An arrow which knows the class will be highlighted with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
643 `idlwave-class-arrow-face'. The command \\[idlwave-routine-info]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
644 displays (with prefix arg: deletes) the class stored on the arrow
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
645 at point."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
646 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
647 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
648
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
649 (defcustom idlwave-class-arrow-face 'bold
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
650 "*Face to highlight object operator arrows `->' which carry a class property.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
651 When IDLWAVE stores a class name as text property on an object arrow
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
652 (see variable `idlwave-store-inquired-class', it highlights the arrow
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
653 with this font in order to remind the user that this arrow is special."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
654 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
655 :type 'symbol)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
656
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
657 (defcustom idlwave-resize-routine-help-window t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
658 "*Non-nil means, resize the Routine-info *Help* window to fit the content."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
659 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
660 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
661
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
662 (defcustom idlwave-keyword-completion-adds-equal t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
663 "*Non-nil means, completion automatically adds `=' after completed keywords."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
664 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
665 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
666
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
667 (defcustom idlwave-function-completion-adds-paren t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
668 "*Non-nil means, completion automatically adds `(' after completed function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
669 Nil means, don't add anything.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
670 A value of `2' means, also add the closing parenthesis and position cursor
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
671 between the two."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
672 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
673 :type '(choice (const :tag "Nothing" nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
674 (const :tag "(" t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
675 (const :tag "()" 2)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
676
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
677 (defcustom idlwave-completion-restore-window-configuration t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
678 "*Non-nil means, try to restore the window configuration after completion.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
679 When completion is not unique, Emacs displays a list of completions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
680 This messes up your window configuration. With this variable set, IDLWAVE
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
681 restores the old configuration after successful completion."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
682 :group 'idlwave-completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
683 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
684
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
685 ;;; Variables for abbrev and action behavior -----------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
686
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
687 (defgroup idlwave-abbrev-and-indent-action nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
688 "IDLWAVE performs actions when expanding abbreviations or indenting lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
689 The variables in this group govern this."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
690 :group 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
691
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
692 (defcustom idlwave-do-actions nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
693 "*Non-nil means performs actions when indenting.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
694 The actions that can be performed are listed in `idlwave-indent-action-table'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
695 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
696 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
697
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
698 (defcustom idlwave-abbrev-start-char "\\"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
699 "*A single character string used to start abbreviations in abbrev mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
700 Possible characters to chose from: ~`\%
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
701 or even '?'. '.' is not a good choice because it can make structure
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
702 field names act like abbrevs in certain circumstances.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
703
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
704 Changes to this in `idlwave-mode-hook' will have no effect. Instead a user
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
705 must set it directly using `setq' in the .emacs file before idlwave.el
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
706 is loaded."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
707 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
708 :type 'string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
709
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
710 (defcustom idlwave-surround-by-blank nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
711 "*Non-nil means, enable `idlwave-surround'.
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
712 If non-nil, `=',`<',`>',`&',`,', `->' are surrounded with spaces by
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
713 `idlwave-surround'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
714 See help for `idlwave-indent-action-table' for symbols using `idlwave-surround'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
715
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
716 Also see the default key bindings for keys using `idlwave-surround'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
717 Keys are bound and made into actions calling `idlwave-surround' with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
718 `idlwave-action-and-binding'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
719 See help for `idlwave-action-and-binding' for examples.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
720
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
721 Also see help for `idlwave-surround'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
722 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
723 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
724
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
725 (defcustom idlwave-pad-keyword t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
726 "*Non-nil means pad '=' for keywords like assignments.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
727 Whenever `idlwave-surround' is non-nil then this affects how '=' is padded
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
728 for keywords. If t, it is padded the same as for assignments.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
729 If nil then spaces are removed. With any other value, spaces are left
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
730 unchanged."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
731 :group 'idlwave-abbrev-and-indent-action
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
732 :type '(choice
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
733 (const :tag "Pad like assignments" t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
734 (const :tag "Remove space near `='" nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
735 (const :tag "Keep space near `='" 'keep)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
736
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
737 (defcustom idlwave-show-block t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
738 "*Non-nil means point blinks to block beginning for `idlwave-show-begin'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
739 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
740 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
741
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
742 (defcustom idlwave-expand-generic-end nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
743 "*Non-nil means expand generic END to ENDIF/ENDELSE/ENDWHILE etc."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
744 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
745 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
746
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
747 (defcustom idlwave-reindent-end t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
748 "*Non-nil means re-indent line after END was typed."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
749 :group 'idlwave-abbrev-and-indent-action
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
750 :type 'boolean)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
751
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
752 (defcustom idlwave-abbrev-move t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
753 "*Non-nil means the abbrev hook can move point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
754 Set to nil by `idlwave-expand-region-abbrevs'. To see the abbrev
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
755 definitions, use the command `list-abbrevs', for abbrevs that move
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
756 point. Moving point is useful, for example, to place point between
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
757 parentheses of expanded functions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
758
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
759 See `idlwave-check-abbrev'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
760 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
761 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
762
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
763 (defcustom idlwave-abbrev-change-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
764 "*Non-nil means all abbrevs will be forced to either upper or lower case.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
765 If the value t, all expanded abbrevs will be upper case.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
766 If the value is 'down then abbrevs will be forced to lower case.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
767 If nil, the case will not change.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
768 If `idlwave-reserved-word-upcase' is non-nil, reserved words will always be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
769 upper case, regardless of this variable."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
770 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
771 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
772
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
773 (defcustom idlwave-reserved-word-upcase nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
774 "*Non-nil means, reserved words will be made upper case via abbrev expansion.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
775 If nil case of reserved words is controlled by `idlwave-abbrev-change-case'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
776 Has effect only if in abbrev-mode."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
777 :group 'idlwave-abbrev-and-indent-action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
778 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
779
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
780 ;;; Action/Expand Tables.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
781 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
782 ;; The average user may have difficulty modifying this directly. It
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
783 ;; can be modified/set in idlwave-mode-hook, but it is easier to use
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
784 ;; idlwave-action-and-binding. See help for idlwave-action-and-binding for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
785 ;; examples of how to add an action.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
786 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
787 ;; The action table is used by `idlwave-indent-line' whereas both the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
788 ;; action and expand tables are used by `idlwave-indent-and-action'. In
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
789 ;; general, the expand table is only used when a line is explicitly
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
790 ;; indented. Whereas, in addition to being used when the expand table
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
791 ;; is used, the action table is used when a line is indirectly
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
792 ;; indented via line splitting, auto-filling or a new line creation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
793 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
794 ;; Example actions:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
795 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
796 ;; Capitalize system vars
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
797 ;; (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
798 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
799 ;; Capitalize procedure name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
800 ;; (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
801 ;; '(capitalize-word 1) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
802 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
803 ;; Capitalize common block name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
804 ;; (idlwave-action-and-binding "\\<common\\>[ \t]+\\<"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
805 ;; '(capitalize-word 1) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
806 ;; Capitalize label
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
807 ;; (idlwave-action-and-binding (concat "^[ \t]*" idlwave-label)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
808 ;; '(capitalize-word -1) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
809
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
810 (defvar idlwave-indent-action-table nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
811 "*Associated array containing action lists of search string (car),
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
812 and function as a cdr. This table is used by `idlwave-indent-line'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
813 See documentation for `idlwave-do-action' for a complete description of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
814 the action lists.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
815
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
816 Additions to the table are made with `idlwave-action-and-binding' when a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
817 binding is not requested.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
818 See help on `idlwave-action-and-binding' for examples.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
819
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
820 (defvar idlwave-indent-expand-table nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
821 "*Associated array containing action lists of search string (car),
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
822 and function as a cdr. The table is used by the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
823 `idlwave-indent-and-action' function. See documentation for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
824 `idlwave-do-action' for a complete description of the action lists.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
825
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
826 Additions to the table are made with `idlwave-action-and-binding' when a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
827 binding is requested.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
828 See help on `idlwave-action-and-binding' for examples.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
829
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
830 ;;; Documentation header and history keyword ---------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
831
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
832 (defgroup idlwave-documentation nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
833 "Options for documenting IDLWAVE files."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
834 :group 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
835
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
836 ;; FIXME: make defcustom?
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
837 (defvar idlwave-file-header
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
838 (list nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
839 ";+
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
840 ; NAME:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
841 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
842 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
843 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
844 ; PURPOSE:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
845 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
846 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
847 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
848 ; CATEGORY:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
849 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
850 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
851 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
852 ; CALLING SEQUENCE:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
853 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
854 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
855 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
856 ; INPUTS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
857 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
858 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
859 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
860 ; OPTIONAL INPUTS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
861 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
862 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
863 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
864 ; KEYWORD PARAMETERS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
865 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
866 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
867 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
868 ; OUTPUTS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
869 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
870 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
871 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
872 ; OPTIONAL OUTPUTS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
873 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
874 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
875 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
876 ; COMMON BLOCKS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
877 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
878 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
879 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
880 ; SIDE EFFECTS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
881 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
882 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
883 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
884 ; RESTRICTIONS:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
885 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
886 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
887 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
888 ; PROCEDURE:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
889 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
890 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
891 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
892 ; EXAMPLE:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
893 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
894 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
895 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
896 ; MODIFICATION HISTORY:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
897 ;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
898 ;-
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
899 ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
900 "*A list (PATHNAME STRING) specifying the doc-header template to use for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
901 summarizing a file. If PATHNAME is non-nil then this file will be included.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
902 Otherwise STRING is used. If NIL, the file summary will be omitted.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
903 For example you might set PATHNAME to the path for the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
904 lib_template.pro file included in the IDL distribution.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
905
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
906 (defcustom idlwave-timestamp-hook 'idlwave-default-insert-timestamp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
907 "*The hook function used to update the timestamp of a function."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
908 :group 'idlwave-documentation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
909 :type 'function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
910
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
911 (defcustom idlwave-doc-modifications-keyword "HISTORY"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
912 "*The modifications keyword to use with the log documentation commands.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
913 A ':' is added to the keyword end.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
914 Inserted by doc-header and used to position logs by doc-modification.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
915 If nil it will not be inserted."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
916 :group 'idlwave-documentation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
917 :type 'string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
918
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
919 (defcustom idlwave-doclib-start "^;+\\+"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
920 "*Regexp matching the start of a document library header."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
921 :group 'idlwave-documentation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
922 :type 'regexp)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
923
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
924 (defcustom idlwave-doclib-end "^;+-"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
925 "*Regexp matching the end of a document library header."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
926 :group 'idlwave-documentation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
927 :type 'regexp)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
928
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
929 ;;; External Programs -------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
930
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
931 (defgroup idlwave-external-programs nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
932 "Miscellaneous options for IDLWAVE mode."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
933 :group 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
934
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
935 ;; WARNING: The following variable has recently been moved from
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
936 ;; idlw-shell.el to this file. I hope this does not break
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
937 ;; anything.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
938
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
939 (defcustom idlwave-shell-explicit-file-name "idl"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
940 "*If non-nil, is the command to run IDL.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
941 Should be an absolute file path or path relative to the current environment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
942 execution search path."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
943 :group 'idlwave-external-programs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
944 :type 'string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
945
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
946 ;; FIXME: Document a case when is this needed.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
947 (defcustom idlwave-shell-command-line-options nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
948 "*A list of command line options for calling the IDL program."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
949 :type '(repeat (string :value ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
950 :group 'idlwave-external-programs)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
951
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
952 (defcustom idlwave-help-application "idlhelp"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
953 "*The external application providing reference help for programming."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
954 :group 'idlwave-external-programs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
955 :type 'string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
957 ;;; Miscellaneous variables -------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
958
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
959 (defgroup idlwave-misc nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
960 "Miscellaneous options for IDLWAVE mode."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
961 :group 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
962
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
963 (defcustom idlwave-startup-message t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
964 "*Non-nil displays a startup message when `idlwave-mode' is first called."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
965 :group 'idlwave-misc
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
966 :type 'boolean)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
967
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
968 (defcustom idlwave-default-font-lock-items
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
969 '(pros-and-functions batch-files idl-keywords label goto
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
970 common-blocks class-arrows)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
971 "Items which should be fontified on the default fontification level 2.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
972 IDLWAVE defines 3 levels of fontification. Level 1 is very little, level 3
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
973 is everything and level 2 is specified by this list.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
974 This variable must be set before IDLWAVE gets loaded. It is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
975 a list of symbols, the following symbols are allowed.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
976
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
977 pros-and-functions Procedure and Function definitions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
978 batch-files Batch Files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
979 idl-keywords IDL Keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
980 label Statement Labels
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
981 goto Goto Statements
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
982 common-blocks Common Blocks
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
983 keyword-parameters Keyword Parameters in routine definitions and calls
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
984 system-variables System Variables
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
985 fixme FIXME: Warning in comments (on XEmacs only v. 21.0 and up)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
986 class-arrows Object Arrows with class property"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
987 :group 'idlwave-misc
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
988 :type '(set
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
989 :inline t :greedy t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
990 (const :tag "Procedure and Function definitions" pros-and-functions)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
991 (const :tag "Batch Files" batch-files)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
992 (const :tag "IDL Keywords (reserved words)" idl-keywords)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
993 (const :tag "Statement Labels" label)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
994 (const :tag "Goto Statements" goto)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
995 (const :tag "Common Blocks" common-blocks)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
996 (const :tag "Keyword Parameters" keyword-parameters)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
997 (const :tag "System Variables" system-variables)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
998 (const :tag "FIXME: Warning" fixme)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
999 (const :tag "Object Arrows with class property " class-arrows)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1000
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1001 (defcustom idlwave-mode-hook nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1002 "Normal hook. Executed when a buffer is put into `idlwave-mode'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1003 :group 'idlwave-misc
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1004 :type 'hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1005
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1006 (defcustom idlwave-load-hook nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1007 "Normal hook. Executed when idlwave.el is loaded."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1008 :group 'idlwave-misc
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1009 :type 'hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1010
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1011 (defvar idlwave-experimental nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1012 "Non-nil means turn on a few experimental features.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1013 This variable is only for the maintainer, to test difficult stuff,
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1014 while still distributing stable releases.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1015 As a user, you should not set this to t.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1016
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1017 ;;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1018 ;;; End customization variables section
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1019 ;;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1020
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1021 ;;; Non customization variables
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1022
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1023 ;;; font-lock mode - Additions by Phil Williams, Ulrik Dickow and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1024 ;;; Simon Marshall <simon@gnu.ai.mit.edu>
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1025 ;;; and Carsten Dominik...
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1026
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1027 (defconst idlwave-font-lock-keywords-1 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1028 "Subdued level highlighting for IDLWAVE mode.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1029
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1030 (defconst idlwave-font-lock-keywords-2 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1031 "Medium level highlighting for IDLWAVE mode.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1032
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1033 (defconst idlwave-font-lock-keywords-3 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1034 "Gaudy level highlighting for IDLWAVE mode.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1035
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1036 (let* ((oldp (or (string-match "Lucid" emacs-version)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1037 (not (boundp 'emacs-minor-version))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1038 (and (<= emacs-major-version 19)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1039 (<= emacs-minor-version 29))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1040
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1041 ;; The following are the reserved words in IDL. Maybe we should
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1042 ;; highlight some more stuff as well?
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1043 (idl-keywords
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1044 ;; To update this regexp, update the list of keywords and
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1045 ;; evaluate the form.
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1046 ; (insert
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1047 ; (concat
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1048 ; "\"\\\\<"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1049 ; (regexp-opt
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1050 ; '("and" "or" "xor" "not"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1051 ; "eq" "ge" "gt" "le" "lt" "ne"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1052 ; "for" "do" "endfor"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1053 ; "if" "then" "endif" "else" "endelse"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1054 ; "case" "of" "endcase"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1055 ; "begin" "end"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1056 ; "repeat" "until" "endrep"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1057 ; "while" "endwhile"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1058 ; "goto" "return"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1059 ; "inherits" "mod"
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1060 ; "on_error" "on_ioerror")) ; on_error is not officially reserved
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1061 ; "\\\\>\""))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1062 (concat "\\<\\("
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1063 "and\\|begin\\|case\\|do\\|e\\(lse\\|nd\\(case\\|else\\|"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1064 "for\\|if\\|rep\\|while\\)?\\|q\\)\\|for\\|g\\(oto\\|[et]\\)"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1065 "\\|i\\(f\\|nherits\\)\\|l[et]\\|mod\\|n\\(e\\|ot\\)\\|"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1066 "o\\(n_ioerror\\|[fr]\\)\\|re\\(peat\\|turn\\)\\|then\\|"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1067 "until\\|while\\|xor"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1068 "\\)\\>"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1069
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1070 ;; Procedure declarations. Fontify keyword plus procedure name.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1071 ;; Function declarations. Fontify keyword plus function name.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1072 (pros-and-functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1073 '("\\<\\(function\\|pro\\)\\>[ \t]+\\(\\sw+\\(::\\sw+\\)?\\)"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1074 (1 font-lock-keyword-face)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1075 (2 font-lock-function-name-face nil t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1076
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1077 ;; Common blocks
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1078 (common-blocks
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1079 '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1080 (1 font-lock-keyword-face) ; "common"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1081 (2 font-lock-reference-face nil t) ; block name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1082 (font-lock-match-c++-style-declaration-item-and-skip-to-next
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1083 ;; Start with point after block name and comma
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1084 (goto-char (match-end 0)) ; needed for XEmacs, could be nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1085 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1086 (1 font-lock-variable-name-face) ; variable names
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1087 )))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1088
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1089 ;; Batch files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1090 (batch-files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1091 '("^[ \t]*\\(@[^ \t\n]+\\)" (1 font-lock-string-face)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1092
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1093 ;; FIXME warning.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1094 (fixme
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1095 '("\\<FIXME:" (0 font-lock-warning-face t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1096
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1097 ;; Labels
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1098 (label
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1099 '("^[ \t]*\\([a-zA-Z]\\sw*:\\)" (1 font-lock-reference-face)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1100
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1101 ;; The goto statement and its label
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1102 (goto
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1103 '("\\(goto\\)[ \t]*,[ \t]*\\([a-zA-Z]\\sw*\\)"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1104 (1 font-lock-keyword-face)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1105 (2 font-lock-reference-face)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1106
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1107 ;; Named parameters, like /xlog or ,xrange=[]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1108 ;; This is anchored to the comma preceeding the keyword.
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1109 ;; Treats continuation lines, works only during whole buffer
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1110 ;; fontification. Slow, use it only in fancy fontification.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1111 (keyword-parameters
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1112 '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\\(\n[ \t]*;.*\\)*\n[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1113 (5 font-lock-reference-face)))
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1114
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1115 ;; System variables start with a bang.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1116 (system-variables
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1117 '("\\(![a-zA-Z_0-9]+\\(\\.\\sw+\\)?\\)"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1118 (1 font-lock-variable-name-face)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1119
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1120 ;; Special and unusual operators (not used because too noisy)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1121 (special-operators
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1122 '("[<>#]" (0 font-lock-keyword-face)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1123
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1124 ;; All operators (not used because too noisy)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1125 (all-operators
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1126 '("[-*^#+<>/]" (0 font-lock-keyword-face)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1127
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1128 ;; Arrows with text property `idlwave-class'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1129 (class-arrows
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1130 (list 'idlwave-match-class-arrows
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1131 (list 0 (if (featurep 'xemacs)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1132 idlwave-class-arrow-face
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1133 'idlwave-class-arrow-face))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1134
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1135 )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1136
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1137 ;; The following lines are just a dummy to make the compiler shut up
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1138 ;; about variables bound but not used.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1139 (setq oldp oldp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1140 idl-keywords idl-keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1141 pros-and-functions pros-and-functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1142 common-blocks common-blocks
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1143 batch-files batch-files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1144 fixme fixme
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1145 label label
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1146 goto goto
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1147 keyword-parameters keyword-parameters
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1148 system-variables system-variables
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1149 special-operators special-operators
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1150 all-operators all-operators
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1151 class-arrows class-arrows)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1152
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1153 (setq idlwave-font-lock-keywords-1
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1154 (list pros-and-functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1155 batch-files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1156 ))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1157
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1158 (setq idlwave-font-lock-keywords-2
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1159 (mapcar 'symbol-value idlwave-default-font-lock-items))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1160
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1161 (setq idlwave-font-lock-keywords-3
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1162 (list pros-and-functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1163 batch-files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1164 idl-keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1165 label goto
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1166 common-blocks
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1167 keyword-parameters
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1168 system-variables
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1169 class-arrows
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1170 ))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1171 )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1172
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1173 (defun idlwave-match-class-arrows (limit)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1174 ;; Match an object arrow with class property
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1175 (and idlwave-store-inquired-class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1176 (re-search-forward "->" limit 'limit)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1177 (get-text-property (match-beginning 0) 'idlwave-class)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1178
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1179 (defvar idlwave-font-lock-keywords idlwave-font-lock-keywords-2
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1180 "Default expressions to highlight in IDLWAVE mode.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1181
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1182 (defvar idlwave-font-lock-defaults
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1183 '((idlwave-font-lock-keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1184 idlwave-font-lock-keywords-1
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1185 idlwave-font-lock-keywords-2
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1186 idlwave-font-lock-keywords-3)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1187 nil t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1188 ((?$ . "w") (?_ . "w") (?. . "w"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1189 beginning-of-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1190
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1191 (put 'idlwave-mode 'font-lock-defaults
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1192 idlwave-font-lock-defaults) ; XEmacs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1193
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1194 (defconst idlwave-comment-line-start-skip "^[ \t]*;"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1195 "Regexp to match the start of a full-line comment.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1196 That is the _beginning_ of a line containing a comment delimiter `;' preceded
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1197 only by whitespace.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1198
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1199 (defconst idlwave-begin-block-reg "\\<\\(pro\\|function\\|begin\\|case\\)\\>"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1200 "Regular expression to find the beginning of a block. The case does
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1201 not matter. The search skips matches in comments.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1202
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1203 (defconst idlwave-begin-unit-reg "\\<\\(pro\\|function\\)\\>\\|\\`"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1204 "Regular expression to find the beginning of a unit. The case does
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1205 not matter.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1206
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1207 (defconst idlwave-end-unit-reg "\\<\\(pro\\|function\\)\\>\\|\\'"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1208 "Regular expression to find the line that indicates the end of unit.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1209 This line is the end of buffer or the start of another unit. The case does
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1210 not matter. The search skips matches in comments.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1211
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1212 (defconst idlwave-continue-line-reg "\\<\\$"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1213 "Regular expression to match a continued line.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1214
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1215 (defconst idlwave-end-block-reg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1216 "\\<end\\(\\|case\\|else\\|for\\|if\\|rep\\|while\\)\\>"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1217 "Regular expression to find the end of a block. The case does
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1218 not matter. The search skips matches found in comments.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1219
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1220 (defconst idlwave-block-matches
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1221 '(("pro" . "end")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1222 ("function" . "end")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1223 ("case" . "endcase")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1224 ("else" . "endelse")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1225 ("for" . "endfor")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1226 ("then" . "endif")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1227 ("repeat" . "endrep")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1228 ("while" . "endwhile"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1229 "Matches between statements and the corresponding END variant.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1230 The cars are the reserved words starting a block. If the block really
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1231 begins with BEGIN, the cars are the reserved words before the begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1232 which can be used to identify the block type.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1233 This is used to check for the correct END type, to close blocks and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1234 to expand generic end statements to their detailed form.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1235
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1236 (defconst idlwave-block-match-regexp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1237 "\\<\\(else\\|for\\|then\\|repeat\\|while\\)\\>"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1238 "Regular expression matching reserved words which can stand before
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1239 blocks starting with a BEGIN statement. The matches must have associations
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1240 `idlwave-block-matches'")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1241
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1242 (defconst idlwave-identifier "[a-zA-Z][a-zA-Z0-9$_]*"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1243 "Regular expression matching an IDL identifier.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1244
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1245 (defconst idlwave-sysvar (concat "!" idlwave-identifier)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1246 "Regular expression matching IDL system variables.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1247
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1248 (defconst idlwave-variable (concat idlwave-identifier "\\|" idlwave-sysvar)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1249 "Regular expression matching IDL variable names.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1250
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1251 (defconst idlwave-label (concat idlwave-identifier ":")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1252 "Regular expression matching IDL labels.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1253
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1254 (defconst idlwave-statement-match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1255 (list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1256 ;; "endif else" is the the only possible "end" that can be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1257 ;; followed by a statement on the same line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1258 '(endelse . ("end\\(\\|if\\)\\s +else" "end\\(\\|if\\)\\s +else"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1259 ;; all other "end"s can not be followed by a statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1260 (cons 'end (list idlwave-end-block-reg nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1261 '(if . ("if\\>" "then"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1262 '(for . ("for\\>" "do"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1263 '(begin . ("begin\\>" nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1264 '(pdef . ("pro\\>\\|function\\>" nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1265 '(while . ("while\\>" "do"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1266 '(repeat . ("repeat\\>" "repeat"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1267 '(goto . ("goto\\>" nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1268 '(case . ("case\\>" nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1269 (cons 'call (list (concat idlwave-identifier "\\(\\s *$\\|\\s *,\\)") nil))
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1270 '(assign . ("[^=>\n]*=" nil)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1271
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1272 "Associated list of statement matching regular expressions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1273 Each regular expression matches the start of an IDL statement. The
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1274 first element of each association is a symbol giving the statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1275 type. The associated value is a list. The first element of this list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1276 is a regular expression matching the start of an IDL statement for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1277 identifying the statement type. The second element of this list is a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1278 regular expression for finding a substatement for the type. The
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1279 substatement starts after the end of the found match modulo
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1280 whitespace. If it is nil then the statement has no substatement. The
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1281 list order matters since matching an assignment statement exactly is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1282 not possible without parsing. Thus assignment statement become just
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1283 the leftover unidentified statements containing an equal sign." )
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1284
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1285 (defvar idlwave-fill-function 'auto-fill-function
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1286 "IDL mode auto fill function.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1287
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1288 (defvar idlwave-comment-indent-function 'comment-indent-function
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1289 "IDL mode comment indent function.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1290
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1291 ;; Note that this is documented in the v18 manuals as being a string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1292 ;; of length one rather than a single character.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1293 ;; The code in this file accepts either format for compatibility.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1294 (defvar idlwave-comment-indent-char ?\
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1295 "Character to be inserted for IDL comment indentation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1296 Normally a space.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1297
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1298 (defconst idlwave-continuation-char ?$
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1299 "Character which is inserted as a last character on previous line by
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1300 \\[idlwave-split-line] to begin a continuation line. Normally $.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1301
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1302 (defconst idlwave-mode-version " 4.2")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1303
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1304 (defmacro idlwave-keyword-abbrev (&rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1305 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1306 (` (quote (lambda ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1307 (, (append '(idlwave-check-abbrev) args))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1308
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1309 ;; If I take the time I can replace idlwave-keyword-abbrev with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1310 ;; idlwave-code-abbrev and remove the quoted abbrev check from
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1311 ;; idlwave-check-abbrev. Then, e.g, (idlwave-keyword-abbrev 0 t) becomes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1312 ;; (idlwave-code-abbrev idlwave-check-abbrev 0 t). In fact I should change
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1313 ;; the name of idlwave-check-abbrev to something like idlwave-modify-abbrev.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1314
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1315 (defmacro idlwave-code-abbrev (&rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1316 "Creates a function for abbrev hooks that ensures abbrevs are not quoted.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1317 Specifically, if the abbrev is in a comment or string it is unexpanded.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1318 Otherwise ARGS forms a list that is evaluated."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1319 (` (quote (lambda ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1320 (, (prin1-to-string args)) ;; Puts the code in the doc string
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1321 (if (idlwave-quoted)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1322 (progn (unexpand-abbrev) nil)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1323 (, (append args)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1324
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1325 (defvar idlwave-mode-map (make-sparse-keymap)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1326 "Keymap used in IDL mode.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1327
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1328 (defvar idlwave-mode-syntax-table (make-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1329 "Syntax table in use in `idlwave-mode' buffers.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1330
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1331 (modify-syntax-entry ?+ "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1332 (modify-syntax-entry ?- "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1333 (modify-syntax-entry ?* "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1334 (modify-syntax-entry ?/ "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1335 (modify-syntax-entry ?^ "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1336 (modify-syntax-entry ?# "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1337 (modify-syntax-entry ?= "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1338 (modify-syntax-entry ?% "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1339 (modify-syntax-entry ?< "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1340 (modify-syntax-entry ?> "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1341 (modify-syntax-entry ?\' "\"" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1342 (modify-syntax-entry ?\" "\"" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1343 (modify-syntax-entry ?\\ "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1344 (modify-syntax-entry ?_ "_" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1345 (modify-syntax-entry ?{ "(}" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1346 (modify-syntax-entry ?} "){" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1347 (modify-syntax-entry ?$ "_" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1348 (modify-syntax-entry ?. "." idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1349 (modify-syntax-entry ?\; "<" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1350 (modify-syntax-entry ?\n ">" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1351 (modify-syntax-entry ?\f ">" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1352
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1353 (defvar idlwave-find-symbol-syntax-table
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1354 (copy-syntax-table idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1355 "Syntax table that treats symbol characters as word characters.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1356
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1357 (modify-syntax-entry ?$ "w" idlwave-find-symbol-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1358 (modify-syntax-entry ?_ "w" idlwave-find-symbol-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1359
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1360 (defmacro idlwave-with-special-syntax (&rest body)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1361 "Execute BODY with a different systax table."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1362 `(let ((saved-syntax (syntax-table)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1363 (unwind-protect
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1364 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1365 (set-syntax-table idlwave-find-symbol-syntax-table)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1366 ,@body)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1367 (set-syntax-table saved-syntax))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1368
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1369 (defun idlwave-action-and-binding (key cmd &optional select)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1370 "KEY and CMD are made into a key binding and an indent action.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1371 KEY is a string - same as for the `define-key' function. CMD is a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1372 function of no arguments or a list to be evaluated. CMD is bound to
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1373 KEY in `idlwave-mode-map' by defining an anonymous function calling
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1374 `self-insert-command' followed by CMD. If KEY contains more than one
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1375 character a binding will only be set if SELECT is 'both.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1376
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1377 (KEY . CMD\ is also placed in the `idlwave-indent-expand-table',
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1378 replacing any previous value for KEY. If a binding is not set then it
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1379 will instead be placed in `idlwave-indent-action-table'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1380
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1381 If the optional argument SELECT is nil then an action and binding are
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1382 created. If SELECT is 'noaction, then a binding is always set and no
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1383 action is created. If SELECT is 'both then an action and binding
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1384 will both be created even if KEY contains more than one character.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1385 Otherwise, if SELECT is non-nil then only an action is created.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1386
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1387 Some examples:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1388 No spaces before and 1 after a comma
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1389 (idlwave-action-and-binding \",\" '(idlwave-surround 0 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1390 A minimum of 1 space before and after `=' (see `idlwave-expand-equal').
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1391 (idlwave-action-and-binding \"=\" '(idlwave-expand-equal -1 -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1392 Capitalize system variables - action only
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1393 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1394 (if (not (equal select 'noaction))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1395 ;; Add action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1396 (let* ((table (if select 'idlwave-indent-action-table
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1397 'idlwave-indent-expand-table))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1398 (cell (assoc key (eval table))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1399 (if cell
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1400 ;; Replace action command
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1401 (setcdr cell cmd)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1402 ;; New action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1403 (set table (append (eval table) (list (cons key cmd)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1404 ;; Make key binding for action
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1405 (if (or (and (null select) (= (length key) 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1406 (equal select 'noaction)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1407 (equal select 'both))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1408 (define-key idlwave-mode-map key
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1409 (append '(lambda ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1410 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1411 (self-insert-command 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1412 (list (if (listp cmd)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1413 cmd
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1414 (list cmd)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1415
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1416 (fset 'idlwave-debug-map (make-sparse-keymap))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1417
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1418 (define-key idlwave-mode-map "\C-c " 'idlwave-hard-tab)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1419 (define-key idlwave-mode-map [(control tab)] 'idlwave-hard-tab)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1420 ;(define-key idlwave-mode-map "\C-c\C- " 'idlwave-hard-tab)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1421 (define-key idlwave-mode-map "'" 'idlwave-show-matching-quote)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1422 (define-key idlwave-mode-map "\"" 'idlwave-show-matching-quote)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1423 (define-key idlwave-mode-map "\C-c;" 'idlwave-toggle-comment-region)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1424 (define-key idlwave-mode-map "\C-\M-a" 'idlwave-beginning-of-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1425 (define-key idlwave-mode-map "\C-\M-e" 'idlwave-end-of-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1426 (define-key idlwave-mode-map "\C-c{" 'idlwave-beginning-of-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1427 (define-key idlwave-mode-map "\C-c}" 'idlwave-end-of-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1428 (define-key idlwave-mode-map "\C-c]" 'idlwave-close-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1429 (define-key idlwave-mode-map "\M-\C-h" 'idlwave-mark-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1430 (define-key idlwave-mode-map "\M-\C-n" 'idlwave-forward-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1431 (define-key idlwave-mode-map "\M-\C-p" 'idlwave-backward-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1432 (define-key idlwave-mode-map "\M-\C-d" 'idlwave-down-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1433 (define-key idlwave-mode-map "\M-\C-u" 'idlwave-backward-up-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1434 (define-key idlwave-mode-map "\M-\r" 'idlwave-split-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1435 (define-key idlwave-mode-map "\M-\C-q" 'idlwave-indent-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1436 (define-key idlwave-mode-map "\C-c\C-p" 'idlwave-previous-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1437 (define-key idlwave-mode-map "\C-c\C-n" 'idlwave-next-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1438 ;; (define-key idlwave-mode-map "\r" 'idlwave-newline)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1439 ;; (define-key idlwave-mode-map "\t" 'idlwave-indent-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1440 (define-key idlwave-mode-map "\C-c\C-a" 'idlwave-auto-fill-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1441 (define-key idlwave-mode-map "\M-q" 'idlwave-fill-paragraph)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1442 (define-key idlwave-mode-map "\M-s" 'idlwave-edit-in-idlde)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1443 (define-key idlwave-mode-map "\C-c\C-h" 'idlwave-doc-header)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1444 (define-key idlwave-mode-map "\C-c\C-m" 'idlwave-doc-modification)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1445 (define-key idlwave-mode-map "\C-c\C-c" 'idlwave-case)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1446 (define-key idlwave-mode-map "\C-c\C-d" 'idlwave-debug-map)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1447 (define-key idlwave-mode-map "\C-c\C-d\C-c" 'idlwave-shell-save-and-run)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1448 (define-key idlwave-mode-map "\C-c\C-d\C-b" 'idlwave-shell-break-here)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1449 (define-key idlwave-mode-map "\C-c\C-f" 'idlwave-for)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1450 ;; (define-key idlwave-mode-map "\C-c\C-f" 'idlwave-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1451 ;; (define-key idlwave-mode-map "\C-c\C-p" 'idlwave-procedure)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1452 (define-key idlwave-mode-map "\C-c\C-r" 'idlwave-repeat)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1453 (define-key idlwave-mode-map "\C-c\C-w" 'idlwave-while)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1454 (define-key idlwave-mode-map "\C-c\C-k" 'idlwave-kill-autoloaded-buffers)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1455 (define-key idlwave-mode-map "\C-c\C-s" 'idlwave-shell)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1456 (define-key idlwave-mode-map "\C-c\C-l" 'idlwave-shell-recenter-shell-window)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1457 (define-key idlwave-mode-map "\C-c\C-b" 'idlwave-list-buffer-load-path-shadows)
27185
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
1458 (autoload 'idlwave-shell "idlw-shell"
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
1459 "Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'." t)
27107
7b2b73f13427 Renamed idlwave-*.el into idlw-*.el.
Eli Zaretskii <eliz@gnu.org>
parents: 26956
diff changeset
1460 (autoload 'idlwave-shell-send-command "idlw-shell")
7b2b73f13427 Renamed idlwave-*.el into idlw-*.el.
Eli Zaretskii <eliz@gnu.org>
parents: 26956
diff changeset
1461 (autoload 'idlwave-shell-recenter-shell-window "idlw-shell"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1462 "Run `idlwave-shell' and switch back to current window" t)
27107
7b2b73f13427 Renamed idlwave-*.el into idlw-*.el.
Eli Zaretskii <eliz@gnu.org>
parents: 26956
diff changeset
1463 (autoload 'idlwave-shell-save-and-run "idlw-shell"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1464 "Save and run buffer under the shell." t)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1465 (autoload 'idlwave-shell-break-here "idlw-shell"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1466 "Set breakpoint in current line." t)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1467 (define-key idlwave-mode-map "\C-c\C-v" 'idlwave-find-module)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1468 (define-key idlwave-mode-map "\C-c?" 'idlwave-routine-info)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1469 (define-key idlwave-mode-map "\M-?" 'idlwave-context-help)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1470 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1471 (define-key idlwave-mode-map "\C-c\C-i" 'idlwave-update-routine-info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1472 (define-key idlwave-mode-map "\C-c=" 'idlwave-resolve)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1473 (define-key idlwave-mode-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1474 (if (featurep 'xemacs) [(shift button3)] [(shift mouse-3)])
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1475 'idlwave-mouse-context-help)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1476
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1477 ;; Set action and key bindings.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1478 ;; See description of the function `idlwave-action-and-binding'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1479 ;; Automatically add spaces for the following characters
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1480 (idlwave-action-and-binding "&" '(idlwave-surround -1 -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1481 (idlwave-action-and-binding "<" '(idlwave-surround -1 -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1482 (idlwave-action-and-binding ">" '(idlwave-surround -1 -1 '(?-)))
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
1483 (idlwave-action-and-binding "->" '(idlwave-surround -1 -1 nil 2))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1484 (idlwave-action-and-binding "," '(idlwave-surround 0 -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1485 ;; Automatically add spaces to equal sign if not keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1486 (idlwave-action-and-binding "=" '(idlwave-expand-equal -1 -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1487
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1488 ;;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1489 ;;; Abbrev Section
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1490 ;;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1491 ;;; When expanding abbrevs and the abbrev hook moves backward, an extra
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1492 ;;; space is inserted (this is the space typed by the user to expanded
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1493 ;;; the abbrev).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1494 ;;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1495
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1496 (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1497 (modify-syntax-entry (string-to-char idlwave-abbrev-start-char)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1498 "w" idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1499 (error nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1500
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1501 (defvar idlwave-mode-abbrev-table nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1502 "Abbreviation table used for IDLWAVE mode")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1503 (define-abbrev-table 'idlwave-mode-abbrev-table ())
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1504 (let ((abbrevs-changed nil) ;; mask the current value to avoid save
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1505 (tb idlwave-mode-abbrev-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1506 (c idlwave-abbrev-start-char))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1507 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1508 ;; Templates
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1509 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1510 (define-abbrev tb (concat c "c") "" (idlwave-code-abbrev idlwave-case))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1511 (define-abbrev tb (concat c "f") "" (idlwave-code-abbrev idlwave-for))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1512 (define-abbrev tb (concat c "fu") "" (idlwave-code-abbrev idlwave-function))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1513 (define-abbrev tb (concat c "pr") "" (idlwave-code-abbrev idlwave-procedure))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1514 (define-abbrev tb (concat c "r") "" (idlwave-code-abbrev idlwave-repeat))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1515 (define-abbrev tb (concat c "w") "" (idlwave-code-abbrev idlwave-while))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1516 (define-abbrev tb (concat c "i") "" (idlwave-code-abbrev idlwave-if))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1517 (define-abbrev tb (concat c "elif") "" (idlwave-code-abbrev idlwave-elif))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1518 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1519 ;; Keywords, system functions, conversion routines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1520 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1521 (define-abbrev tb (concat c "b") "begin" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1522 (define-abbrev tb (concat c "co") "common" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1523 (define-abbrev tb (concat c "cb") "byte()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1524 (define-abbrev tb (concat c "cx") "fix()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1525 (define-abbrev tb (concat c "cl") "long()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1526 (define-abbrev tb (concat c "cf") "float()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1527 (define-abbrev tb (concat c "cs") "string()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1528 (define-abbrev tb (concat c "cc") "complex()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1529 (define-abbrev tb (concat c "cd") "double()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1530 (define-abbrev tb (concat c "e") "else" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1531 (define-abbrev tb (concat c "ec") "endcase" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1532 (define-abbrev tb (concat c "ee") "endelse" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1533 (define-abbrev tb (concat c "ef") "endfor" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1534 (define-abbrev tb (concat c "ei") "endif else if" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1535 (define-abbrev tb (concat c "el") "endif else" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1536 (define-abbrev tb (concat c "en") "endif" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1537 (define-abbrev tb (concat c "er") "endrep" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1538 (define-abbrev tb (concat c "ew") "endwhile" 'idlwave-show-begin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1539 (define-abbrev tb (concat c "g") "goto," (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1540 (define-abbrev tb (concat c "h") "help," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1541 (define-abbrev tb (concat c "k") "keyword_set()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1542 (define-abbrev tb (concat c "n") "n_elements()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1543 (define-abbrev tb (concat c "on") "on_error," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1544 (define-abbrev tb (concat c "oi") "on_ioerror," (idlwave-keyword-abbrev 0 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1545 (define-abbrev tb (concat c "ow") "openw," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1546 (define-abbrev tb (concat c "or") "openr," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1547 (define-abbrev tb (concat c "ou") "openu," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1548 (define-abbrev tb (concat c "p") "print," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1549 (define-abbrev tb (concat c "pt") "plot," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1550 (define-abbrev tb (concat c "re") "read," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1551 (define-abbrev tb (concat c "rf") "readf," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1552 (define-abbrev tb (concat c "ru") "readu," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1553 (define-abbrev tb (concat c "rt") "return" (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1554 (define-abbrev tb (concat c "sc") "strcompress()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1555 (define-abbrev tb (concat c "sn") "strlen()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1556 (define-abbrev tb (concat c "sl") "strlowcase()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1557 (define-abbrev tb (concat c "su") "strupcase()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1558 (define-abbrev tb (concat c "sm") "strmid()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1559 (define-abbrev tb (concat c "sp") "strpos()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1560 (define-abbrev tb (concat c "st") "strput()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1561 (define-abbrev tb (concat c "sr") "strtrim()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1562 (define-abbrev tb (concat c "t") "then" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1563 (define-abbrev tb (concat c "u") "until" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1564 (define-abbrev tb (concat c "wu") "writeu," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1565 (define-abbrev tb (concat c "ine") "if n_elements() eq 0 then"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1566 (idlwave-keyword-abbrev 11))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1567 (define-abbrev tb (concat c "inn") "if n_elements() ne 0 then"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1568 (idlwave-keyword-abbrev 11))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1569 (define-abbrev tb (concat c "np") "n_params()" (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1570 (define-abbrev tb (concat c "s") "size()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1571 (define-abbrev tb (concat c "wi") "widget_info()" (idlwave-keyword-abbrev 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1572 (define-abbrev tb (concat c "wc") "widget_control," (idlwave-keyword-abbrev 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1573
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1574 ;; This section is reserved words only. (From IDL user manual)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1575 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1576 (define-abbrev tb "and" "and" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1577 (define-abbrev tb "begin" "begin" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1578 (define-abbrev tb "case" "case" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1579 (define-abbrev tb "common" "common" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1580 (define-abbrev tb "do" "do" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1581 (define-abbrev tb "else" "else" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1582 (define-abbrev tb "end" "end" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1583 (define-abbrev tb "endcase" "endcase" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1584 (define-abbrev tb "endelse" "endelse" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1585 (define-abbrev tb "endfor" "endfor" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1586 (define-abbrev tb "endif" "endif" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1587 (define-abbrev tb "endrep" "endrep" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1588 (define-abbrev tb "endwhi" "endwhi" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1589 (define-abbrev tb "endwhile" "endwhile" 'idlwave-show-begin-check)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1590 (define-abbrev tb "eq" "eq" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1591 (define-abbrev tb "for" "for" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1592 (define-abbrev tb "function" "function" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1593 (define-abbrev tb "ge" "ge" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1594 (define-abbrev tb "goto" "goto" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1595 (define-abbrev tb "gt" "gt" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1596 (define-abbrev tb "if" "if" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1597 (define-abbrev tb "le" "le" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1598 (define-abbrev tb "lt" "lt" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1599 (define-abbrev tb "mod" "mod" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1600 (define-abbrev tb "ne" "ne" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1601 (define-abbrev tb "not" "not" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1602 (define-abbrev tb "of" "of" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1603 (define-abbrev tb "on_ioerror" "on_ioerror" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1604 (define-abbrev tb "or" "or" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1605 (define-abbrev tb "pro" "pro" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1606 (define-abbrev tb "repeat" "repeat" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1607 (define-abbrev tb "then" "then" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1608 (define-abbrev tb "until" "until" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1609 (define-abbrev tb "while" "while" (idlwave-keyword-abbrev 0 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1610 (define-abbrev tb "xor" "xor" (idlwave-keyword-abbrev 0 t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1611
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1612 (defvar imenu-create-index-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1613 (defvar extract-index-name-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1614 (defvar prev-index-position-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1615 (defvar imenu-extract-index-name-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1616 (defvar imenu-prev-index-position-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1617 ;; defined later - so just make the compiler shut up
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1618 (defvar idlwave-mode-menu)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1619 (defvar idlwave-mode-debug-menu)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1620
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1621 ;;;###autoload
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1622 (defun idlwave-mode ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1623 "Major mode for editing IDL and WAVE CL .pro files.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1624
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1625 The main features of this mode are
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1626
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1627 1. Indentation and Formatting
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1628 --------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1629 Like other Emacs programming modes, C-j inserts a newline and indents.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1630 TAB is used for explicit indentation of the current line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1631
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1632 To start a continuation line, use \\[idlwave-split-line]. This function can also
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1633 be used in the middle of a line to split the line at that point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1634 When used inside a long constant string, the string is split at
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1635 that point with the `+' concatenation operator.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1636
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1637 Comments are indented as follows:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1638
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1639 `;;;' Indentation remains unchanged.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1640 `;;' Indent like the surrounding code
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1641 `;' Indent to a minimum column.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1642
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1643 The indentation of comments starting in column 0 is never changed.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1644
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1645 Use \\[idlwave-fill-paragraph] to refill a paragraph inside a comment. The indentation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1646 of the second line of the paragraph relative to the first will be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1647 retained. Use \\[idlwave-auto-fill-mode] to toggle auto-fill mode for these comments.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1648 When the variable `idlwave-fill-comment-line-only' is nil, code
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1649 can also be auto-filled and auto-indented (not recommended).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1650
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1651 To convert pre-existing IDL code to your formatting style, mark the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1652 entire buffer with \\[mark-whole-buffer] and execute \\[idlwave-expand-region-abbrevs].
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1653 Then mark the entire buffer again followed by \\[indent-region] (`indent-region').
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1654
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1655 2. Routine Info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1656 ------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1657 IDLWAVE displays information about the calling sequence and the accepted
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1658 keyword parameters of a procedure or function with \\[idlwave-routine-info].
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1659 \\[idlwave-find-module] jumps to the source file of a module.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1660 These commands know about system routines, all routines in idlwave-mode
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1661 buffers and (when the idlwave-shell is active) about all modules
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1662 currently compiled under this shell. Use \\[idlwave-update-routine-info] to update this
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1663 information, which is also used for completion (see item 4).
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1664
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1665 3. Online IDL Help
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1666 ---------------
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1667 \\[idlwave-context-help] displays the IDL documentation relevant
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1668 for the system variable, keyword, or routine at point. A single key
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1669 stroke gets you directly to the right place in the docs. Two additional
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1670 files (an ASCII version of the IDL documentation and a topics file) must
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1671 be installed for this - check the IDLWAVE webpage for these files.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1672
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1673 4. Completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1674 ----------
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1675 \\[idlwave-complete] completes the names of procedures, functions
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1676 class names and keyword parameters. It is context sensitive and
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1677 figures out what is expected at point (procedure/function/keyword).
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1678 Lower case strings are completed in lower case, other strings in
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1679 mixed or upper case.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1680
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1681 5. Code Templates and Abbreviations
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1682 --------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1683 Many Abbreviations are predefined to expand to code fragments and templates.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1684 The abbreviations start generally with a `\\`. Some examples
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1685
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1686 \\pr PROCEDURE template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1687 \\fu FUNCTION template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1688 \\c CASE statement template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1689 \\f FOR loop template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1690 \\r REPEAT Loop template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1691 \\w WHILE loop template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1692 \\i IF statement template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1693 \\elif IF-ELSE statement template
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1694 \\b BEGIN
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1695
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1696 For a full list, use \\[idlwave-list-abbrevs]. Some templates also have
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1697 direct keybindings - see the list of keybindings below.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1698
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1699 \\[idlwave-doc-header] inserts a documentation header at the beginning of the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1700 current program unit (pro, function or main). Change log entries
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1701 can be added to the current program unit with \\[idlwave-doc-modification].
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1702
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1703 6. Automatic Case Conversion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1704 -------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1705 The case of reserved words and some abbrevs is controlled by
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1706 `idlwave-reserved-word-upcase' and `idlwave-abbrev-change-case'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1707
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1708 7. Automatic END completion
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1709 ------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1710 If the variable `idlwave-expand-generic-end' is non-nil, each END typed
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1711 will be converted to the specific version, like ENDIF, ENDFOR, etc.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1712
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1713 8. Hooks
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1714 -----
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1715 Loading idlwave.el runs `idlwave-load-hook'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1716 Turning on `idlwave-mode' runs `idlwave-mode-hook'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1717
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1718 9. Documentation and Customization
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1719 -------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1720 Info documentation for this package is available. Use \\[idlwave-info]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1721 to display (complain to your sysadmin if that does not work).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1722 For Postscript and HTML versions of the documentation, check IDLWAVE's
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1723 homepage at `http://www.strw.leidenuniv.nl/~dominik/Tools/idlwave'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1724 IDLWAVE has customize support - see the group `idlwave'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1725
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1726 10.Keybindings
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1727 -----------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1728 Here is a list of all keybindings of this mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1729 If some of the key bindings below show with ??, use \\[describe-key]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1730 followed by the key sequence to see what the key sequence does.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1731
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1732 \\{idlwave-mode-map}"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1733
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1734 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1735 (kill-all-local-variables)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1736
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1737 (if idlwave-startup-message
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1738 (message "Emacs IDLWAVE mode version %s." idlwave-mode-version))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1739 (setq idlwave-startup-message nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1740
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1741 (setq local-abbrev-table idlwave-mode-abbrev-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1742 (set-syntax-table idlwave-mode-syntax-table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1743
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1744 (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1745
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1746 (make-local-variable idlwave-comment-indent-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1747 (set idlwave-comment-indent-function 'idlwave-comment-hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1748
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1749 (set (make-local-variable 'comment-start-skip) ";+[ \t]*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1750 (set (make-local-variable 'comment-start) ";")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1751 (set (make-local-variable 'require-final-newline) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1752 (set (make-local-variable 'abbrev-all-caps) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1753 (set (make-local-variable 'indent-tabs-mode) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1754 (set (make-local-variable 'completion-ignore-case) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1755
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1756 (use-local-map idlwave-mode-map)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1757
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1758 (when (featurep 'easymenu)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1759 (easy-menu-add idlwave-mode-menu idlwave-mode-map)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1760 (easy-menu-add idlwave-mode-debug-menu idlwave-mode-map))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1761
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1762 (setq mode-name "IDLWAVE")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1763 (setq major-mode 'idlwave-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1764 (setq abbrev-mode t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1765
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1766 (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1767 (setq comment-end "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1768 (set (make-local-variable 'comment-multi-line) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1769 (set (make-local-variable 'paragraph-separate) "[ \t\f]*$\\|[ \t]*;+[ \t]*$")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1770 (set (make-local-variable 'paragraph-start) "[ \t\f]\\|[ \t]*;+[ \t]")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1771 (set (make-local-variable 'paragraph-ignore-fill-prefix) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1772 (set (make-local-variable 'parse-sexp-ignore-comments) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1773
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1774 ;; Set tag table list to use IDLTAGS as file name.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1775 (if (boundp 'tag-table-alist)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1776 (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1777
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1778 ;; Font-lock additions - originally Phil Williams, then Ulrik Dickow
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1779 ;; Following line is for Emacs - XEmacs uses the corresponding porperty
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1780 ;; on the `idlwave-mode' symbol.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1781 (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1782
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1783 ;; Imenu setup
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1784 (set (make-local-variable 'imenu-create-index-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1785 'imenu-default-create-index-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1786 (set (make-local-variable 'imenu-extract-index-name-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1787 'idlwave-unit-name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1788 (set (make-local-variable 'imenu-prev-index-position-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1789 'idlwave-prev-index-position)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1790
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1791 ;; Make a local post-command-hook and add our hook to it
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1792 (make-local-hook 'post-command-hook)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1793 (add-hook 'post-command-hook 'idlwave-command-hook nil 'local)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1794
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1795 ;; Make local hooks for buffer updates
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1796 (make-local-hook 'kill-buffer-hook)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1797 (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1798 (make-local-hook 'after-save-hook)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1799 (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1800 (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1801
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1802 ;; Update the routine info with info about current buffer?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1803 (idlwave-new-buffer-update)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1804
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1805 ;; Run the mode hook
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1806 (run-hooks 'idlwave-mode-hook))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1807
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1808 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1809 ;; Done with start up and initialization code.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1810 ;; The remaining routines are the code formatting functions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1811 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1812
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1813 (defun idlwave-push-mark (&rest rest)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1814 "Push mark for compatibility with Emacs 18/19."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1815 (if (fboundp 'iconify-frame)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1816 (apply 'push-mark rest)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1817 (push-mark)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1818
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1819 (defun idlwave-hard-tab ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1820 "Inserts TAB in buffer in current position."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1821 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1822 (insert "\t"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1823
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1824 ;;; This stuff is experimental
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1825
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1826 (defvar idlwave-command-hook nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1827 "If non-nil, a list that can be evaluated using `eval'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1828 It is evaluated in the lisp function `idlwave-command-hook' which is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1829 placed in `post-command-hook'.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1830
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1831 (defun idlwave-command-hook ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1832 "Command run after every command.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1833 Evaluates a non-nil value of the *variable* `idlwave-command-hook' and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1834 sets the variable to zero afterwards."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1835 (and idlwave-command-hook
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1836 (listp idlwave-command-hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1837 (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1838 (eval idlwave-command-hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1839 (error nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1840 (setq idlwave-command-hook nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1841
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1842 ;;; End experiment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1843
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1844 ;; It would be better to use expand.el for better abbrev handling and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1845 ;; versatility.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1846
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1847 (defun idlwave-check-abbrev (arg &optional reserved)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1848 "Reverses abbrev expansion if in comment or string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1849 Argument ARG is the number of characters to move point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1850 backward if `idlwave-abbrev-move' is non-nil.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1851 If optional argument RESERVED is non-nil then the expansion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1852 consists of reserved words, which will be capitalized if
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1853 `idlwave-reserved-word-upcase' is non-nil.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1854 Otherwise, the abbrev will be capitalized if `idlwave-abbrev-change-case'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1855 is non-nil, unless its value is \`down in which case the abbrev will be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1856 made into all lowercase.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1857 Returns non-nil if abbrev is left expanded."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1858 (if (idlwave-quoted)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1859 (progn (unexpand-abbrev)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1860 nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1861 (if (and reserved idlwave-reserved-word-upcase)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1862 (upcase-region last-abbrev-location (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1863 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1864 ((equal idlwave-abbrev-change-case 'down)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1865 (downcase-region last-abbrev-location (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1866 (idlwave-abbrev-change-case
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1867 (upcase-region last-abbrev-location (point)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1868 (if (and idlwave-abbrev-move (> arg 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1869 (if (boundp 'post-command-hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1870 (setq idlwave-command-hook (list 'backward-char (1+ arg)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1871 (backward-char arg)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1872 t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1873
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1874 (defun idlwave-in-comment ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1875 "Returns t if point is inside a comment, nil otherwise."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1876 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1877 (let ((here (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1878 (and (idlwave-goto-comment) (> here (point))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1879
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1880 (defun idlwave-goto-comment ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1881 "Move to start of comment delimiter on current line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1882 Moves to end of line if there is no comment delimiter.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1883 Ignores comment delimiters in strings.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1884 Returns point if comment found and nil otherwise."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1885 (let ((eos (progn (end-of-line) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1886 (data (match-data))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1887 found)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1888 ;; Look for first comment delimiter not in a string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1889 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1890 (setq found (search-forward comment-start eos 'lim))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1891 (while (and found (idlwave-in-quote))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1892 (setq found (search-forward comment-start eos 'lim)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1893 (store-match-data data)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1894 (and found (not (idlwave-in-quote))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1895 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1896 (backward-char 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1897 (point)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1898
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1899 (defun idlwave-show-matching-quote ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1900 "Insert quote and show matching quote if this is end of a string."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1901 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1902 (let ((bq (idlwave-in-quote))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1903 (inq last-command-char))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1904 (if (and bq (not (idlwave-in-comment)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1905 (let ((delim (char-after bq)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1906 (insert inq)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1907 (if (eq inq delim)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1908 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1909 (goto-char bq)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1910 (sit-for 1))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1911 ;; Not the end of a string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1912 (insert inq))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1913
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1914 (defun idlwave-show-begin-check ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1915 "Ensure that the previous word was a token before `idlwave-show-begin'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1916 An END token must be preceded by whitespace."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1917 (if
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1918 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1919 (backward-word 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1920 (backward-char 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1921 (looking-at "[ \t\n\f]"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1922 (idlwave-show-begin)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1923
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1924 (defun idlwave-show-begin ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1925 "Finds the start of current block and blinks to it for a second.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1926 Also checks if the correct end statement has been used."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1927 ;; Re-indent end line
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1928 (if idlwave-reindent-end
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
1929 (idlwave-indent-line))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1930 ;; All end statements are reserved words
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1931 (let* ((pos (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1932 end end1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1933 (when (and (idlwave-check-abbrev 0 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1934 idlwave-show-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1935 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1936 ;; Move inside current block
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1937 (setq end (buffer-substring
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1938 (save-excursion (skip-chars-backward "a-zA-Z")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1939 (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1940 (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1941 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1942 (idlwave-block-jump-out -1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1943 (when (setq end1 (cdr (idlwave-block-master)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1944 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1945 ((null end1)) ; no-opeartion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1946 ((string= (downcase end) (downcase end1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1947 (sit-for 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1948 ((string= (downcase end) "end")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1949 ;; A generic end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1950 (if idlwave-expand-generic-end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1951 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1952 (goto-char pos)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1953 (backward-char 3)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1954 (insert (if (string= end "END") (upcase end1) end1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1955 (delete-char 3)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1956 (sit-for 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1957 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1958 (beep)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1959 (message "Warning: Shouldn't this be \"%s\" instead of \"%s\"?"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1960 end1 end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1961 (sit-for 1))))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1962
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1963 (defun idlwave-block-master ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1964 (let ((case-fold-search t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1965 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1966 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1967 ((looking-at "pro\\|case\\|function\\>")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1968 (assoc (downcase (match-string 0)) idlwave-block-matches))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1969 ((looking-at "begin\\>")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1970 (let ((limit (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1971 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1972 (point))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1973 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1974 ((re-search-backward idlwave-block-match-regexp limit t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1975 (assoc (downcase (match-string 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1976 idlwave-block-matches))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1977 ;;((re-search-backward ":[ \t]*\\=" limit t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1978 ;; ;; seems to be a case thing
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1979 ;; '("begin" . "end"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1980 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1981 ;; Just a nromal block
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1982 '("begin" . "end")))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1983 (t nil)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1984
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1985 (defun idlwave-close-block ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1986 "Terminate the current block with the correct END statement."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1987 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1988
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1989 ;; Start new line if we are not in a new line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1990 (unless (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1991 (skip-chars-backward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1992 (bolp))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1993 (let ((idlwave-show-block nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1994 (newline-and-indent)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1995
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1996 ;; Check which end is needed and insert it.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1997 (let ((case-fold-search t) end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1998 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1999 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2000 (idlwave-block-jump-out -1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2001 (if (setq end (idlwave-block-master))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2002 (setq end (cdr end))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2003 (error "Cannot close block")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2004 (insert end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2005 (idlwave-newline)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2006
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2007 (defun idlwave-surround (&optional before after escape-chars length)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2008 "Surround the LENGTH characters before point with blanks.
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2009 LENGTH defaults to 1.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2010 Optional arguments BEFORE and AFTER affect the behavior before and
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2011 after the characters (see also description of `idlwave-make-space'):
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2012
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2013 nil do nothing
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2014 0 force no spaces
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2015 integer > 0 force exactly n spaces
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2016 integer < 0 at least |n| spaces
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2017
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2018 The function does nothing if any of the following conditions is true:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2019 - `idlwave-surround-by-blank' is nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2020 - the character before point is inside a string or comment
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2021 - the char preceeding the string to be surrounded is a member of ESCAPE-CHARS.
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2022 This hack is used to avoid padding of `>' when it is part of
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2023 the '->' operator. In this case, ESCAPE-CHARS would be '(?-)."
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2024
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2025 (setq length (or length 1)) ; establish a default for LENGTH
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2026
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2027 (when (and idlwave-surround-by-blank
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2028 (not (idlwave-quoted))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2029 (not (memq (char-after (- (point) (1+ length))) escape-chars)))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2030 (backward-char length)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2031 (save-restriction
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2032 (let ((here (point)))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2033 (skip-chars-backward " \t")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2034 (if (bolp)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2035 ;; avoid clobbering indent
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2036 (progn
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2037 (move-to-column (idlwave-calculate-indent))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2038 (if (<= (point) here)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2039 (narrow-to-region (point) here))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2040 (goto-char here)))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2041 (idlwave-make-space before))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2042 (skip-chars-forward " \t"))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2043 (forward-char length)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2044 (idlwave-make-space after)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2045 ;; Check to see if the line should auto wrap
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2046 (if (and (equal (char-after (1- (point))) ?\ )
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2047 (> (current-column) fill-column))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2048 (funcall auto-fill-function))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2049
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2050 (defun idlwave-make-space (n)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2051 "Make space at point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2052 The space affected is all the spaces and tabs around point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2053 If n is non-nil then point is left abs(n) spaces from the beginning of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2054 the contiguous space.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2055 The amount of space at point is determined by N.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2056 If the value of N is:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2057 nil - do nothing.
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2058 > 0 - exactly N spaces.
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2059 < 0 - a minimum of -N spaces, i.e., do not change if there are
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2060 already -N spaces.
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
2061 0 - no spaces (i.e. remove any existing space)."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2062 (if (integerp n)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2063 (let
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2064 ((start-col (progn (skip-chars-backward " \t") (current-column)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2065 (left (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2066 (end-col (progn (skip-chars-forward " \t") (current-column))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2067 (delete-horizontal-space)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2068 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2069 ((> n 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2070 (idlwave-indent-to (+ start-col n))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2071 (goto-char (+ left n)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2072 ((< n 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2073 (idlwave-indent-to end-col (- n))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2074 (goto-char (- left n)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2075 ;; n = 0, done
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2076 ))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2077
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2078 (defun idlwave-newline ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2079 "Inserts a newline and indents the current and previous line."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2080 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2081 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2082 ;; Handle unterminated single and double quotes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2083 ;; If not in a comment and in a string then insertion of a newline
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2084 ;; will mean unbalanced quotes.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2085 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2086 (if (and (not (idlwave-in-comment)) (idlwave-in-quote))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2087 (progn (beep)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2088 (message "Warning: unbalanced quotes?")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2089 (newline)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2090 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2091 ;; The current line is being split, the cursor should be at the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2092 ;; beginning of the new line skipping the leading indentation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2093 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2094 ;; The reason we insert the new line before indenting is that the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2095 ;; indenting could be confused by keywords (e.g. END) on the line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2096 ;; after the split point. This prevents us from just using
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2097 ;; `indent-for-tab-command' followed by `newline-and-indent'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2098 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2099 (beginning-of-line 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2100 (idlwave-indent-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2101 (forward-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2102 (idlwave-indent-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2103
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2104 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2105 ;; Use global variable 'comment-column' to set parallel comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2106 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2107 ;; Modeled on lisp.el
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2108 ;; Emacs Lisp and IDL (Wave CL) have identical comment syntax
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2109 (defun idlwave-comment-hook ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2110 "Compute indent for the beginning of the IDL comment delimiter."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2111 (if (or (looking-at idlwave-no-change-comment)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2112 (if idlwave-begin-line-comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2113 (looking-at idlwave-begin-line-comment)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2114 (looking-at "^;")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2115 (current-column)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2116 (if (looking-at idlwave-code-comment)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2117 (if (save-excursion (skip-chars-backward " \t") (bolp))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2118 ;; On line by itself, indent as code
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2119 (let ((tem (idlwave-calculate-indent)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2120 (if (listp tem) (car tem) tem))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2121 ;; after code - do not change
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2122 (current-column))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2123 (skip-chars-backward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2124 (max (if (bolp) 0 (1+ (current-column)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2125 comment-column))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2126
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2127 (defun idlwave-split-line ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2128 "Continue line by breaking line at point and indent the lines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2129 For a code line insert continuation marker. If the line is a line comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2130 then the new line will contain a comment with the same indentation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2131 Splits strings with the IDL operator `+' if `idlwave-split-line-string' is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2132 non-nil."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2133 (interactive)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2134 ;; Expand abbreviation, just like normal RET would.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2135 (and abbrev-mode (expand-abbrev))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2136 (let (beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2137 (if (not (idlwave-in-comment))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2138 ;; For code line add continuation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2139 ;; Check if splitting a string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2140 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2141 (if (setq beg (idlwave-in-quote))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2142 (if idlwave-split-line-string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2143 ;; Split the string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2144 (progn (insert (setq beg (char-after beg)) " + "
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2145 idlwave-continuation-char beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2146 (backward-char 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2147 ;; Do not split the string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2148 (beep)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2149 (message "Warning: continuation inside string!!")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2150 (insert " " idlwave-continuation-char))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2151 ;; Not splitting a string.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2152 (if (not (member (char-before) '(?\ ?\t)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2153 (insert " "))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2154 (insert idlwave-continuation-char))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2155 (newline-and-indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2156 (indent-new-comment-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2157 ;; Indent previous line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2158 (setq beg (- (point-max) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2159 (forward-line -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2160 (idlwave-indent-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2161 (goto-char (- (point-max) beg))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2162 ;; Reindent new line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2163 (idlwave-indent-line)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2164
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2165 (defun idlwave-beginning-of-subprogram ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2166 "Moves point to the beginning of the current program unit."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2167 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2168 (idlwave-find-key idlwave-begin-unit-reg -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2169
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2170 (defun idlwave-end-of-subprogram ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2171 "Moves point to the start of the next program unit."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2172 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2173 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2174 (idlwave-find-key idlwave-end-unit-reg 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2175
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2176 (defun idlwave-mark-statement ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2177 "Mark current IDL statement."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2178 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2179 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2180 (let ((end (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2181 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2182 (idlwave-push-mark end nil t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2183
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2184 (defun idlwave-mark-block ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2185 "Mark containing block."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2186 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2187 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2188 (idlwave-backward-up-block -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2189 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2190 (let ((end (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2191 (idlwave-backward-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2192 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2193 (idlwave-push-mark end nil t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2194
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2195
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2196 (defun idlwave-mark-subprogram ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2197 "Put mark at beginning of program, point at end.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2198 The marks are pushed."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2199 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2200 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2201 (idlwave-beginning-of-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2202 (let ((beg (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2203 (idlwave-forward-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2204 (idlwave-push-mark beg nil t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2205 (exchange-point-and-mark))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2206
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2207 (defun idlwave-backward-up-block (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2208 "Move to beginning of enclosing block if prefix ARG >= 0.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2209 If prefix ARG < 0 then move forward to enclosing block end."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2210 (interactive "p")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2211 (idlwave-block-jump-out (- arg) 'nomark))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2212
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2213 (defun idlwave-beginning-of-block ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2214 "Go to the beginning of the current block."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2215 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2216 (idlwave-block-jump-out -1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2217 (forward-word 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2218
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2219 (defun idlwave-end-of-block ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2220 "Go to the beginning of the current block."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2221 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2222 (idlwave-block-jump-out 1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2223 (backward-word 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2224
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2225 (defun idlwave-forward-block ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2226 "Move across next nested block."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2227 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2228 (if (idlwave-down-block 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2229 (idlwave-block-jump-out 1 'nomark)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2230
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2231 (defun idlwave-backward-block ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2232 "Move backward across previous nested block."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2233 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2234 (if (idlwave-down-block -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2235 (idlwave-block-jump-out -1 'nomark)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2236
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2237 (defun idlwave-down-block (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2238 "Go down a block.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2239 With ARG: ARG >= 0 go forwards, ARG < 0 go backwards.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2240 Returns non-nil if successfull."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2241 (interactive "p")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2242 (let (status)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2243 (if (< arg 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2244 ;; Backward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2245 (let ((eos (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2246 (idlwave-block-jump-out -1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2247 (point))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2248 (if (setq status (idlwave-find-key
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2249 idlwave-end-block-reg -1 'nomark eos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2250 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2251 (message "No nested block before beginning of containing block.")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2252 ;; Forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2253 (let ((eos (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2254 (idlwave-block-jump-out 1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2255 (point))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2256 (if (setq status (idlwave-find-key
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2257 idlwave-begin-block-reg 1 'nomark eos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2258 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2259 (message "No nested block before end of containing block."))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2260 status))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2261
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2262 (defun idlwave-mark-doclib ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2263 "Put point at beginning of doc library header, mark at end.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2264 The marks are pushed."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2265 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2266 (let (beg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2267 (here (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2268 (goto-char (point-max))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2269 (if (re-search-backward idlwave-doclib-start nil t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2270 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2271 (setq beg (progn (beginning-of-line) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2272 (if (re-search-forward idlwave-doclib-end nil t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2273 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2274 (forward-line 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2275 (idlwave-push-mark beg nil t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2276 (message "Could not find end of doc library header.")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2277 (message "Could not find doc library header start.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2278 (goto-char here)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2279
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2280
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2281 (defun idlwave-current-routine ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2282 "Return (NAME TYPE CLASS) of current routine."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2283 (idlwave-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2284 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2285 (idlwave-beginning-of-subprogram)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2286 (if (looking-at "[ \t]*\\<\\(pro\\|function\\)\\>\\s-+\\(\\([a-zA-Z0-9$_]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2287 (let* ((type (if (string= (downcase (match-string 1)) "pro")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2288 'pro 'function))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2289 (class (idlwave-sintern-class (match-string 3)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2290 (name (idlwave-sintern-routine-or-method (match-string 4) class)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2291 (list name type class)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2292
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2293 (defvar idlwave-shell-prompt-pattern)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2294 (defun idlwave-beginning-of-statement ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2295 "Move to beginning of the current statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2296 Skips back past statement continuations.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2297 Point is placed at the beginning of the line whether or not this is an
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2298 actual statement."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2299 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2300 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2301 ((eq major-mode 'idlwave-shell-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2302 (if (re-search-backward idlwave-shell-prompt-pattern nil t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2303 (goto-char (match-end 0))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2304 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2305 (if (save-excursion (forward-line -1) (idlwave-is-continuation-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2306 (idlwave-previous-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2307 (beginning-of-line)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2308
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2309 (defun idlwave-previous-statement ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2310 "Moves point to beginning of the previous statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2311 Returns t if the current line before moving is the beginning of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2312 the first non-comment statement in the file, and nil otherwise."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2313 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2314 (let (first-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2315 (if (not (= (forward-line -1) 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2316 ;; first line in file
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2317 t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2318 ;; skip blank lines, label lines, include lines and line comments
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2319 (while (and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2320 ;; The current statement is the first statement until we
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2321 ;; reach another statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2322 (setq first-statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2323 (or
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2324 (looking-at idlwave-comment-line-start-skip)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2325 (looking-at "[ \t]*$")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2326 (looking-at (concat "[ \t]*" idlwave-label "[ \t]*$"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2327 (looking-at "^@")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2328 (= (forward-line -1) 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2329 ;; skip continuation lines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2330 (while (and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2331 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2332 (forward-line -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2333 (idlwave-is-continuation-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2334 (= (forward-line -1) 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2335 first-statement)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2336
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2337 ;; FIXME: end-of-statement does not work correctly when comment lines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2338 ;; are inside the statement. It does work correctly for line-end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2339 ;; comments, though.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2340 (defun idlwave-end-of-statement ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2341 "Moves point to the end of the current IDL statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2342 If not in a statement just moves to end of line. Returns position."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2343 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2344 (while (and (idlwave-is-continuation-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2345 (= (forward-line 1) 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2346 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2347 (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2348
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2349 (defun idlwave-next-statement ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2350 "Moves point to beginning of the next IDL statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2351 Returns t if that statement is the last
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2352 non-comment IDL statement in the file, and nil otherwise."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2353 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2354 (let (last-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2355 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2356 ;; skip blank lines, label lines, include lines and line comments
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2357 (while (and (= (forward-line 1) 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2358 ;; The current statement is the last statement until
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2359 ;; we reach a new statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2360 (setq last-statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2361 (or
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2362 (looking-at idlwave-comment-line-start-skip)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2363 (looking-at "[ \t]*$")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2364 (looking-at (concat "[ \t]*" idlwave-label "[ \t]*$"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2365 (looking-at "^@")))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2366 last-statement))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2367
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2368 (defun idlwave-skip-label-or-case ()
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2369 "Skip label or case statement element.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2370 Returns position after label.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2371 If there is no label point is not moved and nil is returned."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2372 ;; Case expressions and labels are terminated by a colon.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2373 ;; So we find the first colon in the line and make sure
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2374 ;; - no `?' is before it (might be a ? b : c)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2375 ;; - it is not in a comment
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2376 ;; - not in a string constant
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2377 ;; - not in parenthesis (like a[0:3])
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2378 ;; As many in this mode, this function is heuristic and not an exact
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2379 ;; parser.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2380 (let ((start (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2381 (end (idlwave-find-key ":" 1 'nomark
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2382 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2383 (idlwave-end-of-statement) (point)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2384 (if (and end
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2385 (= (nth 0 (parse-partial-sexp start end)) 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2386 (not (string-match "\\?" (buffer-substring start end))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2387 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2388 (forward-char)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2389 (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2390 (goto-char start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2391 nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2392
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2393 (defun idlwave-start-of-substatement (&optional pre)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2394 "Move to start of next IDL substatement after point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2395 Uses the type of the current IDL statement to determine if the next
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2396 statement is on a new line or is a subpart of the current statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2397 Returns point at start of substatement modulo whitespace.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2398 If optional argument is non-nil move to beginning of current
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2399 substatement."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2400 (let ((orig (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2401 (eos (idlwave-end-of-statement))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2402 (ifnest 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2403 st nst last)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2404 (idlwave-beginning-of-statement)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2405 (idlwave-skip-label-or-case)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2406 (setq last (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2407 ;; Continue looking for substatements until we are past orig
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2408 (while (and (<= (point) orig) (not (eobp)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2409 (setq last (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2410 (setq nst (nth 1 (cdr (setq st (car (idlwave-statement-type))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2411 (if (equal (car st) 'if) (setq ifnest (1+ ifnest)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2412 (cond ((and nst
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2413 (idlwave-find-key nst 1 'nomark eos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2414 (goto-char (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2415 ((and (> ifnest 0) (idlwave-find-key "\\<else\\>" 1 'nomark eos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2416 (setq ifnest (1- ifnest))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2417 (goto-char (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2418 (t (setq ifnest 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2419 (idlwave-next-statement))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2420 (if pre (goto-char last))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2421 ;; If a continuation line starts here, move to next line
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2422 (if (looking-at "[ \t]*\\$\\([ \t]*\\(;\\|$\\)\\)")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2423 (beginning-of-line 2))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2424 (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2425
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2426 (defun idlwave-statement-type ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2427 "Return the type of the current IDL statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2428 Uses `idlwave-statement-match' to return a cons of (type . point) with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2429 point the ending position where the type was determined. Type is the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2430 association from `idlwave-statement-match', i.e. the cons cell from the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2431 list not just the type symbol. Returns nil if not an identifiable
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2432 statement."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2433 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2434 ;; Skip whitespace within a statement which is spaces, tabs, continuations
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2435 (while (looking-at "[ \t]*\\<\\$")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2436 (forward-line 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2437 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2438 (let ((st idlwave-statement-match)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2439 (case-fold-search t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2440 (while (and (not (looking-at (nth 0 (cdr (car st)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2441 (setq st (cdr st))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2442 (if st
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2443 (append st (match-end 0))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2444
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2445 (defun idlwave-expand-equal (&optional before after)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2446 "Pad '=' with spaces.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2447 Two cases: Assignment statement, and keyword assignment.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2448 The case is determined using `idlwave-start-of-substatement' and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2449 `idlwave-statement-type'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2450 The equal sign will be surrounded by BEFORE and AFTER blanks.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2451 If `idlwave-pad-keyword' is t then keyword assignment is treated just
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2452 like assignment statements. When nil, spaces are removed for keyword
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2453 assignment. Any other value keeps the current space around the `='.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2454 Limits in for loops are treated as keyword assignment.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2455 See `idlwave-surround'. "
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2456 ;; Even though idlwave-surround checks `idlwave-surround-by-blank' this
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2457 ;; check saves the time of finding the statement type.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2458 (if idlwave-surround-by-blank
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2459 (let ((st (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2460 (idlwave-start-of-substatement t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2461 (idlwave-statement-type))))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2462
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2463 (cond ((or (and (equal (car (car st)) 'assign)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2464 (equal (cdr st) (point)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2465 (eq t idlwave-pad-keyword))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2466 ;; An assignment statement or keywor and we need padding
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2467 (idlwave-surround before after))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2468 ((null idlwave-pad-keyword)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2469 ;; Spaces should be removed at a keyword
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2470 (idlwave-surround 0 0))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2471 (t)))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2472
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2473 (defun idlwave-indent-and-action ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2474 "Call `idlwave-indent-line' and do expand actions."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2475 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2476 (idlwave-indent-line t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2477 )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2478
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2479 (defun idlwave-indent-line (&optional expand)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2480 "Indents current IDL line as code or as a comment.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2481 The actions in `idlwave-indent-action-table' are performed.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2482 If the optional argument EXPAND is non-nil then the actions in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2483 `idlwave-indent-expand-table' are performed."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2484 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2485 ;; Move point out of left margin.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2486 (if (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2487 (skip-chars-backward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2488 (bolp))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2489 (skip-chars-forward " \t"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2490 (let ((mloc (point-marker)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2491 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2492 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2493 (if (looking-at idlwave-comment-line-start-skip)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2494 ;; Indentation for a line comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2495 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2496 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2497 (idlwave-indent-left-margin (idlwave-comment-hook)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2498 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2499 ;; Code Line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2500 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2501 ;; Before indenting, run action routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2502 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2503 (if (and expand idlwave-do-actions)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2504 (mapcar 'idlwave-do-action idlwave-indent-expand-table))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2505 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2506 (if idlwave-do-actions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2507 (mapcar 'idlwave-do-action idlwave-indent-action-table))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2508 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2509 ;; No longer expand abbrevs on the line. The user can do this
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2510 ;; manually using expand-region-abbrevs.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2511 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2512 ;; Indent for code line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2513 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2514 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2515 (if (or
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2516 ;; a label line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2517 (looking-at (concat "^" idlwave-label "[ \t]*$"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2518 ;; a batch command
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2519 (looking-at "^[ \t]*@"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2520 ;; leave flush left
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2521 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2522 ;; indent the line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2523 (idlwave-indent-left-margin (idlwave-calculate-indent)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2524 ;; Adjust parallel comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2525 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2526 (if (idlwave-in-comment)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2527 (indent-for-comment))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2528 (goto-char mloc)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2529 ;; Get rid of marker
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2530 (set-marker mloc nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2531 ))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2532
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2533 (defun idlwave-do-action (action)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2534 "Perform an action repeatedly on a line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2535 ACTION is a list (REG . FUNC). REG is a regular expression. FUNC is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2536 either a function name to be called with `funcall' or a list to be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2537 evaluated with `eval'. The action performed by FUNC should leave point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2538 after the match for REG - otherwise an infinite loop may be entered."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2539 (let ((action-key (car action))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2540 (action-routine (cdr action)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2541 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2542 (while (idlwave-look-at action-key)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2543 (if (listp action-routine)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2544 (eval action-routine)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2545 (funcall action-routine)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2546
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2547 (defun idlwave-indent-to (col &optional min)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2548 "Indent from point with spaces until column COL.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2549 Inserts space before markers at point."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2550 (if (not min) (setq min 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2551 (insert-before-markers
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2552 (make-string (max min (- col (current-column))) ?\ )))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2553
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2554 (defun idlwave-indent-left-margin (col)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2555 "Indent the current line to column COL.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2556 Indents such that first non-whitespace character is at column COL
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2557 Inserts spaces before markers at point."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2558 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2559 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2560 (delete-horizontal-space)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2561 (idlwave-indent-to col)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2562
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2563 (defun idlwave-indent-subprogram ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2564 "Indents program unit which contains point."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2565 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2566 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2567 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2568 (idlwave-beginning-of-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2569 (let ((beg (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2570 (idlwave-forward-block)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2571 (message "Indenting subprogram...")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2572 (indent-region beg (point) nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2573 (message "Indenting subprogram...done.")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2574
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2575 (defun idlwave-calculate-indent ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2576 "Return appropriate indentation for current line as IDL code."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2577 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2578 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2579 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2580 ;; Check for beginning of unit - main (beginning of buffer), pro, or
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2581 ;; function
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2582 ((idlwave-look-at idlwave-begin-unit-reg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2583 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2584 ;; Check for continuation line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2585 ((save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2586 (and (= (forward-line -1) 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2587 (idlwave-is-continuation-line)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2588 (idlwave-calculate-cont-indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2589 ;; calculate indent based on previous and current statements
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2590 (t (let ((the-indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2591 ;; calculate indent based on previous statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2592 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2593 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2594 ((idlwave-previous-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2595 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2596 ;; Main block
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2597 ((idlwave-look-at idlwave-begin-unit-reg t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2598 (+ (idlwave-current-statement-indent)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2599 idlwave-main-block-indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2600 ;; Begin block
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2601 ((idlwave-look-at idlwave-begin-block-reg t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2602 (+ (idlwave-current-statement-indent)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2603 idlwave-block-indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2604 ((idlwave-look-at idlwave-end-block-reg t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2605 (- (idlwave-current-statement-indent)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2606 idlwave-end-offset
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2607 idlwave-block-indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2608 ((idlwave-current-statement-indent))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2609 ;; adjust the indentation based on the current statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2610 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2611 ;; End block
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2612 ((idlwave-look-at idlwave-end-block-reg t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2613 (+ the-indent idlwave-end-offset))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2614 (the-indent)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2615
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2616 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2617 ;; Parenthesses balacing/indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2618 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2619
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2620 (defun idlwave-calculate-cont-indent ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2621 "Calculates the IDL continuation indent column from the previous statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2622 Note that here previous statement means the beginning of the current
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2623 statement if this statement is a continuation of the previous line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2624 Intervening comments or comments within the previous statement can
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2625 screw things up if the comments contain parentheses characters."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2626 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2627 (let* (open
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2628 (case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2629 (end-reg (progn (beginning-of-line) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2630 (close-exp (progn (skip-chars-forward " \t") (looking-at "\\s)")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2631 (beg-reg (progn (idlwave-previous-statement) (point))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2632 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2633 ;; If PRO or FUNCTION declaration indent after name, and first comma.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2634 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2635 (if (idlwave-look-at "\\<\\(pro\\|function\\)\\>")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2636 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2637 (forward-sexp 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2638 (if (looking-at "[ \t]*,[ \t]*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2639 (goto-char (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2640 (current-column))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2641 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2642 ;; Not a PRO or FUNCTION
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2643 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2644 ;; Look for innermost unmatched open paren
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2645 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2646 (if (setq open (car (cdr (parse-partial-sexp beg-reg end-reg))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2647 ;; Found innermost open paren.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2648 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2649 (goto-char open)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2650 ;; Line up with next word unless this is a closing paren.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2651 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2652 ;; This is a closed paren - line up under open paren.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2653 (close-exp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2654 (current-column))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2655 ;; Empty - just add regular indent. Take into account
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2656 ;; the forward-char
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2657 ((progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2658 ;; Skip paren
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2659 (forward-char 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2660 (looking-at "[ \t$]*$"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2661 (+ (current-column) idlwave-continuation-indent -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2662 ;; Line up with first word
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2663 ((progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2664 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2665 (current-column)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2666 ;; No unmatched open paren. Just a simple continuation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2667 (goto-char beg-reg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2668 (+ (idlwave-current-indent)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2669 ;; Make adjustments based on current line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2670 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2671 ;; Else statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2672 ((progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2673 (goto-char end-reg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2674 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2675 (looking-at "else"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2676 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2677 ;; Ordinary continuation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2678 (idlwave-continuation-indent))))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2679
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2680 (defun idlwave-find-key-old (key-reg &optional dir nomark limit)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2681 "Move in direction of the optional second argument DIR to the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2682 next keyword not contained in a comment or string and occurring before
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2683 optional fourth argument LIMIT. DIR defaults to forward direction. If
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2684 DIR is negative the search is backwards, otherwise, it is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2685 forward. LIMIT defaults to the beginning or end of the buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2686 according to the direction of the search. The keyword is given by the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2687 regular expression argument KEY-REG. The search is case insensitive.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2688 Returns position if successful and nil otherwise. If found
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2689 `push-mark' is executed unless the optional third argument NOMARK is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2690 non-nil. If found, the point is left at the keyword beginning."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2691 (or dir (setq dir 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2692 (or limit (setq limit (cond ((>= dir 0) (point-max)) ((point-min)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2693 (let (found
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2694 (case-fold-search t))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2695 (idlwave-with-special-syntax
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2696 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2697 (if (>= dir 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2698 (while (and (setq found (and
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2699 (re-search-forward key-reg limit t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2700 (match-beginning 0)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2701 (idlwave-quoted)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2702 (not (eobp))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2703 (while (and (setq found (and
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2704 (re-search-backward key-reg limit t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2705 (match-beginning 0)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2706 (idlwave-quoted)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2707 (not (bobp)))))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2708 (if found (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2709 (if (not nomark) (push-mark))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2710 (goto-char found)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2711
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2712 ;; FIXME: The following is an experimental re-write of the previous
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2713 ;; function. Still needs to be tested.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2714 (defun idlwave-find-key (key-re &optional dir nomark limit)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2715 "Move to next match of the regular expression KEY-RE.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2716 Matches inside comments or string constants will be ignored.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2717 If DIR is negative, the search will be backwards.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2718 At a successful match, the mark is pushed unless NOMARK is non-nil.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2719 Searches are limited to LIMIT.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2720 Searches are case-insensitive and use a special syntax table which
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2721 treats `$' and `_' as word characters.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2722 Return value is the beginning of the match or (in case of failure) nil."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2723 (setq dir (or dir 0))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2724 (let ((case-fold-search t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2725 (search-func (if (> dir 0) 're-search-forward 're-search-backward))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2726 found)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2727 (idlwave-with-special-syntax
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2728 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2729 (catch 'exit
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2730 (while (funcall search-func key-re limit t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2731 (if (not (idlwave-quoted))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2732 (throw 'exit (setq found (match-beginning 0))))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2733 (if found
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2734 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2735 (if (not nomark) (push-mark))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2736 (goto-char found)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2737 found)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2738 nil)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2739
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2740 (defun idlwave-block-jump-out (&optional dir nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2741 "When optional argument DIR is non-negative, move forward to end of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2742 current block using the `idlwave-begin-block-reg' and `idlwave-end-block-reg'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2743 regular expressions. When DIR is negative, move backwards to block beginning.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2744 Recursively calls itself to skip over nested blocks. DIR defaults to
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2745 forward. Calls `push-mark' unless the optional argument NOMARK is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2746 non-nil. Movement is limited by the start of program units because of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2747 possibility of unbalanced blocks."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2748 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2749 (or dir (setq dir 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2750 (let* ((here (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2751 (case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2752 (limit (if (>= dir 0) (point-max) (point-min)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2753 (block-limit (if (>= dir 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2754 idlwave-begin-block-reg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2755 idlwave-end-block-reg))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2756 found
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2757 (block-reg (concat idlwave-begin-block-reg "\\|"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2758 idlwave-end-block-reg))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2759 (unit-limit (or (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2760 (if (< dir 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2761 (idlwave-find-key
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2762 idlwave-begin-unit-reg dir t limit)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2763 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2764 (idlwave-find-key
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2765 idlwave-end-unit-reg dir t limit)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2766 limit)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2767 (if (>= dir 0) (end-of-line)) ;Make sure we are in current block
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2768 (if (setq found (idlwave-find-key block-reg dir t unit-limit))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2769 (while (and found (looking-at block-limit))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2770 (if (>= dir 0) (forward-word 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2771 (idlwave-block-jump-out dir t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2772 (setq found (idlwave-find-key block-reg dir t unit-limit))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2773 (if (not nomark) (push-mark here))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2774 (if (not found) (goto-char unit-limit)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2775 (if (>= dir 0) (forward-word 1)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2776
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2777 (defun idlwave-current-statement-indent ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2778 "Return indentation of the current statement.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2779 If in a statement, moves to beginning of statement before finding indent."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2780 (idlwave-beginning-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2781 (idlwave-current-indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2782
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2783 (defun idlwave-current-indent ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2784 "Return the column of the indentation of the current line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2785 Skips any whitespace. Returns 0 if the end-of-line follows the whitespace."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2786 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2787 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2788 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2789 ;; if we are at the end of blank line return 0
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2790 (cond ((eolp) 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2791 ((current-column)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2792
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2793 (defun idlwave-is-continuation-line ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2794 "Tests if current line is continuation line."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2795 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2796 (idlwave-look-at "\\<\\$")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2797
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2798 (defun idlwave-is-comment-line ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2799 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2800 (beginning-of-line 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2801 (looking-at "[ \t]*;")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2802
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2803 (defun idlwave-look-at (regexp &optional cont beg)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2804 "Searches current line from current point for REGEXP.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2805 If optional argument CONT is non-nil, searches to the end of
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2806 the current statement.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2807 If optional arg BEG is non-nil, search starts from the beginning of the
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2808 current statement.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2809 Ignores matches that end in a comment or inside a string expression.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2810 Returns point if successful, nil otherwise.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2811 This function produces unexpected results if REGEXP contains quotes or
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2812 a comment delimiter. The search is case insensitive.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2813 If successful leaves point after the match, otherwise, does not move point."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2814 (let ((here (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2815 (case-fold-search t)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2816 (eos (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2817 (if cont (idlwave-end-of-statement) (end-of-line))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2818 (point)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2819 found)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2820 (idlwave-with-special-syntax
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2821 (if beg (idlwave-beginning-of-statement))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2822 (while (and (setq found (re-search-forward regexp eos t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2823 (idlwave-quoted))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2824 (if (not found) (goto-char here))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2825 found))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2826
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2827 (defun idlwave-fill-paragraph (&optional nohang)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2828 "Fills paragraphs in comments.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2829 A paragraph is made up of all contiguous lines having the same comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2830 leader (the leading whitespace before the comment delimiter and the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2831 comment delimiter). In addition, paragraphs are separated by blank
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2832 line comments. The indentation is given by the hanging indent of the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2833 first line, otherwise by the minimum indentation of the lines after
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2834 the first line. The indentation of the first line does not change.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2835 Does not effect code lines. Does not fill comments on the same line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2836 with code. The hanging indent is given by the end of the first match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2837 matching `idlwave-hang-indent-regexp' on the paragraph's first line . If the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2838 optional argument NOHANG is non-nil then the hanging indent is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2839 ignored."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2840 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2841 ;; check if this is a line comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2842 (if (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2843 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2844 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2845 (looking-at comment-start))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2846 (let
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2847 ((indent 999)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2848 pre here diff fill-prefix-reg bcl first-indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2849 hang start end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2850 ;; Change tabs to spaces in the surrounding paragraph.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2851 ;; The surrounding paragraph will be the largest containing block of
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2852 ;; contiguous line comments. Thus, we may be changing tabs in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2853 ;; a much larger area than is needed, but this is the easiest
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2854 ;; brute force way to do it.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2855 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2856 ;; This has the undesirable side effect of replacing the tabs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2857 ;; permanently without the user's request or knowledge.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2858 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2859 (backward-paragraph)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2860 (setq start (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2861 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2862 (forward-paragraph)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2863 (setq end (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2864 (untabify start end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2865 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2866 (setq here (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2867 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2868 (setq bcl (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2869 (re-search-forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2870 (concat "^[ \t]*" comment-start "+")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2871 (save-excursion (end-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2872 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2873 ;; Get the comment leader on the line and its length
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2874 (setq pre (current-column))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2875 ;; the comment leader is the indentation plus exactly the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2876 ;; number of consecutive ";".
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2877 (setq fill-prefix-reg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2878 (concat
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2879 (setq fill-prefix
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2880 (regexp-quote
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2881 (buffer-substring (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2882 (beginning-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2883 (point))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2884 "[^;]"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2885
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2886 ;; Mark the beginning and end of the paragraph
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2887 (goto-char bcl)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2888 (while (and (looking-at fill-prefix-reg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2889 (not (looking-at paragraph-separate))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2890 (not (bobp)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2891 (forward-line -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2892 ;; Move to first line of paragraph
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2893 (if (/= (point) bcl)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2894 (forward-line 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2895 (setq start (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2896 (goto-char bcl)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2897 (while (and (looking-at fill-prefix-reg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2898 (not (looking-at paragraph-separate))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2899 (not (eobp)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2900 (forward-line 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2901 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2902 (if (or (not (looking-at fill-prefix-reg))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2903 (looking-at paragraph-separate))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2904 (forward-line -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2905 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2906 ;; if at end of buffer add a newline (need this because
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2907 ;; fill-region needs END to be at the beginning of line after
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2908 ;; the paragraph or it will add a line).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2909 (if (eobp)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2910 (progn (insert ?\n) (backward-char 1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2911 ;; Set END to the beginning of line after the paragraph
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2912 ;; END is calculated as distance from end of buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2913 (setq end (- (point-max) (point) 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2914 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2915 ;; Calculate the indentation for the paragraph.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2916 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2917 ;; In the following while statements, after one iteration
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2918 ;; point will be at the beginning of a line in which case
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2919 ;; the while will not be executed for the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2920 ;; the first paragraph line and thus will not affect the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2921 ;; indentation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2922 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2923 ;; First check to see if indentation is based on hanging indent.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2924 (if (and (not nohang) idlwave-hanging-indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2925 (setq hang
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2926 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2927 (goto-char start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2928 (idlwave-calc-hanging-indent))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2929 ;; Adjust lines of paragraph by inserting spaces so that
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2930 ;; each line's indent is at least as great as the hanging
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2931 ;; indent. This is needed for fill-paragraph to work with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2932 ;; a fill-prefix.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2933 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2934 (setq indent hang)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2935 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2936 (while (> (point) start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2937 (re-search-forward comment-start-skip
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2938 (save-excursion (end-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2939 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2940 (if (> (setq diff (- indent (current-column))) 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2941 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2942 (if (>= here (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2943 ;; adjust the original location for the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2944 ;; inserted text.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2945 (setq here (+ here diff)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2946 (insert (make-string diff ?\ ))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2947 (forward-line -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2948 )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2949
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2950 ;; No hang. Instead find minimum indentation of paragraph
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2951 ;; after first line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2952 ;; For the following while statement, since START is at the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2953 ;; beginning of line and END is at the the end of line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2954 ;; point is greater than START at least once (which would
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2955 ;; be the case for a single line paragraph).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2956 (while (> (point) start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2957 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2958 (setq indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2959 (min indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2960 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2961 (re-search-forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2962 comment-start-skip
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2963 (save-excursion (end-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2964 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2965 (current-column))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2966 (forward-line -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2967 )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2968 (setq fill-prefix (concat fill-prefix
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2969 (make-string (- indent pre)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2970 ?\ )))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2971 ;; first-line indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2972 (setq first-indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2973 (max
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2974 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2975 (re-search-forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2976 comment-start-skip
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2977 (save-excursion (end-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2978 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2979 (current-column))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2980 indent))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2981
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2982 ;; try to keep point at its original place
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2983 (goto-char here)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2984
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2985 ;; In place of the more modern fill-region-as-paragraph, a hack
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2986 ;; to keep whitespace untouched on the first line within the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2987 ;; indent length and to preserve any indent on the first line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2988 ;; (first indent).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2989 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2990 (setq diff
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2991 (buffer-substring start (+ start first-indent -1)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
2992 (subst-char-in-region start (+ start first-indent -1) ?\ ?~ nil)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2993 (fill-region-as-paragraph
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2994 start
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2995 (- (point-max) end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2996 (current-justification)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2997 nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2998 (delete-region start (+ start first-indent -1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2999 (goto-char start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3000 (insert diff))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3001 ;; When we want the point at the beginning of the comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3002 ;; body fill-region will put it at the beginning of the line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3003 (if (bolp) (skip-chars-forward (concat " \t" comment-start)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3004 (setq fill-prefix nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3005
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3006 (defun idlwave-calc-hanging-indent ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3007 "Calculate the position of the hanging indent for the comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3008 paragraph. The hanging indent position is given by the first match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3009 with the `idlwave-hang-indent-regexp'. If `idlwave-use-last-hang-indent' is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3010 non-nil then use last occurrence matching `idlwave-hang-indent-regexp' on
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3011 the line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3012 If not found returns nil."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3013 (if idlwave-use-last-hang-indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3014 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3015 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3016 (if (re-search-backward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3017 idlwave-hang-indent-regexp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3018 (save-excursion (beginning-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3019 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3020 (+ (current-column) (length idlwave-hang-indent-regexp))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3021 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3022 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3023 (if (re-search-forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3024 idlwave-hang-indent-regexp
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3025 (save-excursion (end-of-line) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3026 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3027 (current-column)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3028
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3029 (defun idlwave-auto-fill ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3030 "Called to break lines in auto fill mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3031 Only fills comment lines if `idlwave-fill-comment-line-only' is non-nil.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3032 Places a continuation character at the end of the line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3033 if not in a comment. Splits strings with IDL concatenation operator
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3034 `+' if `idlwave-auto-fill-split-string is non-nil."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3035 (if (<= (current-column) fill-column)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3036 nil ; do not to fill
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3037 (if (or (not idlwave-fill-comment-line-only)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3038 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3039 ;; Check for comment line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3040 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3041 (looking-at idlwave-comment-line-start-skip)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3042 (let (beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3043 (idlwave-indent-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3044 ;; Prevent actions do-auto-fill which calls indent-line-function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3045 (let (idlwave-do-actions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3046 (paragraph-start ".")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3047 (paragraph-separate "."))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3048 (do-auto-fill))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3049 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3050 (end-of-line 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3051 ;; Indent the split line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3052 (idlwave-indent-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3053 )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3054 (if (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3055 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3056 (looking-at idlwave-comment-line-start-skip))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3057 ;; A continued line comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3058 ;; We treat continued line comments as part of a comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3059 ;; paragraph. So we check for a hanging indent.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3060 (if idlwave-hanging-indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3061 (let ((here (- (point-max) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3062 (indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3063 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3064 (forward-line -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3065 (idlwave-calc-hanging-indent))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3066 (if indent
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3067 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3068 ;; Remove whitespace between comment delimiter and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3069 ;; text, insert spaces for appropriate indentation.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3070 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3071 (re-search-forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3072 comment-start-skip
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3073 (save-excursion (end-of-line) (point)) t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3074 (delete-horizontal-space)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3075 (idlwave-indent-to indent)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3076 (goto-char (- (point-max) here)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3077 )))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3078 ;; Split code or comment?
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3079 (if (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3080 (end-of-line 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3081 (idlwave-in-comment))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3082 ;; Splitting a non-line comment.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3083 ;; Insert the comment delimiter from split line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3084 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3085 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3086 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3087 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3088 ;; Insert blank to keep off beginning of line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3089 (insert " "
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3090 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3091 (forward-line -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3092 (buffer-substring (idlwave-goto-comment)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3093 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3094 (skip-chars-forward "; ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3095 (point))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3096 (idlwave-indent-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3097 ;; Split code line - add continuation character
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3098 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3099 (end-of-line 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3100 ;; Check to see if we split a string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3101 (if (and (setq beg (idlwave-in-quote))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3102 idlwave-auto-fill-split-string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3103 ;; Split the string and concatenate.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3104 ;; The first extra space is for the space
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3105 ;; the line was split. That space was removed.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3106 (insert " " (char-after beg) " +"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3107 (insert " $"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3108 (if beg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3109 (if idlwave-auto-fill-split-string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3110 ;; Make the second part of continued string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3111 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3112 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3113 (skip-chars-forward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3114 (insert (char-after beg)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3115 ;; Warning
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3116 (beep)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3117 (message "Warning: continuation inside a string.")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3118 ;; Although do-auto-fill (via indent-new-comment-line) calls
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3119 ;; idlwave-indent-line for the new line, re-indent again
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3120 ;; because of the addition of the continuation character.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3121 (idlwave-indent-line))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3122 )))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3123
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3124 (defun idlwave-auto-fill-mode (arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3125 "Toggle auto-fill mode for IDL mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3126 With arg, turn auto-fill mode on if arg is positive.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3127 In auto-fill mode, inserting a space at a column beyond `fill-column'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3128 automatically breaks the line at a previous space."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3129 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3130 (prog1 (set idlwave-fill-function
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3131 (if (if (null arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3132 (not (symbol-value idlwave-fill-function))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3133 (> (prefix-numeric-value arg) 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3134 'idlwave-auto-fill
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3135 nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3136 ;; update mode-line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3137 (set-buffer-modified-p (buffer-modified-p))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3138
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3139 (defun idlwave-doc-header (&optional nomark )
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3140 "Insert a documentation header at the beginning of the unit.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3141 Inserts the value of the variable idlwave-file-header. Sets mark before
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3142 moving to do insertion unless the optional prefix argument NOMARK
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3143 is non-nil."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3144 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3145 (or nomark (push-mark))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3146 ;; make sure we catch the current line if it begins the unit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3147 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3148 (idlwave-beginning-of-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3149 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3150 ;; skip function or procedure line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3151 (if (idlwave-look-at "\\<\\(pro\\|function\\)\\>")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3152 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3153 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3154 (if (> (forward-line 1) 0) (insert "\n"))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3155 (if idlwave-file-header
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3156 (cond ((car idlwave-file-header)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3157 (insert-file (car idlwave-file-header)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3158 ((stringp (car (cdr idlwave-file-header)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3159 (insert (car (cdr idlwave-file-header)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3160
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3161
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3162 (defun idlwave-default-insert-timestamp ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3163 "Default timestamp insertion function"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3164 (insert (current-time-string))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3165 (insert ", " (user-full-name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3166 (insert " <" (user-login-name) "@" (system-name) ">")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3167 ;; Remove extra spaces from line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3168 (idlwave-fill-paragraph)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3169 ;; Insert a blank line comment to separate from the date entry -
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3170 ;; will keep the entry from flowing onto date line if re-filled.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3171 (insert "\n;\n;\t\t"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3172
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3173 (defun idlwave-doc-modification ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3174 "Insert a brief modification log at the beginning of the current program.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3175 Looks for an occurrence of the value of user variable
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3176 `idlwave-doc-modifications-keyword' if non-nil. Inserts time and user name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3177 and places the point for the user to add a log. Before moving, saves
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3178 location on mark ring so that the user can return to previous point."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3179 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3180 (push-mark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3181 ;; make sure we catch the current line if it begins the unit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3182 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3183 (idlwave-beginning-of-subprogram)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3184 (let ((pro (idlwave-look-at "\\<\\(function\\|pro\\)\\>"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3185 (case-fold-search nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3186 (if (re-search-forward
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3187 (concat idlwave-doc-modifications-keyword ":")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3188 ;; set search limit at next unit beginning
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3189 (save-excursion (idlwave-end-of-subprogram) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3190 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3191 (end-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3192 ;; keyword not present, insert keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3193 (if pro (idlwave-next-statement)) ; skip past pro or function statement
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3194 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3195 (insert "\n" comment-start "\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3196 (forward-line -2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3197 (insert comment-start " " idlwave-doc-modifications-keyword ":")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3198 (idlwave-newline)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3199 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3200 (insert ";\n;\t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3201 (run-hooks 'idlwave-timestamp-hook))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3202
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3203 ;;; CJC 3/16/93
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3204 ;;; Interface to expand-region-abbrevs which did not work when the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3205 ;;; abbrev hook associated with an abbrev moves point backwards
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3206 ;;; after abbrev expansion, e.g., as with the abbrev '.n'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3207 ;;; The original would enter an infinite loop in attempting to expand
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3208 ;;; .n (it would continually expand and unexpand the abbrev without expanding
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3209 ;;; because the point would keep going back to the beginning of the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3210 ;;; abbrev instead of to the end of the abbrev). We now keep the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3211 ;;; abbrev hook from moving backwards.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3212 ;;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3213 (defun idlwave-expand-region-abbrevs (start end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3214 "Expand each abbrev occurrence in the region.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3215 Calling from a program, arguments are START END."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3216 (interactive "r")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3217 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3218 (goto-char (min start end))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3219 (let ((idlwave-show-block nil) ;Do not blink
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3220 (idlwave-abbrev-move nil)) ;Do not move
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3221 (expand-region-abbrevs start end 'noquery))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3222
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3223 (defun idlwave-quoted ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3224 "Returns t if point is in a comment or quoted string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3225 nil otherwise."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3226 (or (idlwave-in-comment) (idlwave-in-quote)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3227
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3228 (defun idlwave-in-quote ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3229 "Returns location of the opening quote
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3230 if point is in a IDL string constant, nil otherwise.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3231 Ignores comment delimiters on the current line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3232 Properly handles nested quotation marks and octal
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3233 constants - a double quote followed by an octal digit."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3234 ;;; Treat an octal inside an apostrophe to be a normal string. Treat a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3235 ;;; double quote followed by an octal digit to be an octal constant
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3236 ;;; rather than a string. Therefore, there is no terminating double
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3237 ;;; quote.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3238 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3239 ;; Because single and double quotes can quote each other we must
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3240 ;; search for the string start from the beginning of line.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3241 (let* ((start (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3242 (eol (progn (end-of-line) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3243 (bq (progn (beginning-of-line) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3244 (endq (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3245 (data (match-data))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3246 delim
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3247 found)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3248 (while (< endq start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3249 ;; Find string start
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3250 ;; Don't find an octal constant beginning with a double quote
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3251 (if (re-search-forward "\"[^0-7]\\|'\\|\"$" eol 'lim)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3252 ;; Find the string end.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3253 ;; In IDL, two consecutive delimiters after the start of a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3254 ;; string act as an
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3255 ;; escape for the delimiter in the string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3256 ;; Two consecutive delimiters alone (i.e., not after the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3257 ;; start of a string) is the the null string.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3258 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3259 ;; Move to position after quote
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3260 (goto-char (1+ (match-beginning 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3261 (setq bq (1- (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3262 ;; Get the string delimiter
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3263 (setq delim (char-to-string (preceding-char)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3264 ;; Check for null string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3265 (if (looking-at delim)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3266 (progn (setq endq (point)) (forward-char 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3267 ;; Look for next unpaired delimiter
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3268 (setq found (search-forward delim eol 'lim))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3269 (while (looking-at delim)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3270 (forward-char 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3271 (setq found (search-forward delim eol 'lim)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3272 (if found
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3273 (setq endq (- (point) 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3274 (setq endq (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3275 ))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3276 (progn (setq bq (point)) (setq endq (point)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3277 (store-match-data data)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3278 ;; return string beginning position or nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3279 (if (> start bq) bq))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3280
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3281 ;; Statement templates
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3282
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3283 ;; Replace these with a general template function, something like
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3284 ;; expand.el (I think there was also something with a name similar to
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3285 ;; dmacro.el)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3286
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3287 (defun idlwave-template (s1 s2 &optional prompt noindent)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3288 "Build a template with optional prompt expression.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3289
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3290 Opens a line if point is not followed by a newline modulo intervening
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3291 whitespace. S1 and S2 are strings. S1 is inserted at point followed
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3292 by S2. Point is inserted between S1 and S2. The case of S1 and S2 is
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3293 adjusted according to `idlwave-abbrev-change-case'. If optional argument
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3294 PROMPT is a string then it is displayed as a message in the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3295 minibuffer. The PROMPT serves as a reminder to the user of an
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3296 expression to enter.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3297
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3298 The lines containing S1 and S2 are reindented using `indent-region'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3299 unless the optional second argument NOINDENT is non-nil."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3300 (if (eq major-mode 'idlwave-shell-mode)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3301 ;; This is a gross hack to avoit template abbrev expasion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3302 ;; in the shell. FIXME: This is a dirty hack.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3303 (if (and (eq this-command 'self-insert-command)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3304 (equal last-abbrev-location (point)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3305 (insert last-abbrev-text)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3306 (error "No templates in idlwave-shell"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3307 (cond ((eq idlwave-abbrev-change-case 'down)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3308 (setq s1 (downcase s1) s2 (downcase s2)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3309 (idlwave-abbrev-change-case
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3310 (setq s1 (upcase s1) s2 (upcase s2))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3311 (let ((beg (save-excursion (beginning-of-line) (point)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3312 end)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3313 (if (not (looking-at "\\s-*\n"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3314 (open-line 1))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3315 (insert s1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3316 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3317 (insert s2)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3318 (setq end (point)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3319 (if (not noindent)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3320 (indent-region beg end nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3321 (if (stringp prompt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3322 (message prompt)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3323
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3324 (defun idlwave-rw-case (string)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3325 "Make STRING have the case required by `idlwave-reserved-word-upcase'."
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3326 (if idlwave-reserved-word-upcase
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3327 (upcase string)
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3328 string))
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3329
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3330 (defun idlwave-elif ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3331 "Build skeleton IDL if-else block."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3332 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3333 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3334 (idlwave-rw-case "if")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3335 (idlwave-rw-case " then begin\n\nendif else begin\n\nendelse")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3336 "Condition expression"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3337
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3338 (defun idlwave-case ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3339 "Build skeleton IDL case statement."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3340 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3341 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3342 (idlwave-rw-case "case")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3343 (idlwave-rw-case " of\n\nendcase")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3344 "Selector expression"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3345
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3346 (defun idlwave-for ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3347 "Build skeleton for loop statment."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3348 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3349 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3350 (idlwave-rw-case "for")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3351 (idlwave-rw-case " do begin\n\nendfor")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3352 "Loop expression"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3353
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3354 (defun idlwave-if ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3355 "Build skeleton for loop statment."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3356 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3357 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3358 (idlwave-rw-case "if")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3359 (idlwave-rw-case " then begin\n\nendif")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3360 "Scalar logical expression"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3361
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3362 (defun idlwave-procedure ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3363 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3364 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3365 (idlwave-rw-case "pro")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3366 (idlwave-rw-case "\n\nreturn\nend")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3367 "Procedure name"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3368
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3369 (defun idlwave-function ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3370 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3371 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3372 (idlwave-rw-case "function")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3373 (idlwave-rw-case "\n\nreturn\nend")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3374 "Function name"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3375
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3376 (defun idlwave-repeat ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3377 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3378 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3379 (idlwave-rw-case "repeat begin\n\nendrep until")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3380 (idlwave-rw-case "")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3381 "Exit condition"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3382
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3383 (defun idlwave-while ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3384 (interactive)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3385 (idlwave-template
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3386 (idlwave-rw-case "while")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3387 (idlwave-rw-case " do begin\n\nendwhile")
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
3388 "Entry condition"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3389
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3390 (defun idlwave-split-string (string &optional pattern)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3391 "Return a list of substrings of STRING which are separated by PATTERN.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3392 If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3393 (or pattern
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3394 (setq pattern "[ \f\t\n\r\v]+"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3395 (let (parts (start 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3396 (while (string-match pattern string start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3397 (setq parts (cons (substring string start (match-beginning 0)) parts)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3398 start (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3399 (nreverse (cons (substring string start) parts))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3400
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3401 (defun idlwave-replace-string (string replace_string replace_with)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3402 (let* ((start 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3403 (last (length string))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3404 (ret_string "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3405 end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3406 (while (setq end (string-match replace_string string start))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3407 (setq ret_string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3408 (concat ret_string (substring string start end) replace_with))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3409 (setq start (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3410 (setq ret_string (concat ret_string (substring string start last)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3411
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3412 (defun idlwave-get-buffer-visiting (file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3413 ;; Return the buffer currently visiting FILE
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3414 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3415 ((boundp 'find-file-compare-truenames) ; XEmacs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3416 (let ((find-file-compare-truenames t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3417 (get-file-buffer file)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3418 ((fboundp 'find-buffer-visiting) ; Emacs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3419 (find-buffer-visiting file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3420 (t (error "This should not happen (idlwave-get-buffer-visiting)"))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3421
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3422 (defvar idlwave-outlawed-buffers nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3423 "List of buffer pulled up by idlwave for special reasons.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3424 Buffers in this list may be killed by `idlwave-kill-autoloaded-buffers'.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3425
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3426 (defun idlwave-find-file-noselect (file &optional why)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3427 ;; Return a buffer visiting file.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3428 (or (idlwave-get-buffer-visiting file)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3429 (let ((buf (find-file-noselect file)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3430 (if why (add-to-list 'idlwave-outlawed-buffers (cons buf why)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3431 buf)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3432
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3433 (defun idlwave-kill-autoloaded-buffers ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3434 "Cleanup by killing buffers created automatically by IDLWAVE.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3435 Function prompts for a letter to identify the buffers to kill.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3436 Possible letters are:
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3437
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3438 f Buffers created by the command \\[idlwave-find-module] or mouse
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3439 clicks in the routine info window.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3440 s Buffers created by the IDLWAVE Shell to display where execution
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3441 stopped or an error was found.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3442 a Both of the above.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3443
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3444 Buffer containing unsaved changes require confirmation before they are killed."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3445 (interactive)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3446 (if (null idlwave-outlawed-buffers)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3447 (error "No IDLWAVE-created buffers available")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3448 (princ (format "Kill IDLWAVE-created buffers: [f]ind source(%d), [s]hell display(%d), [a]ll ? "
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3449 (idlwave-count-outlawed-buffers 'find)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3450 (idlwave-count-outlawed-buffers 'shell)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3451 (let ((c (read-char)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3452 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3453 ((member c '(?f ?\C-f))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3454 (idlwave-do-kill-autoloaded-buffers 'find))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3455 ((member c '(?s ?\C-s))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3456 (idlwave-do-kill-autoloaded-buffers 'shell))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3457 ((member c '(?a ?\C-a))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3458 (idlwave-do-kill-autoloaded-buffers t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3459 (t (error "Abort"))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3460
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3461 (defun idlwave-count-outlawed-buffers (tag)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3462 "How many outlawed buffers have tag TAG?"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3463 (length (delq nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3464 (mapcar
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3465 (lambda (x) (eq (cdr x) tag))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3466 idlwave-outlawed-buffers))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3467
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3468 (defun idlwave-do-kill-autoloaded-buffers (&rest reasons)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3469 "Kill all buffers pulled up by IDLWAVE matching REASONS."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3470 (let* ((list (copy-sequence idlwave-outlawed-buffers))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3471 (cnt 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3472 entry)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3473 (while (setq entry (pop list))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3474 (if (buffer-live-p (car entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3475 (and (or (memq t reasons)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3476 (memq (cdr entry) reasons))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3477 (kill-buffer (car entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3478 (incf cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3479 (setq idlwave-outlawed-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3480 (delq entry idlwave-outlawed-buffers)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3481 (setq idlwave-outlawed-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3482 (delq entry idlwave-outlawed-buffers))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3483 (message "%d buffer%s killed" cnt (if (= cnt 1) "" "s"))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3484
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3485 (defun idlwave-revoke-license-to-kill ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3486 "Remove BUFFER from the buffers which may be killed.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3487 Killing would be done by `idlwave-do-kill-autoloaded-buffers'.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3488 Intended for `after-save-hook'."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3489 (let* ((buf (current-buffer))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3490 (entry (assq buf idlwave-outlawed-buffers)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3491 ;; Revoke license
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3492 (if entry
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3493 (setq idlwave-outlawed-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3494 (delq entry idlwave-outlawed-buffers)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3495 ;; Remove this function from the hook.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3496 (remove-hook 'after-save-hook 'idlwave-revoke-license-to-kill 'local)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3497
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3498 (defvar idlwave-path-alist)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3499 (defun idlwave-locate-lib-file (file)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3500 ;; Find FILE on the scanned lib path and return a buffer visiting it
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3501 (let* ((dirs idlwave-path-alist)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3502 dir efile)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3503 (catch 'exit
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3504 (while (setq dir (car (pop dirs)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3505 (if (file-regular-p
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3506 (setq efile (expand-file-name file dir)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3507 (throw 'exit efile))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3508 (defun idlwave-expand-lib-file-name (file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3509 ;; Find FILE on the scanned lib path and return a buffer visiting it
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3510 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3511 ((null file) nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3512 ((string-match "\\`\\({\\([0-9]+\\)}/\\)\\(.*\\)" file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3513 (expand-file-name (match-string 3 file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3514 (car (nth (1- (string-to-int (match-string 2 file)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3515 idlwave-path-alist))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3516 ((file-name-absolute-p file) file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3517 (t (idlwave-locate-lib-file file))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3518
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3519 (defun idlwave-make-tags ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3520 "Creates the IDL tags file IDLTAGS in the current directory from
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3521 the list of directories specified in the minibuffer. Directories may be
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3522 for example: . /usr/local/rsi/idl/lib. All the subdirectories of the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3523 specified top directories are searched if the directory name is prefixed
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3524 by @. Specify @ directories with care, it may take a long, long time if
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3525 you specify /."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3526 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3527 (let (directory directories cmd append status numdirs dir getsubdirs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3528 buffer save_buffer files numfiles item errbuf)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3529
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3530 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3531 ;; Read list of directories
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3532 (setq directory (read-string "Tag Directories: " "."))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3533 (setq directories (idlwave-split-string directory "[ \t]+"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3534 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3535 ;; Set etags command, vars
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3536 (setq cmd "etags --output=IDLTAGS --language=none --regex='/[
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3537 \\t]*[pP][Rr][Oo][ \\t]+\\([^ \\t,]+\\)/' --regex='/[
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3538 \\t]*[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn][ \\t]+\\([^ \\t,]+\\)/' ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3539 (setq append " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3540 (setq status 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3541 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3542 ;; For each directory
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3543 (setq numdirs 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3544 (setq dir (nth numdirs directories))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3545 (while (and dir)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3546 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3547 ;; Find the subdirectories
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3548 (if (string-match "^[@]\\(.+\\)$" dir)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3549 (setq getsubdirs t) (setq getsubdirs nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3550 (if (and getsubdirs) (setq dir (substring dir 1 (length dir))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3551 (setq dir (expand-file-name dir))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3552 (if (file-directory-p dir)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3553 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3554 (if (and getsubdirs)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3555 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3556 (setq buffer (get-buffer-create "*idltags*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3557 (call-process "sh" nil buffer nil "-c"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3558 (concat "find " dir " -type d -print"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3559 (setq save_buffer (current-buffer))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3560 (set-buffer buffer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3561 (setq files (idlwave-split-string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3562 (idlwave-replace-string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3563 (buffer-substring 1 (point-max))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3564 "\n" "/*.pro ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3565 "[ \t]+"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3566 (set-buffer save_buffer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3567 (kill-buffer buffer))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3568 (setq files (list (concat dir "/*.pro"))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3569 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3570 ;; For each subdirectory
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3571 (setq numfiles 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3572 (setq item (nth numfiles files))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3573 (while (and item)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3574 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3575 ;; Call etags
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3576 (if (not (string-match "^[ \\t]*$" item))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3577 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3578 (message (concat "Tagging " item "..."))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3579 (setq errbuf (get-buffer-create "*idltags-error*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3580 (setq status (+ status
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3581 (call-process "sh" nil errbuf nil "-c"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3582 (concat cmd append item))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3583 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3584 ;; Append additional tags
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3585 (setq append " --append ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3586 (setq numfiles (1+ numfiles))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3587 (setq item (nth numfiles files)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3588 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3589 (setq numfiles (1+ numfiles))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3590 (setq item (nth numfiles files))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3591 )))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3592
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3593 (setq numdirs (1+ numdirs))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3594 (setq dir (nth numdirs directories)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3595 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3596 (setq numdirs (1+ numdirs))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3597 (setq dir (nth numdirs directories)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3598
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3599 (setq errbuf (get-buffer-create "*idltags-error*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3600 (if (= status 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3601 (kill-buffer errbuf))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3602 (message "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3603 ))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3604
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3605 (defun idlwave-toggle-comment-region (beg end &optional n)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3606 "Comment the lines in the region if the first non-blank line is
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3607 commented, and conversely, uncomment region. If optional prefix arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3608 N is non-nil, then for N positive, add N comment delimiters or for N
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3609 negative, remove N comment delimiters.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3610 Uses `comment-region' which does not place comment delimiters on
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3611 blank lines."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3612 (interactive "r\nP")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3613 (if n
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3614 (comment-region beg end (prefix-numeric-value n))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3615 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3616 (goto-char beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3617 (beginning-of-line)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3618 ;; skip blank lines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3619 (skip-chars-forward " \t\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3620 (if (looking-at (concat "[ \t]*\\(" comment-start "+\\)"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3621 (comment-region beg end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3622 (- (length (buffer-substring
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3623 (match-beginning 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3624 (match-end 1)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3625 (comment-region beg end)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3626
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3627
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3628 ;; ----------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3629 ;; ----------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3630 ;; ----------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3631 ;; ----------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3632 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3633 ;; Completion and Routine Info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3634 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3635
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3636 ;; String "intern" functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3637
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3638 ;; For the completion and routine info function, we want to normalize
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3639 ;; the case of procedure names etc. We do this by "interning" these
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3640 ;; string is a hand-crafted way. Hashes are used to map the downcase
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3641 ;; version of the strings to the cased versions. Since these cased
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3642 ;; versions are really lisp objects, we can use `eq' to search, which
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3643 ;; is a large performance boost.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3644 ;; All new strings need to be "sinterned". We do this as early as
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3645 ;; possible after getting these strings from completion or buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3646 ;; substrings. So most of the code can simply assume to deal with
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3647 ;; "sinterned" strings. The only exception is that the functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3648 ;; which scan whole buffers for routine information do not intern the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3649 ;; grabbed strings. This is only done afterwards. Therefore in these
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3650 ;; functions it is *not* save to assume the strings can be compared
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3651 ;; with `eq' and be fed into the routine assq functions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3652
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3653 ;; Here we define the hashing functions.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3654
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3655 ;; The variables which hold the hashes.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3656 (defvar idlwave-sint-routines '(nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3657 (defvar idlwave-sint-keywords '(nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3658 (defvar idlwave-sint-methods '(nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3659 (defvar idlwave-sint-classes '(nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3660 (defvar idlwave-sint-files '(nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3661
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3662 (defun idlwave-reset-sintern (&optional what)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3663 "Reset all sintern hashes."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3664 ;; Make sure the hash functions are accessible.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3665 (if (or (not (fboundp 'gethash))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3666 (not (fboundp 'puthash)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3667 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3668 (require 'cl)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3669 (or (fboundp 'puthash)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3670 (defalias 'puthash 'cl-puthash))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3671 (let ((entries '((idlwave-sint-routines 1000 10)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3672 (idlwave-sint-keywords 1000 10)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3673 (idlwave-sint-methods 100 10)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3674 (idlwave-sint-classes 10 10))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3675
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3676 ;; Make sure these are lists
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3677 (loop for entry in entries
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3678 for var = (car entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3679 do (if (not (consp (symbol-value var))) (set var (list nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3680
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3681 (when (or (eq what t) (eq what 'syslib)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3682 (null (cdr idlwave-sint-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3683 ;; Reset the system & library hash
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3684 (loop for entry in entries
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3685 for var = (car entry) for size = (nth 1 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3686 do (setcdr (symbol-value var)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3687 (make-hash-table ':size size ':test 'equal)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3688 (setq idlwave-sint-files nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3689
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3690 (when (or (eq what t) (eq what 'bufsh)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3691 (null (car idlwave-sint-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3692 ;; Reset the buffer & shell hash
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3693 (loop for entry in entries
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3694 for var = (car entry) for size = (nth 1 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3695 do (setcar (symbol-value var)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3696 (make-hash-table ':size size ':test 'equal))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3697
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3698 (defun idlwave-sintern-routine-or-method (name &optional class set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3699 (if class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3700 (idlwave-sintern-method name set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3701 (idlwave-sintern-routine name set)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3702
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3703 (defun idlwave-sintern (stype &rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3704 (apply (intern (concat "idlwave-sintern-" (symbol-name stype))) args))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3705
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3706 ;;(defmacro idlwave-sintern (type var)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3707 ;; `(cond ((not (stringp name)) name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3708 ;; ((gethash (downcase name) (cdr ,var)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3709 ;; ((gethash (downcase name) (car ,var)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3710 ;; (set (idlwave-sintern-set name ,type ,var set))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3711 ;; (name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3712
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3713 (defun idlwave-sintern-routine (name &optional set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3714 (cond ((not (stringp name)) name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3715 ((gethash (downcase name) (cdr idlwave-sint-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3716 ((gethash (downcase name) (car idlwave-sint-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3717 (set (idlwave-sintern-set name 'routine idlwave-sint-routines set))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3718 (name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3719 (defun idlwave-sintern-keyword (name &optional set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3720 (cond ((not (stringp name)) name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3721 ((gethash (downcase name) (cdr idlwave-sint-keywords)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3722 ((gethash (downcase name) (car idlwave-sint-keywords)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3723 (set (idlwave-sintern-set name 'keyword idlwave-sint-keywords set))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3724 (name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3725 (defun idlwave-sintern-method (name &optional set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3726 (cond ((not (stringp name)) name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3727 ((gethash (downcase name) (cdr idlwave-sint-methods)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3728 ((gethash (downcase name) (car idlwave-sint-methods)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3729 (set (idlwave-sintern-set name 'method idlwave-sint-methods set))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3730 (name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3731 (defun idlwave-sintern-class (name &optional set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3732 (cond ((not (stringp name)) name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3733 ((gethash (downcase name) (cdr idlwave-sint-classes)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3734 ((gethash (downcase name) (car idlwave-sint-classes)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3735 (set (idlwave-sintern-set name 'class idlwave-sint-classes set))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3736 (name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3737
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3738 (defun idlwave-sintern-file (name &optional set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3739 (car (or (member name idlwave-sint-files)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3740 (setq idlwave-sint-files (cons name idlwave-sint-files)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3741
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3742 (defun idlwave-sintern-set (name type tables set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3743 (let* ((func (or (cdr (assq type idlwave-completion-case))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3744 'identity))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3745 (iname (funcall (if (eq func 'preserve) 'identity func) name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3746 (table (if (eq set 'sys) (cdr tables) (car tables))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3747 (puthash (downcase name) iname table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3748 iname))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3749
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3750 (defun idlwave-sintern-rinfo-list (list &optional set)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3751 "Sintern all strings in the rinfo LIST. With optional parameter SET:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3752 also set new patterns. Probably this will always have to be t."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3753 (let (entry name type class kwds res source call olh new)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3754 (while list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3755 (setq entry (car list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3756 list (cdr list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3757 name (car entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3758 type (nth 1 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3759 class (nth 2 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3760 source (nth 3 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3761 call (nth 4 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3762 kwds (nth 5 entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3763 olh (nth 6 entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3764 (setq kwds (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3765 (list (idlwave-sintern-keyword (car x) set)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3766 kwds))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3767 (if class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3768 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3769 (if (symbolp class) (setq class (symbol-name class)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3770 (setq class (idlwave-sintern-class class set))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3771 (setq name (idlwave-sintern-method name set)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3772 (setq name (idlwave-sintern-routine name set)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3773 (if (stringp (cdr source))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3774 (setcdr source (idlwave-sintern-file (cdr source) t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3775 (setq new (if olh
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3776 (list name type class source call kwds olh)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3777 (list name type class source call kwds)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3778 (setq res (cons new res)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3779 (nreverse res)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3780
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3781 ;;---------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3782
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3783
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3784 ;; The variables which hold the information
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3785 (defvar idlwave-system-routines nil
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3786 "Holds the routine-info obtained by scanning buffers.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3787 (defvar idlwave-buffer-routines nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3788 "Holds the routine-info obtained by scanning buffers.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3789 (defvar idlwave-compiled-routines nil
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3790 "Holds the routine-info obtained by asking the shell.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3791 (defvar idlwave-unresolved-routines nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3792 "Holds the unresolved routine-info obtained by asking the shell.")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3793 (defvar idlwave-library-routines nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3794 "Holds the procedure routine-info from the library scan.")
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3795 (defvar idlwave-path-alist nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3796 "Alist with !PATH directories and a flag if the dir has been scanned.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3797 (defvar idlwave-true-path-alist nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3798 "Like `idlwave-path-alist', but with true filenames.")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3799 (defvar idlwave-routines nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3800 "Holds the combinded procedure routine-info.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3801 (defvar idlwave-class-alist nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3802 "Holds the class names known to IDLWAVE.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3803 (defvar idlwave-class-history nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3804 "The history of classes selected with the minibuffer.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3805 (defvar idlwave-force-class-query nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3806 (defvar idlwave-before-completion-wconf nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3807 "The window configuration just before the completion buffer was displayed.")
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3808 (defvar idlwave-last-system-routine-info-cons-cell nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3809 "The last cons cell in the system routine info.")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3810
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3811 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3812 ;; The code to get routine info from different sources.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3813
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3814 (defvar idlwave-system-routines)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3815 (defun idlwave-routines ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3816 "Provide a list of IDL routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3817 This routine loads the builtin routines on the first call. Later it
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3818 only returns the value of the variable."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3819 (or idlwave-routines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3820 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3821 (idlwave-update-routine-info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3822 ;; return the current value
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3823 idlwave-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3824
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3825 (defun idlwave-update-routine-info (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3826 "Update the internal routine-info lists.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3827 These lists are used by `idlwave-routine-info' (\\[idlwave-routine-info])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3828 and by `idlwave-complete' (\\[idlwave-complete]) to provide information
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3829 about individual routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3830
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3831 The information can come from 4 sources:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3832 1. IDL programs in the current editing session
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3833 2. Compiled modules in an IDL shell running as Emacs subprocess
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3834 3. A list which covers the IDL system routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3835 4. A list which covers the prescanned library files.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3836
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3837 Scans all IDLWAVE-mode buffers of the current editing session (see
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3838 `idlwave-scan-all-buffers-for-routine-info').
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3839 When an IDL shell is running, this command also queries the IDL program
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3840 for currently compiled routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3841
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3842 With prefix ARG, also reload the system and library lists.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3843 With two prefix ARG's, also rescans the library tree."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3844 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3845 (if (equal arg '(16))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3846 (idlwave-create-libinfo-file t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3847 (let* ((reload (or arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3848 idlwave-buffer-case-takes-precedence
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3849 (null idlwave-system-routines))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3850
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3851 (setq idlwave-buffer-routines nil
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3852 idlwave-compiled-routines nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3853 idlwave-unresolved-routines nil)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3854 ;; Reset the appropriate hashes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3855 (idlwave-reset-sintern (cond (reload t)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3856 ((null idlwave-system-routines) t)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3857 (t 'bufsh)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3858
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3859 (if idlwave-buffer-case-takes-precedence
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3860 ;; We can safely scan the buffer stuff first
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3861 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3862 (idlwave-update-buffer-routine-info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3863 (and reload (idlwave-load-system-rinfo)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3864 ;; We first do the system info, and then the buffers
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3865 (and reload (idlwave-load-system-rinfo))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3866 (idlwave-update-buffer-routine-info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3867
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3868 ;; Let's see if there is a shell
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3869 (let* ((shell-is-running (and (fboundp 'idlwave-shell-is-running)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3870 (idlwave-shell-is-running)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3871 (ask-shell (and shell-is-running
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3872 idlwave-query-shell-for-routine-info)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3873
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3874 (if (or (not ask-shell)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3875 (not (interactive-p)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3876 ;; 1. If we are not going to ask the shell, we need to do the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3877 ;; concatenation now.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3878 ;; 2. When this function is called non-interactively, it means
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3879 ;; that someone needs routine info *now*. The shell update
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3880 ;; causes the concatenation *delayed*, so not in time for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3881 ;; the current command. Therefore, we do a concatenation
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3882 ;; now, even though the shell might do it again.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3883 (idlwave-concatenate-rinfo-lists))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3884
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3885 (when ask-shell
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3886 ;; Ask the shell about the routines it knows.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3887 (message "Querying the shell")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3888 (idlwave-shell-update-routine-info))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3889
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3890 (defun idlwave-load-system-rinfo ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3891 ;; Load and case-treat the system and lib info files.
27185
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
3892 (load "idlw-rinfo" t)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3893 (message "Normalizing idlwave-system-routines...")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3894 (setq idlwave-system-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3895 (idlwave-sintern-rinfo-list idlwave-system-routines 'sys))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3896 (message "Normalizing idlwave-system-routines...done")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3897 (setq idlwave-routines (copy-sequence idlwave-system-routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3898 (setq idlwave-last-system-routine-info-cons-cell
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3899 (nthcdr (1- (length idlwave-routines)) idlwave-routines))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3900 (when (and (stringp idlwave-libinfo-file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3901 (file-regular-p idlwave-libinfo-file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3902 (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3903 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3904 (load-file idlwave-libinfo-file)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3905 (setq idlwave-true-path-alist nil)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3906 (message "Normalizing idlwave-library-routines...")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3907 (setq idlwave-library-routines (idlwave-sintern-rinfo-list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3908 idlwave-library-routines 'sys))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3909 (message "Normalizing idlwave-library-routines...done"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3910 (error nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3911
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3912 (defun idlwave-update-buffer-routine-info ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3913 (let (res)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3914 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3915 ((eq idlwave-scan-all-buffers-for-routine-info t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3916 ;; Scan all buffers, current buffer last
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3917 (message "Scanning all buffers...")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3918 (setq res (idlwave-get-routine-info-from-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3919 (reverse (buffer-list)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3920 ((null idlwave-scan-all-buffers-for-routine-info)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3921 ;; Don't scan any buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3922 (setq res nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3923 (t
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3924 ;; Just scan this buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3925 (if (eq major-mode 'idlwave-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3926 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3927 (message "Scanning current buffer...")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3928 (setq res (idlwave-get-routine-info-from-buffers
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3929 (list (current-buffer))))))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3930 ;; Put the result into the correct variable
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3931 (setq idlwave-buffer-routines
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3932 (idlwave-sintern-rinfo-list res t))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3933
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3934 (defun idlwave-concatenate-rinfo-lists (&optional quiet)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3935 "Put the different sources for routine information together."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3936 ;; The sequence here is important because earlier definitions shadow
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3937 ;; later ones. We assume that if things in the buffers are newer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3938 ;; then in the shell of the system, it is meant to be different.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3939
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3940 (setcdr idlwave-last-system-routine-info-cons-cell
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3941 (append idlwave-buffer-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3942 idlwave-compiled-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3943 idlwave-library-routines))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3944 (setq idlwave-class-alist nil)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3945
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3946 ;; Give a message with information about the number of routines we have.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3947 (unless quiet
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3948 (message
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3949 "Routine info updated: buffer(%d) compiled(%d) catalog(%d) system(%d)"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3950 (length idlwave-buffer-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3951 (length idlwave-compiled-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3952 (length idlwave-library-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3953 (length idlwave-system-routines))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3954
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3955 (defun idlwave-class-alist ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3956 "Return the class alist - make it if necessary."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3957 (or idlwave-class-alist
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3958 (let (class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3959 (loop for x in idlwave-routines do
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3960 (when (and (setq class (nth 2 x))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3961 (not (assq class idlwave-class-alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3962 (push (list class) idlwave-class-alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3963 idlwave-class-alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3964
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3965 ;; Three functions for the hooks
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3966 (defun idlwave-save-buffer-update ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3967 (idlwave-update-current-buffer-info 'save-buffer))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3968 (defun idlwave-kill-buffer-update ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3969 (idlwave-update-current-buffer-info 'kill-buffer))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3970 (defun idlwave-new-buffer-update ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3971 (idlwave-update-current-buffer-info 'find-file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3972
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3973 (defun idlwave-update-current-buffer-info (why)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3974 "Undate idlwave-routines for current buffer. Can run from after-save-hook."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3975 (when (and (eq major-mode 'idlwave-mode)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3976 (or (eq t idlwave-auto-routine-info-updates)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3977 (memq why idlwave-auto-routine-info-updates))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3978 idlwave-scan-all-buffers-for-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3979 idlwave-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3980 (condition-case nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3981 (let (routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3982 (idlwave-replace-buffer-routine-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3983 (buffer-file-name)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3984 (if (eq why 'kill-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3985 nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3986 (setq routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3987 (idlwave-sintern-rinfo-list
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3988 (idlwave-get-routine-info-from-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3989 (list (current-buffer))) 'set))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3990 (idlwave-concatenate-rinfo-lists 'quiet)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3991 routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3992 (error nil))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3993
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3994 (defun idlwave-replace-buffer-routine-info (file new)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3995 "Cut the part from FILE out of `idlwave-buffer-routines' and add NEW."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3996 (let ((list idlwave-buffer-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3997 found)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3998 (while list
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
3999 ;; The following test uses eq to make sure it works correctly
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4000 ;; when two buffers visit the same file. Then the file names
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4001 ;; will be equal, but not eq.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4002 (if (eq (cdr (nth 3 (car list))) file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4003 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4004 (setcar list nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4005 (setq found t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4006 (if found
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4007 ;; End of that section reached. Jump.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4008 (setq list nil)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4009 (setq list (cdr list)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4010 (setq idlwave-buffer-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4011 (append new (delq nil idlwave-buffer-routines)))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4012
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4013 ;;----- Scanning buffers -------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4014
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4015 (defun idlwave-get-routine-info-from-buffers (buffers)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4016 "Call `idlwave-get-buffer-routine-info' on idlwave-mode buffers in BUFFERS."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4017 (let (buf routine-lists res)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4018 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4019 (while (setq buf (pop buffers))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4020 (set-buffer buf)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4021 (if (eq major-mode 'idlwave-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4022 ;; yes, this buffer has the right mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4023 (progn (setq res (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4024 (idlwave-get-buffer-routine-info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4025 (error nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4026 (push res routine-lists)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4027 ;; Concatenate the individual lists and return the result
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4028 (apply 'nconc routine-lists)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4029
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4030 (defun idlwave-get-buffer-routine-info ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4031 "Scan the current buffer for routine info. Return (PRO-LIST FUNC-LIST)."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4032 (let* ((case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4033 routine-list string entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4034 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4035 (save-restriction
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4036 (widen)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4037 (goto-char (point-min))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4038 (while (re-search-forward
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4039 "^[ \t]*\\(pro\\|function\\)[ \t]" nil t)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4040 (setq string (buffer-substring
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4041 (match-beginning 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4042 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4043 (idlwave-end-of-statement)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4044 (point))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4045 (setq entry (idlwave-parse-definition string))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4046 (push entry routine-list))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4047 routine-list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4048
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4049 (defvar idlwave-scanning-lib-dir)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4050 (defun idlwave-parse-definition (string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4051 "Parse a module definition."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4052 (let ((case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4053 start name args type keywords class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4054 ;; Remove comments
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4055 (while (string-match ";.*" string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4056 (setq string (replace-match "" t t string)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4057 ;; Remove the continuation line stuff
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4058 (while (string-match "\\([^a-zA-Z0-9$_]\\)\\$[ \t]*\n" string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4059 (setq string (replace-match "\\1 " t nil string)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4060 ;; Match the name and type.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4061 (when (string-match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4062 "\\<\\(pro\\|function\\)\\>\\s-+\\(\\([a-zA-Z0-9$_]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)" string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4063 (setq start (match-end 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4064 (setq type (downcase (match-string 1 string)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4065 (if (match-beginning 3)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4066 (setq class (match-string 3 string)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4067 (setq name (match-string 4 string)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4068 ;; Match normal args and keyword args
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4069 (while (string-match
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4070 ",\\s-*\\([a-zA-Z][a-zA-Z0-9$_]*\\|\\(_ref\\)?_extra\\)\\s-*\\(=\\)?"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4071 string start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4072 (setq start (match-end 0))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4073 (if (match-beginning 3)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4074 (push (match-string 1 string) keywords)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4075 (push (match-string 1 string) args)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4076 ;; Normalize and sort.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4077 (setq args (nreverse args))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4078 (setq keywords (sort keywords (lambda (a b)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4079 (string< (downcase a) (downcase b)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4080 ;; Make and return the entry
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4081 ;; We don't know which argument are optional, so this information
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4082 ;; will not be contained in the calling sequence.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4083 (list name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4084 (if (equal type "pro") 'pro 'fun)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4085 class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4086 (cond ((not (boundp 'idlwave-scanning-lib))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4087 (cons 'buffer (buffer-file-name)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4088 ; ((string= (downcase
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4089 ; (file-name-sans-extension
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4090 ; (file-name-nondirectory (buffer-file-name))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4091 ; (downcase name))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4092 ; (list 'lib))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4093 ; (t (cons 'lib (file-name-nondirectory (buffer-file-name))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4094 (t (cons 'lib (concat idlwave-scanning-lib-dir
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4095 (file-name-nondirectory (buffer-file-name))))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4096 (concat
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4097 (if (string= type "function") "Result = " "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4098 (if class "Obj ->[%s::]" "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4099 "%s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4100 (if args
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4101 (concat
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4102 (if (string= type "function") "(" ", ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4103 (mapconcat 'identity args ", ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4104 (if (string= type "function") ")" ""))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4105 (if keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4106 (mapcar 'list keywords)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4107 nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4108
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4109 ;;----- Scanning the library -------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4110
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4111 (defvar idlwave-sys-dir nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4112 "Internal variable.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4113
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4114 (defun idlwave-sys-dir ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4115 "Return the syslib directory, or a dummy that never matches."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4116 (or idlwave-sys-dir
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4117 "@@@@@@@@"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4118
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4119 (defvar idlwave-shell-path-query)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4120 (defun idlwave-create-libinfo-file (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4121 "Scan all files on selected dirs of IDL search path for routine information.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4122 A widget checklist will allow you to choose the directories.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4123 Write the result as a file `idlwave-libinfo-file'. When this file exists,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4124 will be automatically loaded to give routine information about library
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4125 routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4126 With ARG, just rescan the same directories as last time - so no widget
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4127 will pop up."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4128 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4129 ;; Make sure the file is loaded if it exists.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4130 (if (and (stringp idlwave-libinfo-file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4131 (file-regular-p idlwave-libinfo-file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4132 (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4133 (load-file idlwave-libinfo-file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4134 (error nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4135 ;; Make sure the file name makes sense
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4136 (unless (and (stringp idlwave-libinfo-file)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4137 (> (length idlwave-libinfo-file) 0)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4138 (file-accessible-directory-p
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4139 (file-name-directory idlwave-libinfo-file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4140 (not (string= "" (file-name-nondirectory
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4141 idlwave-libinfo-file))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4142 (error "`idlwave-libinfo-file' does not point to file in accessible directory."))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4143
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4144 (cond
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4145 ((and arg idlwave-path-alist
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4146 (consp (car idlwave-path-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4147 idlwave-sys-dir)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4148 ;; Rescan the known directories
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4149 (idlwave-scan-lib-files
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4150 idlwave-sys-dir
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4151 idlwave-path-alist))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4152 (idlwave-library-path
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4153 ;; Get the directories from that variable
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4154 (idlwave-display-libinfo-widget
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4155 idlwave-system-directory
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4156 (idlwave-expand-path idlwave-library-path)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4157 (delq nil (mapcar (lambda (x) (if (consp x) (if (cdr x) (car x) nil) x))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4158 idlwave-path-alist))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4159 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4160 ;; Ask the shell for the path and run the widget
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4161 (message "Asking the shell for IDL path...")
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4162 (require 'idlw-shell)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4163 (idlwave-shell-send-command idlwave-shell-path-query
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4164 '(idlwave-libinfo-command-hook nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4165 'hide))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4166
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4167 (defun idlwave-libinfo-command-hook (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4168 ;; Command hook used by `idlwave-create-libinfo-file'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4169 (if arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4170 ;; Scan immediately
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4171 (idlwave-scan-lib-files
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4172 idlwave-sys-dir
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4173 idlwave-path-alist)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4174 ;; Display the widget
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4175 (let* ((rpl (idlwave-shell-path-filter))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4176 (sysdir (car rpl))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4177 (dirs (cdr rpl)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4178 (idlwave-display-libinfo-widget
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4179 sysdir dirs
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4180 (delq nil (mapcar (lambda (x) (if (cdr x) (car x) nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4181 idlwave-path-alist))))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4182
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4183 (defconst idlwave-libinfo-widget-help-string
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4184 "This is the front-end to the creation of IDLWAVE library catalog.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4185 Please select below the directories on IDL's search path from which you
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4186 would like to extract routine information, which will be stored in the file
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4187
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4188 %s
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4189
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4190 If this is not the correct file, first set variable `idlwave-libinfo-file'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4191 Then call this command again.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4192
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4193 For writing code, you need to include the directories which contain the
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4194 routines you use. If IDLWAVE should be able to analyse routine shadowing
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4195 it is best to scan all directories.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4196
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4197 After selecting the directories, choose [Scan & Save] to scan the library
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4198 directories and save the routine info.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4199 \n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4200
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4201 (defvar idlwave-widget)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4202 (defvar widget-keymap)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4203 (defun idlwave-display-libinfo-widget (sysdir dirs selected-dirs)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4204 "Create the widget to select IDL search path directories for scanning."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4205 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4206 (require 'widget)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4207 (require 'wid-edit)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4208 (unless dirs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4209 (error "Don't know IDL's search path"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4210
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4211 ;; Allow only those directories to be selected which are in the path.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4212 (setq selected-dirs (delq nil (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4213 (if (member x dirs) x nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4214 selected-dirs)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4215 (kill-buffer (get-buffer-create "*IDLWAVE Widget*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4216 (switch-to-buffer (get-buffer-create "*IDLWAVE Widget*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4217 (kill-all-local-variables)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4218 (make-local-variable 'idlwave-widget)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4219 (widget-insert (format idlwave-libinfo-widget-help-string
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4220 idlwave-libinfo-file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4221
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4222 (widget-create 'push-button
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4223 :notify 'idlwave-widget-scan-lib-files
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4224 "Scan & Save")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4225 (widget-insert " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4226 (widget-create 'push-button
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4227 :notify (lambda (&rest ignore)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4228 (kill-buffer (current-buffer)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4229 "Quit")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4230 (widget-insert " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4231 (widget-create 'push-button
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4232 :notify 'idlwave-delete-libinfo-file
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4233 "Delete File")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4234 (widget-insert " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4235 (widget-create 'push-button
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4236 :notify '(lambda (&rest ignore)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4237 (idlwave-display-libinfo-widget
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4238 (widget-get idlwave-widget :sysdir)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4239 (widget-get idlwave-widget :path-dirs)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4240 (widget-get idlwave-widget :path-dirs)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4241 "Select All")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4242 (widget-insert " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4243 (widget-create 'push-button
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4244 :notify '(lambda (&rest ignore)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4245 (idlwave-display-libinfo-widget
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4246 (widget-get idlwave-widget :sysdir)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4247 (widget-get idlwave-widget :path-dirs)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4248 nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4249 "Deselect All")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4250 (widget-insert "\n\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4251
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4252 (widget-insert "Select Directories\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4253
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4254 (setq idlwave-widget
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4255 (apply 'widget-create
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4256 'checklist
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4257 :value selected-dirs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4258 :greedy t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4259 :tag "List of directories"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4260 (mapcar (lambda (x) (list 'item x)) dirs)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4261 (widget-put idlwave-widget :path-dirs dirs)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4262 (widget-put idlwave-widget :sysdir sysdir)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4263 (widget-insert "\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4264 (use-local-map widget-keymap)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4265 (widget-setup)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4266 (goto-char (point-min))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4267 (delete-other-windows))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4268
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4269 (defun idlwave-delete-libinfo-file (&rest ignore)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4270 (if (yes-or-no-p
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4271 (format "Delete file %s " idlwave-libinfo-file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4272 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4273 (delete-file idlwave-libinfo-file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4274 (message "%s has been deleted" idlwave-libinfo-file))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4275
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4276 (defun idlwave-widget-scan-lib-files (&rest ignore)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4277 ;; Call `idlwave-scan-lib-files' with data taken from the widget.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4278 (let* ((widget idlwave-widget)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4279 (selected-dirs (widget-value widget))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4280 (sysdir (widget-get widget :sysdir))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4281 (path-dirs (widget-get widget :path-dirs))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4282 (path-dir-alist
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4283 (mapcar (lambda (x) (cons x (if (member x selected-dirs) t nil)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4284 path-dirs)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4285 (idlwave-scan-lib-files sysdir path-dir-alist)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4286
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4287 (defvar font-lock-mode)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4288 (defun idlwave-scan-lib-files (sysdir path-alist)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4289 ;; Scan the files in PATH-ALIST and store the info in a file
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4290 (let* ((idlwave-scanning-lib t)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4291 (idlwave-scanning-lib-dir "")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4292 (dircnt (1+ (length path-alist)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4293 (idlwave-completion-case nil)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4294 dirs-alist dir files file)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4295 (setq idlwave-library-routines nil)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4296 (setq idlwave-path-alist path-alist)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4297 (setq idlwave-true-path-alist nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4298 (setq idlwave-sys-dir sysdir)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4299 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4300 (set-buffer (get-buffer-create "*idlwave-scan.pro*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4301 (idlwave-mode)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4302 (setq dirs-alist (reverse path-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4303 (while (setq dir (pop dirs-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4304 (decf dircnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4305 (when (cdr dir)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4306 ;; Has the flag of scanned directories
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4307 (setq dir (car dir))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4308 (setq idlwave-scanning-lib-dir (format "{%d}/" dircnt))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4309 (when (file-directory-p dir)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4310 (setq files (directory-files dir 'full "\\.[pP][rR][oO]\\'"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4311 (while (setq file (pop files))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4312 (when (file-regular-p file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4313 (if (not (file-readable-p file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4314 (message "Skipping %s (no read permission)" file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4315 (message "Scanning %s..." file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4316 (erase-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4317 (insert-file-contents file 'visit)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4318 (setq idlwave-library-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4319 (append (idlwave-get-routine-info-from-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4320 (list (current-buffer)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4321 idlwave-library-routines)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4322 ))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4323 ;; Sorting is not necessary since we sort each time before a routine
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4324 ;; is used. So we don't do it here - the catalog file looks nicer
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4325 ;; when it is unsorted.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4326 ;;(message "Sorting...")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4327 ;;(setq idlwave-library-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4328 ;;(sort idlwave-library-routines 'idlwave-routine-entry-compare))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4329 ;;(message "Sorting...done")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4330 (message "Creating libinfo file...")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4331 (kill-buffer "*idlwave-scan.pro*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4332 (kill-buffer (get-buffer-create "*IDLWAVE Widget*"))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4333 (let ((font-lock-maximum-size 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4334 (auto-mode-alist nil))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4335 (find-file idlwave-libinfo-file))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4336 (if (and (boundp 'font-lock-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4337 font-lock-mode)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4338 (font-lock-mode 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4339 (erase-buffer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4340 (insert ";; IDLWAVE libinfo file\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4341 (insert (format ";; Created %s\n\n" (current-time-string)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4342
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4343 ;; Define the variable which knows the value of "!DIR"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4344 (insert (format "\n(setq idlwave-sys-dir \"%s\")\n"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4345 idlwave-sys-dir))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4346
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4347 ;; Define the variable which contains a list of all scanned directories
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4348 (insert "\n(setq idlwave-path-alist\n '(")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4349 (mapcar (lambda (x)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4350 (insert (format "\n (\"%s\" . %s)" (car x) (cdr x))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4351 path-alist)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4352 (insert "))\n")
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4353
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4354 ;; Define the routine info list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4355 (insert "\n(setq idlwave-library-routines\n '(")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4356 (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4357 (insert "\n ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4358 (insert (with-output-to-string (prin1 x))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4359 idlwave-library-routines)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4360 (insert (format "))\n\n;;; %s ends here\n"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4361 (file-name-nondirectory idlwave-libinfo-file)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4362 (goto-char (point-min))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4363 ;; Save the buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4364 (save-buffer 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4365 (kill-buffer (current-buffer)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4366 (message "Creating libinfo file...done")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4367 (message "Info for %d routines saved in %s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4368 (length idlwave-library-routines)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4369 idlwave-libinfo-file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4370 (sit-for 2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4371 (idlwave-update-routine-info t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4372
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4373 (defun idlwave-expand-path (path &optional default-dir)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4374 ;; Expand parts of path starting with '+' recursively into directory list.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4375 ;; Relative recursive path elements are expanded relative to DEFAULT-DIR.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4376 (message "Expanding path...")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4377 (let (path1 dir recursive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4378 (while (setq dir (pop path))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4379 (if (setq recursive (string= (substring dir 0 1) "+"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4380 (setq dir (substring dir 1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4381 (if (and recursive
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4382 (not (file-name-absolute-p dir)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4383 (setq dir (expand-file-name dir default-dir)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4384 (if recursive
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4385 ;; Expand recursively
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4386 (setq path1 (append (idlwave-recursive-directory-list dir) path1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4387 ;; Keep unchanged
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4388 (push dir path1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4389 (message "Expanding path...done")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4390 (nreverse path1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4391
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4392 (defun idlwave-recursive-directory-list (dir)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4393 ;; Return a list of all directories below DIR, including DIR itself
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4394 (let ((path (list dir)) path1 file files)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4395 (while (setq dir (pop path))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4396 (when (file-directory-p dir)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4397 (setq files (nreverse (directory-files dir t "[^.]")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4398 (while (setq file (pop files))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4399 (if (file-directory-p file)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4400 (push (file-name-as-directory file) path)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4401 (push dir path1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4402 path1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4403
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4404 ;;----- Asking the shell -------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4405
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4406 ;; First, here is the idl program which can be used to query IDL for
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4407 ;; defined routines.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4408 (defconst idlwave-routine-info.pro
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4409 "
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4410 pro idlwave_print_info_entry,name,func=func,separator=sep
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4411 ;; See if it's an object method
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4412 if name eq '' then return
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4413 func = keyword_set(func)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4414 methsep = strpos(name,'::')
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4415 meth = methsep ne -1
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4416
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4417 ;; Get routine info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4418 pars = routine_info(name,/parameters,functions=func)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4419 source = routine_info(name,/source,functions=func)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4420 nargs = pars.num_args
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4421 nkw = pars.num_kw_args
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4422 if nargs gt 0 then args = pars.args
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4423 if nkw gt 0 then kwargs = pars.kw_args
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4424
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4425 ;; Trim the class, and make the name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4426 if meth then begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4427 class = strmid(name,0,methsep)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4428 name = strmid(name,methsep+2,strlen(name)-1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4429 if nargs gt 0 then begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4430 ;; remove the self argument
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4431 wh = where(args ne 'SELF',nargs)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4432 if nargs gt 0 then args = args(wh)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4433 endif
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4434 endif else begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4435 ;; No class, just a normal routine.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4436 class = \"\"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4437 endelse
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4438
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4439 ;; Calling sequence
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4440 cs = \"\"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4441 if func then cs = 'Result = '
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4442 if meth then cs = cs + 'Obj -> [' + '%s' + '::]'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4443 cs = cs + '%s'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4444 if func then cs = cs + '(' else if nargs gt 0 then cs = cs + ', '
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4445 if nargs gt 0 then begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4446 for j=0,nargs-1 do begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4447 cs = cs + args(j)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4448 if j lt nargs-1 then cs = cs + ', '
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4449 endfor
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4450 end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4451 if func then cs = cs + ')'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4452 ;; Keyword arguments
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4453 kwstring = ''
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4454 if nkw gt 0 then begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4455 for j=0,nkw-1 do begin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4456 kwstring = kwstring + ' ' + kwargs(j)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4457 endfor
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4458 endif
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4459
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4460 ret=(['IDLWAVE-PRO','IDLWAVE-FUN'])(func)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4461
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4462 print,ret + ': ' + name + sep + class + sep + source(0).path $
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4463 + sep + cs + sep + kwstring
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4464 end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4465
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4466 pro idlwave_routine_info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4467 sep = '<@>'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4468 print,'>>>BEGIN OF IDLWAVE ROUTINE INFO (\"' + sep + '\" IS THE SEPARATOR)'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4469 all = routine_info()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4470 for i=0,n_elements(all)-1 do $
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4471 idlwave_print_info_entry,all(i),separator=sep
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4472 all = routine_info(/functions)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4473 for i=0,n_elements(all)-1 do $
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4474 idlwave_print_info_entry,all(i),/func,separator=sep
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4475 print,'>>>END OF IDLWAVE ROUTINE INFO'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4476 end
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4477 "
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4478 "The idl program to get the routine info stuff.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4479 The output of this program is parsed by `idlwave-shell-routine-info-filter'.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4480
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4481 (defvar idlwave-idlwave_routine_info-compiled nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4482 "Remembers if the routine info procedure is already compiled.")
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4483
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4484 (defvar idlwave-shell-temp-pro-file)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4485 (defvar idlwave-shell-temp-rinfo-save-file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4486 (defun idlwave-shell-update-routine-info (&optional quiet)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4487 "Query the shell for routine_info of compiled modules and update the lists."
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4488 ;; Save and compile the procedure. The compiled procedure is then
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4489 ;; saved into an IDL SAVE file, to allow for fast RESTORE.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4490 ;; We need to RESTORE the procedure each time we use it, since
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4491 ;; the user may have killed or redefined it. In particluar,
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4492 ;; .RESET_SESSION will kill all user procedures.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4493 (unless (and idlwave-idlwave_routine_info-compiled
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4494 (file-readable-p idlwave-shell-temp-rinfo-save-file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4495 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4496 (set-buffer (idlwave-find-file-noselect
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4497 idlwave-shell-temp-pro-file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4498 (erase-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4499 (insert idlwave-routine-info.pro)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4500 (save-buffer 0))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4501 (idlwave-shell-send-command
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4502 (concat ".run " idlwave-shell-temp-pro-file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4503 nil 'hide)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4504 (idlwave-shell-send-command
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4505 (format "save,'idlwave_routine_info','idlwave_print_info_entry',FILE='%s',/ROUTINES"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4506 idlwave-shell-temp-rinfo-save-file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4507 nil 'hide))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4508
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4509 ;; Restore and execute the procedure, analyze the output
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4510 (idlwave-shell-send-command
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4511 (format "RESTORE, '%s' & idlwave_routine_info"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4512 idlwave-shell-temp-rinfo-save-file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4513 `(progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4514 (idlwave-shell-routine-info-filter)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4515 (idlwave-concatenate-rinfo-lists ,quiet))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4516 'hide))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4517
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4518 ;; ---------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4519 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4520 ;; Completion and displaying routine calling sequences
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4521
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4522 (defvar idlwave-completion-help-info nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4523 (defvar idlwave-current-obj_new-class nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4524
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4525 (defun idlwave-complete (&optional arg module class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4526 "Complete a function, procedure or keyword name at point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4527 This function is smart and figures out what can be legally completed
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4528 at this point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4529 - At the beginning of a statement it completes procedure names.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4530 - In the middle of a statement it completes function names.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4531 - after a `(' or `,' in the argument list of a function or procedure,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4532 it completes a keyword of the relevant function or procedure.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4533 - In the first arg of `OBJ_NEW', it completes a class name.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4534
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4535 When several completions are possible, a list will be displayed in the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4536 *Completions* buffer. If this list is too long to fit into the
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4537 window, scrolling can be achieved by repeatedly pressing \\[idlwave-complete].
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4538
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4539 The function also knows about object methods. When it needs a class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4540 name, the action depends upon `idlwave-query-class', which see. You
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4541 can force IDLWAVE to ask you for a class name with a \\[universal-argument] prefix
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4542 argument to this command.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4543
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4544 See also the variables `idlwave-keyword-completion-adds-equal' and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4545 `idlwave-function-completion-adds-paren'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4546
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4547 The optional ARG can be used to specify the completion type in order
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4548 to override IDLWAVE's idea of what should be completed at point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4549 Possible values are:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4550
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4551 0 <=> query for the completion type
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4552 1 <=> 'procedure
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4553 2 <=> 'procedure-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4554 3 <=> 'function
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4555 4 <=> 'function-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4556 5 <=> 'procedure-method
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4557 6 <=> 'procedure-method-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4558 7 <=> 'function-method
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4559 8 <=> 'function-method-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4560 9 <=> 'class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4561
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4562 For Lisp programmers only:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4563 When we force a keyword, optional argument MODULE can contain the module name.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4564 When we force a method or a method keyword, CLASS can specify the class."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4565 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4566 (idlwave-routines)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4567 (let* ((where-list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4568 (if (and arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4569 (or (integerp arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4570 (symbolp arg)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4571 (idlwave-make-force-complete-where-list arg module class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4572 (idlwave-where)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4573 (what (nth 2 where-list))
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
4574 (idlwave-force-class-query (equal arg '(4))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4575
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4576 (if (and module (string-match "::" module))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4577 (setq class (substring module 0 (match-beginning 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4578 module (substring module (match-end 0))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4579
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4580 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4581
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4582 ((and (null arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4583 (eq (car-safe last-command) 'idlwave-display-completion-list)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
4584 (get-buffer-window "*Completions*"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4585 (setq this-command last-command)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4586 (idlwave-scroll-completions))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4587
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4588 ((null what)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4589 (error "Nothing to complete here"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4590
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4591 ((eq what 'class)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4592 (setq idlwave-completion-help-info '(class))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4593 (idlwave-complete-class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4594
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4595 ((eq what 'procedure)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4596 ;; Complete a procedure name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4597 (let* ((class-selector (idlwave-determine-class (nth 3 where-list) 'pro))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4598 (isa (concat "procedure" (if class-selector "-method" "")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4599 (type-selector 'pro))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4600 (setq idlwave-completion-help-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4601 (list 'routine nil type-selector class-selector))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4602 (idlwave-complete-in-buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4603 'procedure (if class-selector 'method 'routine)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4604 (idlwave-routines) 'idlwave-selector
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4605 (format "Select a %s name%s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4606 isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4607 (if class-selector
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4608 (format " (class is %s)" class-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4609 ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4610 isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4611 'idlwave-attach-method-classes)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4612
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4613 ((eq what 'function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4614 ;; Complete a function name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4615 (let* ((class-selector (idlwave-determine-class (nth 3 where-list) 'fun))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4616 (isa (concat "function" (if class-selector "-method" "")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4617 (type-selector 'fun))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4618 (setq idlwave-completion-help-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4619 (list 'routine nil type-selector class-selector))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4620 (idlwave-complete-in-buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4621 'function (if class-selector 'method 'routine)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4622 (idlwave-routines) 'idlwave-selector
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4623 (format "Select a %s name%s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4624 isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4625 (if class-selector
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4626 (format " (class is %s)" class-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4627 ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4628 isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4629 'idlwave-attach-method-classes)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4630
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4631 ((eq what 'procedure-keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4632 ;; Complete a procedure keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4633 (let* ((where (nth 3 where-list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4634 (name (car where))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4635 (method-selector name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4636 (type-selector 'pro)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4637 (class (idlwave-determine-class where 'pro))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4638 (class-selector class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4639 (isa (format "procedure%s-keyword" (if class "-method" "")))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4640 (entry (idlwave-best-rinfo-assq
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4641 name 'pro class (idlwave-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4642 (list (nth 5 entry)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4643 (unless (or entry (eq class t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4644 (error "Nothing known about procedure %s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4645 (idlwave-make-full-name class name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4646 (setq list (idlwave-fix-keywords name 'pro class list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4647 (unless list (error (format "No keywords available for procedure %s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4648 (idlwave-make-full-name class name))))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4649 (setq idlwave-completion-help-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4650 (list 'keyword name type-selector class-selector))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4651 (idlwave-complete-in-buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4652 'keyword 'keyword list nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4653 (format "Select keyword for procedure %s%s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4654 (idlwave-make-full-name class name)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4655 (if (or (member '("_EXTRA") list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4656 (member '("_REF_EXTRA") list))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4657 " (note _EXTRA)" ""))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4658 isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4659 'idlwave-attach-keyword-classes)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4660
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4661 ((eq what 'function-keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4662 ;; Complete a function keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4663 (let* ((where (nth 3 where-list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4664 (name (car where))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4665 (method-selector name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4666 (type-selector 'fun)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4667 (class (idlwave-determine-class where 'fun))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4668 (class-selector class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4669 (isa (format "function%s-keyword" (if class "-method" "")))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4670 (entry (idlwave-best-rinfo-assq
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4671 name 'fun class (idlwave-routines)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4672 (list (nth 5 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4673 msg-name)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4674 (unless (or entry (eq class t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4675 (error "Nothing known about function %s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4676 (idlwave-make-full-name class name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4677 (setq list (idlwave-fix-keywords name 'fun class list))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4678 ;; OBJ_NEW: Messages mention the proper Init method
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4679 (setq msg-name (if (and (null class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4680 (string= (upcase name) "OBJ_NEW"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4681 (concat idlwave-current-obj_new-class
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4682 "::Init (via OBJ_NEW)")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4683 (idlwave-make-full-name class name)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4684 (unless list (error (format "No keywords available for function %s"
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4685 msg-name)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4686 (setq idlwave-completion-help-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4687 (list 'keyword name type-selector class-selector))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4688 (idlwave-complete-in-buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4689 'keyword 'keyword list nil
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4690 (format "Select keyword for function %s%s" msg-name
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4691 (if (or (member '("_EXTRA") list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4692 (member '("_REF_EXTRA") list))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4693 " (note _EXTRA)" ""))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4694 isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4695 'idlwave-attach-keyword-classes)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4696
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4697 (t (error "This should not happen (idlwave-complete)")))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4698
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4699 (defun idlwave-make-force-complete-where-list (what &optional module class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4700 ;; Return an artificial WHERE specification to force the completion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4701 ;; routine to complete a specific item independent of context.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4702 ;; WHAT is the prefix arg of `idlwave-complete', see there for details.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4703 ;; MODULE and CLASS can be used to specify the routine name and class.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4704 ;; The class name will also be found in MODULE if that is like "class::mod".
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4705 (let* ((what-list '(("procedure") ("procedure-keyword")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4706 ("function") ("function-keyword")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4707 ("procedure-method") ("procedure-method-keyword")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4708 ("function-method") ("function-method-keyword")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4709 ("class")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4710 (module (idlwave-sintern-routine-or-method module class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4711 (class (idlwave-sintern-class class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4712 (what (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4713 ((equal what 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4714 (setq what
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4715 (intern (completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4716 "Complete what? " what-list nil t))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4717 ((integerp what)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4718 (setq what (intern (car (nth (1- what) what-list)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4719 ((and what
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4720 (symbolp what)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4721 (assoc (symbol-name what) what-list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4722 what)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4723 (t (error "Illegal WHAT"))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4724 (nil-list '(nil nil nil nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4725 (class-list (list nil nil (or class t) nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4726
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4727 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4728
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4729 ((eq what 'procedure)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4730 (list nil-list nil-list 'procedure nil-list nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4731
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4732 ((eq what 'procedure-keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4733 (let* ((class-selector nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4734 (type-selector 'pro)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4735 (pro (or module
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4736 (idlwave-completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4737 "Procedure: " (idlwave-routines) 'idlwave-selector))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4738 (setq pro (idlwave-sintern-routine pro))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4739 (list nil-list nil-list 'procedure-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4740 (list pro nil nil nil) nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4741
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4742 ((eq what 'function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4743 (list nil-list nil-list 'function nil-list nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4744
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4745 ((eq what 'function-keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4746 (let* ((class-selector nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4747 (type-selector 'fun)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4748 (func (or module
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4749 (idlwave-completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4750 "Function: " (idlwave-routines) 'idlwave-selector))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4751 (setq func (idlwave-sintern-routine func))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4752 (list nil-list nil-list 'function-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4753 (list func nil nil nil) nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4754
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4755 ((eq what 'procedure-method)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4756 (list nil-list nil-list 'procedure class-list nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4757
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4758 ((eq what 'procedure-method-keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4759 (let* ((class (idlwave-determine-class class-list 'pro))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4760 (class-selector class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4761 (type-selector 'pro)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4762 (pro (or module
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4763 (idlwave-completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4764 (format "Procedure in %s class: " class-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4765 (idlwave-routines) 'idlwave-selector))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4766 (setq pro (idlwave-sintern-method pro))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4767 (list nil-list nil-list 'procedure-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4768 (list pro nil class nil) nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4769
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4770 ((eq what 'function-method)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4771 (list nil-list nil-list 'function class-list nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4772
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4773 ((eq what 'function-method-keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4774 (let* ((class (idlwave-determine-class class-list 'fun))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4775 (class-selector class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4776 (type-selector 'fun)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4777 (func (or module
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4778 (idlwave-completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4779 (format "Function in %s class: " class-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4780 (idlwave-routines) 'idlwave-selector))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4781 (setq func (idlwave-sintern-method func))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4782 (list nil-list nil-list 'function-keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4783 (list func nil class nil) nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4784
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4785 ((eq what 'class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4786 (list nil-list nil-list 'class nil-list nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4787
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4788 (t (error "Illegal value for WHAT")))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4789
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4790 (defun idlwave-completing-read (&rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4791 ;; Completing read, case insensitive
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4792 (let ((old-value (default-value 'completion-ignore-case)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4793 (unwind-protect
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4794 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4795 (setq-default completion-ignore-case t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4796 (apply 'completing-read args))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4797 (setq-default completion-ignore-case old-value))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4798
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4799 (defun idlwave-make-full-name (class name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4800 ;; Make a fully qualified module name including the class name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4801 (concat (if class (format "%s::" class) "") name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4802
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4803 (defun idlwave-rinfo-assoc (name type class list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4804 "Like `idlwave-rinfo-assq', but sintern strings first."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4805 (idlwave-rinfo-assq
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4806 (idlwave-sintern-routine-or-method name class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4807 type (idlwave-sintern-class class) list))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4808
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4809 (defun idlwave-rinfo-assq (name type class list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4810 ;; Works like assq, but also checks type and class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4811 (catch 'exit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4812 (let (match)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4813 (while (setq match (assq name list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4814 (and (or (eq type t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4815 (eq (nth 1 match) type))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4816 (eq (nth 2 match) class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4817 (throw 'exit match))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4818 (setq list (cdr (memq match list)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4819
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4820 (defun idlwave-best-rinfo-assq (name type class list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4821 "Like `idlwave-rinfo-assq', but get all twins and sort, then return first."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4822 (let ((twins (idlwave-routine-twins
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4823 (idlwave-rinfo-assq name type class list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4824 list))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4825 syslibp)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4826 (when (> (length twins) 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4827 (setq twins (sort twins 'idlwave-routine-entry-compare-twins))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4828 (if (and (eq 'system (car (nth 3 (car twins))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4829 (setq syslibp (idlwave-any-syslib (cdr twins)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4830 (not (equal 1 syslibp)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4831 ;; Its a syslib, so we need to remove the system entry
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4832 (setq twins (cdr twins))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4833 (car twins)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4834
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4835 (defun idlwave-best-rinfo-assoc (name type class list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4836 "Like `idlwave-best-rinfo-assq', but sintern strings first."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4837 (idlwave-best-rinfo-assq
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4838 (idlwave-sintern-routine-or-method name class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4839 type (idlwave-sintern-class class) list))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4840
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4841 (defun idlwave-any-syslib (entries)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4842 "Does the entry list ENTRIES contain a syslib entry?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4843 If yes, return the index (>=1)."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4844 (let (file (cnt 0))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4845 (catch 'exit
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4846 (while entries
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4847 (incf cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4848 (setq file (cdr (nth 3 (car entries))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4849 (if (and file
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4850 (idlwave-syslib-p
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4851 (idlwave-expand-lib-file-name file)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4852 (throw 'exit cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4853 (setq entries (cdr entries))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4854 nil)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4855
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4856 (defun idlwave-all-assq (key list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4857 "Return a list of all associations of Key in LIST."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4858 (let (rtn elt)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4859 (while (setq elt (assq key list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4860 (push elt rtn)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4861 (setq list (cdr (memq elt list))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4862 (nreverse rtn)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4863
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4864 (defun idlwave-all-method-classes (method &optional type)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4865 "Return all classes which have a method METHOD. TYPE is 'fun or 'pro.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4866 When TYPE is not specified, both procedures and functions will be considered."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4867 (if (null method)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4868 (mapcar 'car (idlwave-class-alist))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4869 (let (rtn)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4870 (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4871 (and (nth 2 x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4872 (or (not type)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4873 (eq type (nth 1 x)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4874 (push (nth 2 x) rtn)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4875 (idlwave-all-assq method (idlwave-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4876 (idlwave-uniquify rtn))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4877
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4878 (defun idlwave-all-method-keyword-classes (method keyword &optional type)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4879 "Return all classes which have a method METHOD with keyword KEYWORD.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4880 TYPE is 'fun or 'pro.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4881 When TYPE is not specified, both procedures and functions will be considered."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4882 (if (or (null method)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4883 (null keyword))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4884 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4885 (let (rtn)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4886 (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4887 (and (nth 2 x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4888 (or (not type)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4889 (eq type (nth 1 x)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4890 (assoc keyword (nth 5 x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4891 (push (nth 2 x) rtn)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4892 (idlwave-all-assq method (idlwave-routines)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4893 (idlwave-uniquify rtn))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4894
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4895 (defun idlwave-determine-class (info type)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4896 ;; Determine the class of a routine call. INFO is the structure returned
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4897 ;; `idlwave-what-function' or `idlwave-what-procedure'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4898 ;; The third element in this structure is the class. When nil, we return nil.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4899 ;; When t, try to get the class from text properties at the arrow. When
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4900 ;; the object is "self", we use the class of the current routine.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4901 ;; otherwise prompt the user for a class name. Also stores the selected
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4902 ;; class as a text property at the arrow.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4903 ;; TYPE is 'fun or 'pro.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4904 (let* ((class (nth 2 info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4905 (apos (nth 3 info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4906 (nassoc (assoc (if (stringp (car info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4907 (upcase (car info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4908 (car info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4909 idlwave-query-class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4910 (dassoc (assq (if (car info) 'keyword-default 'method-default)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4911 idlwave-query-class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4912 (query (cond (nassoc (cdr nassoc))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4913 (dassoc (cdr dassoc))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4914 (t t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4915 (arrow (and apos (string= (buffer-substring apos (+ 2 apos)) "->")))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4916 (is-self
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4917 (and arrow
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4918 (save-excursion (goto-char apos)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4919 (forward-word -1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4920 (let ((case-fold-search t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4921 (looking-at "self\\>")))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4922 (force-query idlwave-force-class-query)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4923 store class-alist)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4924 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4925 ((null class) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4926 ((eq t class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4927 ;; There is an object which would like to know its class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4928 (if (and arrow (get-text-property apos 'idlwave-class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4929 idlwave-store-inquired-class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4930 (not force-query))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4931 (setq class (get-text-property apos 'idlwave-class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4932 class (idlwave-sintern-class class)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4933 (when (and (eq t class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4934 is-self)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4935 (setq class (or (nth 2 (idlwave-current-routine)) class)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4936 (when (and (eq class t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4937 (or force-query query))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4938 (setq class-alist
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4939 (mapcar 'list (idlwave-all-method-classes (car info) type)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4940 (setq class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4941 (idlwave-sintern-class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4942 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4943 ((and (= (length class-alist) 0) (not force-query))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4944 (error "No classes available with method %s" (car info)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4945 ((and (= (length class-alist) 1) (not force-query))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4946 (car (car class-alist)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4947 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4948 (setq store idlwave-store-inquired-class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4949 (idlwave-completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4950 (format "Class%s: " (if (stringp (car info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4951 (format " for %s method %s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4952 type (car info))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4953 ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4954 class-alist nil nil nil 'idlwave-class-history))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4955 (when (and class (not (eq t class)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4956 ;; We have a real class here
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4957 (when (and store arrow)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4958 (put-text-property apos (+ apos 2) 'idlwave-class class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4959 (put-text-property apos (+ apos 2) 'face idlwave-class-arrow-face))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4960 (setf (nth 2 info) class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4961 ;; Return the class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4962 class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4963 ;; Default as fallback
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4964 (t class))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4965
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4966 (defvar type-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4967 (defvar class-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4968 (defvar method-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4969 (defun idlwave-selector (a)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4970 (and (eq (nth 1 a) type-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4971 (or (and (nth 2 a) (eq class-selector t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4972 (eq (nth 2 a) class-selector))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4973
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4974 (defun idlwave-where ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4975 "Find out where we are.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4976 The return value is a list with the following stuff:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4977 (PRO-LIST FUNC-LIST COMPLETE-WHAT CW-LIST LAST-CHAR)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4978
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4979 PRO-LIST (PRO POINT CLASS ARROW)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4980 FUNC-LIST (FUNC POINT CLASS ARROW)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4981 COMPLETE-WHAT a symbol indicating what kind of completion makes sense here
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4982 CW-LIST Like PRO-LIST, for what can be copmpleted here.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4983 LAST-CHAR last relevant character before point (non-white non-comment,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4984 not part of current identifier or leading slash).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4985
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4986 In the lists, we have these meanings:
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4987 PRO: Procedure name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4988 FUNC: Function name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4989 POINT: Where is this
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4990 CLASS: What class has the routine (nil=no, t=is method, but class unknown)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4991 ARROW: Where is the arrow?"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4992 (idlwave-routines)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4993 (let* (;(bos (save-excursion (idlwave-beginning-of-statement) (point)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4994 ;; FIXME: WAS THIS CHANGE CORRECT??? Answer: yes.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
4995 (bos (save-excursion (idlwave-start-of-substatement 'pre) (point)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4996 (func-entry (idlwave-what-function bos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4997 (func (car func-entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4998 (func-class (nth 1 func-entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4999 (func-arrow (nth 2 func-entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5000 (func-point (or (nth 3 func-entry) 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5001 (func-level (or (nth 4 func-entry) 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5002 (pro-entry (idlwave-what-procedure bos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5003 (pro (car pro-entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5004 (pro-class (nth 1 pro-entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5005 (pro-arrow (nth 2 pro-entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5006 (pro-point (or (nth 3 pro-entry) 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5007 (last-char (idlwave-last-valid-char))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5008 (case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5009 cw cw-mod cw-arrow cw-class cw-point)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5010 (if (< func-point pro-point) (setq func nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5011 (cond
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5012 ((string-match "\\`[ \t]*\\(pro\\|function\\)[ \t]+[a-zA-Z0-9_]*\\'"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5013 (buffer-substring bos (point)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5014 (setq cw 'class))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5015 ((string-match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5016 "\\`[ \t]*\\([a-zA-Z][a-zA-Z0-9$_]*\\)?\\'"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5017 (buffer-substring (if (> pro-point 0) pro-point bos) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5018 (setq cw 'procedure cw-class pro-class cw-point pro-point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5019 cw-arrow pro-arrow))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5020 ((string-match "\\`[ \t]*\\(pro\\|function\\)\\>"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5021 (buffer-substring bos (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5022 nil)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5023 ((string-match "OBJ_NEW([ \t]*['\"]\\([a-zA-Z][a-zA-Z0-9$_]*\\)?\\'"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5024 (buffer-substring bos (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5025 (setq cw 'class))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5026 ((and func
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5027 (> func-point pro-point)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5028 (= func-level 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5029 (memq last-char '(?\( ?,)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5030 (setq cw 'function-keyword cw-mod func cw-point func-point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5031 cw-class func-class cw-arrow func-arrow))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5032 ((and pro (eq last-char ?,))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5033 (setq cw 'procedure-keyword cw-mod pro cw-point pro-point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5034 cw-class pro-class cw-arrow pro-arrow))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5035 ; ((member last-char '(?\' ?\) ?\] ?!))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5036 ; ;; after these chars, a function makes no sense
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5037 ; ;; FIXME: I am sure there can be more in this list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5038 ; ;; FIXME: Do we want to do this at all?
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5039 ; nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5040 ;; Everywhere else we try a function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5041 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5042 (setq cw 'function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5043 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5044 (if (re-search-backward "->[ \t]*\\(\\([$a-zA-Z0-9_]+\\)::\\)?[$a-zA-Z0-9_]*\\=" bos t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5045 (setq cw-arrow (match-beginning 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5046 cw-class (if (match-end 2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5047 (idlwave-sintern-class (match-string 2))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5048 t))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5049 (list (list pro pro-point pro-class pro-arrow)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5050 (list func func-point func-class func-arrow)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5051 cw
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5052 (list cw-mod cw-point cw-class cw-arrow)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5053 last-char)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5054
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5055 (defun idlwave-this-word (&optional class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5056 ;; Grab the word around point. CLASS is for the `skip-chars=...' functions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5057 (setq class (or class "a-zA-Z0-9$_"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5058 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5059 (buffer-substring-no-properties
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5060 (progn (skip-chars-backward class) (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5061 (progn (skip-chars-forward class) (point)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5062
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5063 (defun idlwave-what-function (&optional bound)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5064 ;; Find out if point is within the argument list of a function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5065 ;; The return value is ("function-name" (point) level).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5066 ;; Level is 1 on the to level parenthesis, higher further down.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5067
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5068 ;; If the optional BOUND is an integer, bound backwards directed
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5069 ;; searches to this point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5070
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5071 (catch 'exit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5072 (let (pos
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5073 func-point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5074 (cnt 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5075 func arrow-start class)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5076 (idlwave-with-special-syntax
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5077 (save-restriction
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5078 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5079 (narrow-to-region (max 1 (or bound 0)) (point-max))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5080 ;; move back out of the current parenthesis
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5081 (while (condition-case nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5082 (progn (up-list -1) t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5083 (error nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5084 (setq pos (point))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5085 (incf cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5086 (when (and (= (following-char) ?\()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5087 (re-search-backward
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5088 "\\(::\\|\\<\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)[ \t]*\\="
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5089 bound t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5090 (setq func (match-string 2)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5091 func-point (goto-char (match-beginning 2))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5092 pos func-point)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5093 (if (re-search-backward
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5094 "->[ \t]*\\(\\([a-zA-Z][a-zA-Z0-9$_]*\\)::\\)?\\=" bound t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5095 (setq arrow-start (match-beginning 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5096 class (or (match-string 2) t)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5097 (throw
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5098 'exit
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5099 (list
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5100 (idlwave-sintern-routine-or-method func class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5101 (idlwave-sintern-class class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5102 arrow-start func-point cnt)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5103 (goto-char pos))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5104 (throw 'exit nil)))))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5105
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5106 (defun idlwave-what-procedure (&optional bound)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5107 ;; Find out if point is within the argument list of a procedure.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5108 ;; The return value is ("procedure-name" class arrow-pos (point)).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5109
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5110 ;; If the optional BOUND is an integer, bound backwards directed
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5111 ;; searches to this point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5112 (let ((pos (point)) pro-point
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5113 pro class arrow-start string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5114 (save-excursion
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5115 ;????(idlwave-beginning-of-statement)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5116 ;; FIXME: WAS THIS CHANGE CORRECT: Answer: yes
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5117 (idlwave-start-of-substatement 'pre)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5118 (setq string (buffer-substring (point) pos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5119 (if (string-match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5120 "\\`[ \t]*\\([a-zA-Z][a-zA-Z0-9$_]*\\)[ \t]*\\(,\\|\\'\\)" string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5121 (setq pro (match-string 1 string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5122 pro-point (+ (point) (match-beginning 1)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5123 (if (and (idlwave-skip-object)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5124 (setq string (buffer-substring (point) pos))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5125 (string-match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5126 "\\`[ \t]*\\(->\\)[ \t]*\\(\\([a-zA-Z][a-zA-Z0-9$_]*\\)::\\)?\\([a-zA-Z][a-zA-Z0-9$_]*\\)?[ \t]*\\(,\\|\\'\\)" string))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5127 (setq pro (if (match-beginning 4)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5128 (match-string 4 string))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5129 pro-point (if (match-beginning 4)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5130 (+ (point) (match-beginning 4))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5131 pos)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5132 arrow-start (+ (point) (match-beginning 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5133 class (or (match-string 3 string) t)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5134 (list (idlwave-sintern-routine-or-method pro class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5135 (idlwave-sintern-class class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5136 arrow-start
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5137 pro-point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5138
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5139 (defun idlwave-skip-object ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5140 ;; If there is an object at point, move over it and return t.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5141 (let ((pos (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5142 (if (catch 'exit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5143 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5144 (skip-chars-forward " ") ; white space
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5145 (skip-chars-forward "*") ; de-reference
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5146 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5147 ((looking-at idlwave-identifier)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5148 (goto-char (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5149 ((eq (following-char) ?\()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5150 nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5151 (t (throw 'exit nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5152 (catch 'endwhile
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5153 (while t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5154 (cond ((eq (following-char) ?.)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5155 (forward-char 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5156 (if (not (looking-at idlwave-identifier))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5157 (throw 'exit nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5158 (goto-char (match-end 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5159 ((memq (following-char) '(?\( ?\[))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5160 (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5161 (forward-list 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5162 (error (throw 'exit nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5163 (t (throw 'endwhile t)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5164 (if (looking-at "[ \t]*->")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5165 (throw 'exit (setq pos (match-beginning 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5166 (throw 'exit nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5167 (goto-char pos)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5168 nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5169
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5170
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5171 (defun idlwave-last-valid-char ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5172 "Return the last character before point which is not white or a comment
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5173 and also not part of the current identifier. Since we do this in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5174 order to identify places where keywords are, we consider the initial
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5175 `/' of a keyword as part of the identifier.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5176 This function is not general, can only be used for completion stuff."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5177 (catch 'exit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5178 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5179 ;; skip the current identifier
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5180 (skip-chars-backward "a-zA-Z0-9_$")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5181 ;; also skip a leading slash which might be belong to the keyword
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5182 (if (eq (preceding-char) ?/)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5183 (backward-char 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5184 ;; FIXME: does not check if this is a valid identifier
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5185 (while t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5186 (skip-chars-backward " \t")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5187 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5188 ((memq (preceding-char) '(?\; ?\$)) (throw 'exit nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5189 ((eq (preceding-char) ?\n)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5190 (beginning-of-line 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5191 (if (looking-at "\\([^;]\\)*\\$[ \t]*\\(;.*\\)?\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5192 ;; continuation line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5193 (goto-char (match-end 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5194 (throw 'exit nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5195 (t (throw 'exit (preceding-char))))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5196
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5197 (defvar idlwave-complete-after-success-form nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5198 "A form to evaluate after successful completion.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5199 (defvar idlwave-complete-after-success-form-force nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5200 "A form to evaluate after completion selection in *Completions* buffer.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5201 (defconst idlwave-completion-mark (make-marker)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5202 "A mark pointing to the beginning of the completion string.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5203
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5204 (defun idlwave-complete-in-buffer (type stype list selector prompt isa
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5205 &optional prepare-display-function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5206 "Perform TYPE completion of word before point against LIST.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5207 SELECTOR is the PREDICATE argument for the completion function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5208 Show PROMPT in echo area. TYPE is one of 'function, 'procedure or 'keyword."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5209 (let* ((completion-ignore-case t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5210 beg (end (point)) slash part spart completion all-completions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5211 dpart dcompletion)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5212
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5213 (unless list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5214 (error (concat prompt ": No completions available")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5215
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5216 ;; What is already in the buffer?
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5217 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5218 (skip-chars-backward "a-zA-Z0-9_$")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5219 (setq slash (eq (preceding-char) ?/)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5220 beg (point)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5221 idlwave-complete-after-success-form
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5222 (list 'idlwave-after-successful-completion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5223 (list 'quote type) slash beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5224 idlwave-complete-after-success-form-force
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5225 (list 'idlwave-after-successful-completion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5226 (list 'quote type) slash (list 'quote 'force))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5227
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5228 ;; Try a completion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5229 (setq part (buffer-substring beg end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5230 dpart (downcase part)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5231 spart (idlwave-sintern stype part)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5232 completion (try-completion part list selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5233 dcompletion (if (stringp completion) (downcase completion)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5234 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5235 ((null completion)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5236 ;; nothing available.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5237 (error "Can't find %s completion for \"%s\"" isa part))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5238 ((and (not (equal dpart dcompletion))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5239 (not (eq t completion)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5240 ;; We can add something
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5241 (delete-region beg end)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5242 (if (and (string= part dpart)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5243 (or (not (string= part ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5244 idlwave-complete-empty-string-as-lower-case)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5245 (not idlwave-completion-force-default-case))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5246 (insert dcompletion)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5247 (insert completion))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5248 (if (eq t (try-completion completion list selector))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5249 ;; Now this is a unique match
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5250 (idlwave-after-successful-completion type slash beg))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5251 t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5252 ((or (eq completion t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5253 (and (equal dpart dcompletion)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5254 (= 1 (length (setq all-completions
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5255 (idlwave-uniquify
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5256 (all-completions part list selector)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5257 ;; This is already complete
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5258 (idlwave-after-successful-completion type slash beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5259 (message "%s is already the complete %s" part isa)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5260 nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5261 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5262 ;; We cannot add something - offer a list.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5263 (message "Making completion list...")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5264 (let* ((list all-completions)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5265 (complete (memq spart all-completions))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5266 (completion-highlight-first-word-only t) ; XEmacs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5267 (completion-fixup-function ; Emacs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5268 (lambda () (and (eq (preceding-char) ?>)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5269 (re-search-backward " <" beg t)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5270 (setq list (sort list (lambda (a b)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5271 (string< (downcase a) (downcase b)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5272 (if prepare-display-function
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5273 (setq list (funcall prepare-display-function list)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5274 (if (and (string= part dpart)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5275 (or (not (string= part ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5276 idlwave-complete-empty-string-as-lower-case)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5277 (not idlwave-completion-force-default-case))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5278 (setq list (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5279 (if (listp x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5280 (setcar x (downcase (car x)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5281 (setq x (downcase x)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5282 x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5283 list)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5284 (idlwave-display-completion-list list prompt beg complete))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5285 t))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5286
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5287 (defun idlwave-complete-class ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5288 "Complete a class at point."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5289 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5290 ;; Call `idlwave-routines' to make sure the class list will be available
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5291 (idlwave-routines)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5292 ;; Check for the special case of completing empty string after pro/function
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5293 (if (let ((case-fold-search t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5294 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5295 (and
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5296 (re-search-backward "\\<\\(pro\\|function\\)[ \t]+\\="
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5297 (- (point) 15) t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5298 (goto-char (point-min))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5299 (re-search-forward
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5300 "^[ \t]*\\(pro\\|function\\)[ \t]+\\([a-zA-Z0-9_]+::\\)" nil t))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5301 ;; Yank the full class specification
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5302 (insert (match-string 2))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5303 ;; Do the completion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5304 (idlwave-complete-in-buffer 'class 'class (idlwave-class-alist) nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5305 "Select a class" "class")))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5306
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5307 (defun idlwave-attach-classes (list is-kwd show-classes)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5308 ;; attach the proper class list to a LIST of completion items.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5309 ;; IS-KWD, when non-nil, shows its keywords - otherwise its methods
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5310 ;; SHOW-CLASSES is the value of `idlwave-completion-show-classes'.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5311 (catch 'exit
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5312 (if (or (null show-classes) ; don't wnat to see classes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5313 (null class-selector) ; not a method call
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5314 (stringp class-selector)) ; the class is already known
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5315 ;; In these cases, we do not have to do anything
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5316 (throw 'exit list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5317
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5318 ;; The property and dots stuff currently only make sense with XEmacs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5319 ;; because Emacs drops text properties when filling the *Completions*
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5320 ;; buffer.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5321 (let* ((do-prop (and (featurep 'xemacs) (>= show-classes 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5322 (do-buf (not (= show-classes 0)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5323 (do-dots (featurep 'xemacs))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5324 (max (abs show-classes))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5325 (lmax (if do-dots (apply 'max (mapcar 'length list))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5326 classes nclasses class-info space)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5327 (mapcar
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5328 (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5329 ;; get the classes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5330 (setq classes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5331 (if is-kwd
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5332 (idlwave-all-method-keyword-classes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5333 method-selector x type-selector)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5334 (idlwave-all-method-classes x type-selector)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5335 (setq nclasses (length classes))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5336 ;; Make the separator between item and class-info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5337 (if do-dots
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5338 (setq space (concat " " (make-string (- lmax (length x)) ?.)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5339 (setq space " "))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5340 (if do-buf
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5341 ;; We do want info in the buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5342 (if (<= nclasses max)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5343 (setq class-info (concat
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5344 space
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5345 "<" (mapconcat 'identity classes ",") ">"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5346 (setq class-info (format "%s<%d classes>" space nclasses)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5347 (setq class-info nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5348 (when do-prop
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5349 ;; We do want properties
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5350 (setq x (copy-sequence x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5351 (put-text-property 0 (length x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5352 'help-echo (mapconcat 'identity classes " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5353 x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5354 (if class-info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5355 (list x class-info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5356 x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5357 list))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5358
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5359 (defun idlwave-attach-method-classes (list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5360 ;; Call idlwave-attach-classes with method parameters
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5361 (idlwave-attach-classes list nil idlwave-completion-show-classes))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5362 (defun idlwave-attach-keyword-classes (list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5363 ;; Call idlwave-attach-classes with keyword parameters
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5364 (idlwave-attach-classes list t idlwave-completion-show-classes))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5365
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5366 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5367 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5368 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5369 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5370 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5371
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5372 (defvar idlwave-completion-setup-hook nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5373
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5374 (defun idlwave-scroll-completions (&optional message)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5375 "Scroll the completion window on this frame."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5376 (let ((cwin (get-buffer-window "*Completions*" 'visible))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5377 (win (selected-window)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5378 (unwind-protect
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5379 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5380 (select-window cwin)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5381 (condition-case nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5382 (scroll-up)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5383 (error (if (and (listp last-command)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5384 (nth 2 last-command))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5385 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5386 (select-window win)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5387 (eval idlwave-complete-after-success-form))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5388 (set-window-start cwin (point-min)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5389 (and message (message message)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5390 (select-window win))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5391
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5392 (defun idlwave-display-completion-list (list &optional message beg complete)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5393 "Display the completions in LIST in the completions buffer and echo MESSAGE."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5394 (unless (and (get-buffer-window "*Completions*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5395 (idlwave-local-value 'idlwave-completion-p "*Completions*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5396 (move-marker idlwave-completion-mark beg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5397 (setq idlwave-before-completion-wconf (current-window-configuration)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5398
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5399 (if (featurep 'xemacs)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5400 (idlwave-display-completion-list-xemacs
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5401 list)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5402 (idlwave-display-completion-list-emacs list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5403
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5404 ;; Store a special value in `this-command'. When `idlwave-complete'
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5405 ;; finds this in `last-command', it will scroll the *Completions* buffer.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5406 (setq this-command (list 'idlwave-display-completion-list message complete))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5407
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5408 ;; Mark the completions buffer as created by cib
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5409 (idlwave-set-local 'idlwave-completion-p t "*Completions*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5410
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5411 ;; Fontify the classes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5412 (if (and idlwave-completion-fontify-classes
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5413 (consp (car list)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5414 (idlwave-completion-fontify-classes))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5415
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5416 ;; Run the hook
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5417 (run-hooks 'idlwave-completion-setup-hook)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5418
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5419 ;; Display the message
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5420 (message (or message "Making completion list...done")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5421
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5422 (defun idlwave-choose (function &rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5423 "Call FUNCTION as a completion chooser and pass ARGS to it."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5424 (let ((completion-ignore-case t)) ; install correct value
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5425 (apply function args))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5426 (if (and (eq major-mode 'idlwave-shell-mode)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5427 (boundp 'font-lock-mode)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5428 (not font-lock-mode))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5429 ;; Remove the fontification of the word before point
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5430 (let ((beg (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5431 (skip-chars-backward "a-zA-Z0-9_")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5432 (point))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5433 (remove-text-properties beg (point) '(face nil))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5434 (eval idlwave-complete-after-success-form-force))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5435
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5436 (defun idlwave-restore-wconf-after-completion ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5437 "Restore the old (before completion) window configuration."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5438 (and idlwave-completion-restore-window-configuration
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5439 idlwave-before-completion-wconf
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5440 (set-window-configuration idlwave-before-completion-wconf)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5441
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5442 (defun idlwave-set-local (var value &optional buffer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5443 "Set the buffer-local value of VAR in BUFFER to VALUE."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5444 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5445 (set-buffer (or buffer (current-buffer)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5446 (set (make-local-variable var) value)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5447
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5448 (defun idlwave-local-value (var &optional buffer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5449 "Return the value of VAR in BUFFER, but only if VAR is local to BUFFER."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5450 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5451 (set-buffer (or buffer (current-buffer)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5452 (and (local-variable-p var (current-buffer))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5453 (symbol-value var))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5454
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5455 ;; In XEmacs, we can use :activate-callback directly to advice the
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5456 ;; choose functions. We use the private keymap only for the online
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5457 ;; help feature.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5458
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5459 (defvar idlwave-completion-map nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5460 "Keymap for completion-list-mode with idlwave-complete.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5461
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5462 (defun idlwave-display-completion-list-xemacs (list &rest cl-args)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5463 (with-output-to-temp-buffer "*Completions*"
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5464 (apply 'display-completion-list list
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5465 ':activate-callback 'idlwave-default-choose-completion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5466 cl-args))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5467 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5468 (set-buffer "*Completions*")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5469 (use-local-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5470 (or idlwave-completion-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5471 (setq idlwave-completion-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5472 (idlwave-make-modified-completion-map-xemacs
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5473 (current-local-map)))))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5474
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5475 (defun idlwave-default-choose-completion (&rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5476 "Execute `default-choose-completion' and then restore the win-conf."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5477 (apply 'idlwave-choose 'default-choose-completion args))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5478
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5479 (defun idlwave-make-modified-completion-map-xemacs (old-map)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5480 "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5481 (let ((new-map (copy-keymap old-map)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5482 (define-key new-map [button3up] 'idlwave-mouse-completion-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5483 (define-key new-map [button3] (lambda ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5484 (interactive)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5485 (setq this-command last-command)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5486 new-map))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5487
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5488 ;; In Emacs we also to replace choose keybindings in the completion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5489 ;; map in order to install our wrappers.
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5490
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5491 (defun idlwave-display-completion-list-emacs (list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5492 "Display completion list and install the choose wrappers."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5493 (with-output-to-temp-buffer "*Completions*"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5494 (display-completion-list list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5495 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5496 (set-buffer "*Completions*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5497 (use-local-map
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5498 (or idlwave-completion-map
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5499 (setq idlwave-completion-map
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5500 (idlwave-make-modified-completion-map-emacs
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5501 (current-local-map)))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5502
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5503 (defun idlwave-make-modified-completion-map-emacs (old-map)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5504 "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5505 (let ((new-map (copy-keymap old-map)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5506 (substitute-key-definition
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5507 'choose-completion 'idlwave-choose-completion new-map)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5508 (substitute-key-definition
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5509 'mouse-choose-completion 'idlwave-mouse-choose-completion new-map)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5510 (define-key new-map [mouse-3] 'idlwave-mouse-completion-help)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5511 new-map))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5512
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5513 (defun idlwave-choose-completion (&rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5514 "Choose the completion that point is in or next to."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5515 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5516 (apply 'idlwave-choose 'choose-completion args))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5517
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5518 (defun idlwave-mouse-choose-completion (&rest args)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5519 "Click on an alternative in the `*Completions*' buffer to choose it."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5520 (interactive "e")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5521 (apply 'idlwave-choose 'mouse-choose-completion args))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5522
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5523 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5524 ;;----------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5525
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5526 (defun idlwave-completion-fontify-classes ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5527 "Goto the *Completions* buffer and fontify the class info."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5528 (when (featurep 'font-lock)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5529 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5530 (set-buffer "*Completions*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5531 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5532 (goto-char (point-min))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5533 (while (re-search-forward "\\.*<[^>]+>" nil t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5534 (put-text-property (match-beginning 0) (match-end 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5535 'face 'font-lock-string-face))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5536
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5537 (defun idlwave-uniquify (list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5538 (let (nlist)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5539 (loop for x in list do
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5540 (add-to-list 'nlist x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5541 nlist))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5542
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5543 (defun idlwave-after-successful-completion (type slash &optional verify)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5544 "Add `=' or `(' after successful completion of keyword and function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5545 Restore the pre-completion window configuration if possible."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5546 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5547 ((eq type 'procedure)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5548 nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5549 ((eq type 'function)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5550 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5551 ((equal idlwave-function-completion-adds-paren nil) nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5552 ((or (equal idlwave-function-completion-adds-paren t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5553 (equal idlwave-function-completion-adds-paren 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5554 (insert "("))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5555 ((equal idlwave-function-completion-adds-paren 2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5556 (insert "()")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5557 (backward-char 1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5558 (t nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5559 ((eq type 'keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5560 (if (and idlwave-keyword-completion-adds-equal
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5561 (not slash))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5562 (progn (insert "=") t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5563 nil)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5564
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5565 ;; Restore the pre-completion window configuration if this is safe.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5566
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5567 (if (or (eq verify 'force) ; force
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5568 (and
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5569 (get-buffer-window "*Completions*") ; visible
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5570 (idlwave-local-value 'idlwave-completion-p
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5571 "*Completions*") ; cib-buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5572 (eq (marker-buffer idlwave-completion-mark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5573 (current-buffer)) ; buffer OK
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5574 (equal (marker-position idlwave-completion-mark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5575 verify))) ; pos OK
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5576 (idlwave-restore-wconf-after-completion))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5577 (move-marker idlwave-completion-mark nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5578 (setq idlwave-before-completion-wconf nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5579
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5580 (defun idlwave-mouse-context-help (ev &optional arg)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5581 "Call `idlwave-context-help' on the clicked location."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5582 (interactive "eP")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5583 (mouse-set-point ev)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5584 (idlwave-context-help arg))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5585
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5586 (defvar idlwave-last-context-help-pos nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5587 (defun idlwave-context-help (&optional arg)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5588 "Display IDL Online Help on context.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5589 If point is on a keyword, help for that keyword will be shown.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5590 If point is on a routine name or in the argument list of a routine,
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5591 help for that routine will be displayed.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5592 Works for system routines and keywords only."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5593 (interactive "P")
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5594 (idlwave-require-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5595 (idlwave-do-context-help arg))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5596
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5597 (defun idlwave-mouse-completion-help (ev)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5598 "Display online help about the completion at point."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5599 (interactive "eP")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5600 (idlwave-require-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5601 ;; Restore last-command for next command, to make scrolling of completions
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5602 ;; work.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5603 (setq this-command last-command)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5604 (idlwave-do-mouse-completion-help ev))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5605
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5606
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5607 (defvar idlwave-help-is-loaded nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5608 "Is online help avaiable?")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5609 ;; The following variables will be defined by `idlw-help.el'.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5610 (defvar idlwave-help-frame-width nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5611 (defvar idlwave-help-file nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5612 (defvar idlwave-help-topics nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5613
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5614 (defun idlwave-help-directory ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5615 "Return the help directory, or nil if that is not known."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5616 (or (and (stringp idlwave-help-directory)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5617 (> (length idlwave-help-directory) 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5618 idlwave-help-directory)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5619 (getenv "IDLWAVE_HELP_DIRECTORY")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5620
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5621 (defun idlwave-require-online-help ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5622 (if idlwave-help-is-loaded
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5623 t ;; everything is OK.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5624 (let* ((dir (or (idlwave-help-directory)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5625 (error "Online Help is not installed (idlwave-help-directory is unknown).")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5626 (lfile1 (expand-file-name "idlw-help.elc" dir))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5627 (lfile2 (expand-file-name "idlw-help.el" dir))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5628 (hfile (expand-file-name "idlw-help.txt" dir)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5629 (if (or (and (file-regular-p lfile1) (load-file lfile1))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5630 (and (file-regular-p lfile2) (load-file lfile2)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5631 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5632 (if (and idlwave-help-frame-parameters
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5633 (not (assoc 'width idlwave-help-frame-parameters)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5634 (push (cons 'width idlwave-help-frame-width)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5635 idlwave-help-frame-parameters))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5636 (or idlwave-help-topics
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5637 (error "File `%s' in help dir `%s' does not define `idlwave-help-topics'"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5638 "idlw-help.el" dir)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5639 (error "No such file `%s' in help dir `%s'" "idlw-help.el" dir))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5640 (if (file-regular-p hfile)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5641 (setq idlwave-help-is-loaded t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5642 idlwave-help-file hfile)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5643 (error "No such file `%s' in dir `%s'" "idlw-help.txt" dir)))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5644
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5645 (defun idlwave-routine-info (&optional arg external)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5646 "Display a routines calling sequence and list of keywords.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5647 When point is on the name a function or procedure, or in the argument
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5648 list of a function or procedure, this command displays a help buffer
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5649 with the information. When called with prefix arg, enforce class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5650 query.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5651
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5652 When point is on an object operator `->', display the class stored in
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5653 this arrow, if any (see `idlwave-store-inquired-class'). With a
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5654 prefix arg, the class property is cleared out."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5655
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5656 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5657 (idlwave-routines)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5658 (if (string-match "->" (buffer-substring
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5659 (max (point-min) (1- (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5660 (min (+ 2 (point)) (point-max))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5661 ;; Cursor is on an arrow
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5662 (if (get-text-property (point) 'idlwave-class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5663 ;; arrow has class property
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5664 (if arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5665 ;; Remove property
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5666 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5667 (backward-char 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5668 (when (looking-at ".?\\(->\\)")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5669 (remove-text-properties (match-beginning 1) (match-end 1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5670 '(idlwave-class nil face nil))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5671 (message "Class property removed from arrow")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5672 ;; Echo class property
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5673 (message "Arrow has text property identifying object to be class %s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5674 (get-text-property (point) 'idlwave-class)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5675 ;; No property found
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5676 (message "Arrow has no class text property"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5677
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5678 ;; Not on an arrow...
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5679 (let* ((idlwave-query-class nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5680 (idlwave-force-class-query (equal arg '(4)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5681 (module (idlwave-what-module)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5682 (if (car module)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5683 (apply 'idlwave-display-calling-sequence module)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5684 (error "Don't know which calling sequence to show.")))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5685
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5686 (defun idlwave-resolve (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5687 "Call RESOLVE on the module name at point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5688 Like `idlwave-routine-info', this looks for a routine call at point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5689 After confirmation in the minibuffer, it will use the shell to issue
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5690 a RESOLVE call for this routine, to attempt to make it defined and its
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5691 routine info available for IDLWAVE. If the routine is a method call,
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5692 both `class__method' and `class__define' will be tried.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5693 With ARG, enforce query for the class of object methods."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5694 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5695 (let* ((idlwave-query-class nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5696 (idlwave-force-class-query (equal arg '(4)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5697 (module (idlwave-what-module))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5698 (name (idlwave-make-full-name (nth 2 module) (car module)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5699 (type (if (eq (nth 1 module) 'pro) "pro" "function"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5700 (resolve (read-string "Resolve: " (format "%s %s" type name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5701 (kwd "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5702 class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5703 (if (string-match "\\(pro\\|function\\)[ \t]+\\(\\(.*\\)::\\)?\\(.*\\)"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5704 resolve)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5705 (setq type (match-string 1 resolve)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5706 class (if (match-beginning 2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5707 (match-string 3 resolve)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5708 nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5709 name (match-string 4 resolve)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5710 (if (string= (downcase type) "function")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5711 (setq kwd ",/is_function"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5712
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5713 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5714 ((null class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5715 (idlwave-shell-send-command
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5716 (format "resolve_routine,'%s'%s" (downcase name) kwd)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5717 'idlwave-update-routine-info
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5718 nil t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5719 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5720 (idlwave-shell-send-command
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5721 (format "resolve_routine,'%s__define'%s" (downcase class) kwd)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5722 (list 'idlwave-shell-send-command
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5723 (format "resolve_routine,'%s__%s'%s"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5724 (downcase class) (downcase name) kwd)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5725 '(idlwave-update-routine-info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5726 nil t))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5727
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5728 (defun idlwave-find-module (&optional arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5729 "Find the source code of an IDL module.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5730 Works for modules for which IDLWAVE has routine info available.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5731 The function offers as default the module name `idlwave-routine-info' would
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5732 use. With ARG force class query for object methods."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5733 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5734 (let* ((idlwave-query-class nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5735 (idlwave-force-class-query (equal arg '(4)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5736 (module (idlwave-what-module))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5737 (default (concat (idlwave-make-full-name (nth 2 module) (car module))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5738 (if (eq (nth 1 module) 'pro) "<p>" "<f>")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5739 (list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5740 (delq nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5741 (mapcar (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5742 (if (eq 'system (car-safe (nth 3 x)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5743 ;; Take out system routines with no source.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5744 nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5745 (cons
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5746 (concat (idlwave-make-full-name (nth 2 x) (car x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5747 (if (eq (nth 1 x) 'pro) "<p>" "<f>"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5748 (cdr x))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5749 (idlwave-routines))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5750 (name (idlwave-completing-read
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5751 (format "Module (Default %s): "
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5752 (if default default "none"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5753 list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5754 type class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5755 (if (string-match "\\`\\s-*\\'" name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5756 ;; Nothing, use the default.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5757 (setq name default))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5758 (if (string-match "<[fp]>" name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5759 (setq type (substring name -2 -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5760 name (substring name 0 -3)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5761 (if (string-match "\\(.*\\)::\\(.*\\)" name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5762 (setq class (match-string 1 name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5763 name (match-string 2 name)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5764 (setq name (idlwave-sintern-routine-or-method name class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5765 class (idlwave-sintern-class class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5766 type (cond ((equal type "f") 'fun)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5767 ((equal type "p") 'pro)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5768 (t t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5769 (idlwave-do-find-module name type class)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5770
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5771 (defun idlwave-do-find-module (name type class &optional force-source)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5772 (let ((name1 (idlwave-make-full-name class name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5773 source buf1 entry
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5774 (buf (current-buffer))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5775 (pos (point)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5776 (setq entry (idlwave-best-rinfo-assq name type class (idlwave-routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5777 source (or force-source (nth 3 entry)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5778 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5779 ((or (null name) (equal name ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5780 (error "Abort"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5781 ((null entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5782 (error "Nothing known about a module %s" name1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5783 ((eq (car source) 'system)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5784 (error "Source code for system routine %s is not available."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5785 name1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5786 ((equal (cdr source) "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5787 (error "Source code for routine %s is not available."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5788 name1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5789 ((memq (car source) '(buffer lib compiled))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5790 (setq buf1
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5791 (if (eq (car source) 'lib)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5792 (idlwave-find-file-noselect
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5793 (idlwave-expand-lib-file-name
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5794 (or (cdr source)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5795 (format "%s.pro" (downcase name)))) 'find)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5796 (idlwave-find-file-noselect (cdr source) 'find)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5797 (pop-to-buffer buf1 t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5798 (goto-char (point-max))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5799 (let ((case-fold-search t))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5800 (if (re-search-backward
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5801 (concat "^[ \t]*\\<"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5802 (cond ((equal type "f") "function")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5803 ((equal type "p") "pro")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5804 (t "\\(pro\\|function\\)"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5805 "\\>[ \t]+"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5806 (regexp-quote (downcase name1))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5807 "[^a-zA-Z0-9_$]")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5808 nil t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5809 (goto-char (match-beginning 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5810 (pop-to-buffer buf)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5811 (goto-char pos)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5812 (error "Could not find routine %s" name1)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5813
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5814 (defun idlwave-what-module ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5815 "Return a default module for stuff near point.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5816 Used by `idlwave-routine-info' and `idlwave-find-module'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5817 (idlwave-routines)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5818 (if (let ((case-fold-search t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5819 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5820 (idlwave-beginning-of-statement)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5821 (looking-at "[ \t]*\\(pro\\|function\\)[ \t]+\\(\\([a-zA-Z0-9_$]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)\\([, \t\n]\\|$\\)")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5822 ;; This is a function or procedure definition statement
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5823 ;; We return the defined routine as module.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5824 (list
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5825 (idlwave-sintern-routine-or-method (match-string 4)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5826 (match-string 2))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5827 (if (equal (downcase (match-string 1)) "pro") 'pro 'fun)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5828 (idlwave-sintern-class (match-string 3)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5829
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5830 ;; Not a definition statement - analyze precise positon.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5831 (let* ((where (idlwave-where))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5832 (cw (nth 2 where))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5833 (pro (car (nth 0 where)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5834 (func (car (nth 1 where)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5835 (this-word (idlwave-this-word "a-zA-Z0-9$_"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5836 (next-char (save-excursion (skip-chars-forward "a-zA-Z0-9$_")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5837 (following-char)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5838 )
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5839 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5840 ((and (eq cw 'procedure)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5841 (not (equal this-word "")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5842 (setq this-word (idlwave-sintern-routine-or-method
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5843 this-word (nth 2 (nth 3 where))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5844 (list this-word 'pro
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5845 (idlwave-determine-class
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5846 (cons this-word (cdr (nth 3 where)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5847 'pro)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5848 ((and (eq cw 'function)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5849 (not (equal this-word ""))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5850 (or (eq next-char ?\() ; exclude arrays, vars.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5851 (looking-at "[a-zA-Z0-9_]*[ \t]*(")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5852 (setq this-word (idlwave-sintern-routine-or-method
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5853 this-word (nth 2 (nth 3 where))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5854 (list this-word 'fun
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5855 (idlwave-determine-class
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5856 (cons this-word (cdr (nth 3 where)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5857 'fun)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5858 ((and (memq cw '(function-keyword procedure-keyword))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5859 (not (equal this-word ""))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5860 (eq next-char ?\()) ; A function!
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5861 (setq this-word (idlwave-sintern-routine this-word))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5862 (list this-word 'fun nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5863 (func
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5864 (list func 'fun (idlwave-determine-class (nth 1 where) 'fun)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5865 (pro
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5866 (list pro 'pro (idlwave-determine-class (nth 0 where) 'pro)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5867 (t nil)))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5868
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5869 (defun idlwave-fix-keywords (name type class keywords)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5870 ;; This fixes the list of keywords.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5871 (let ((case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5872 name1 type1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5873
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5874 ;; If this is the OBJ_NEW function, try to figure out the class and use
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5875 ;; the keywords from the corresponding INIT method.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5876 (if (and (equal name "OBJ_NEW")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5877 (eq major-mode 'idlwave-mode))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5878 (let* ((bos (save-excursion (idlwave-beginning-of-statement) (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5879 (string (buffer-substring bos (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5880 (case-fold-search t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5881 class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5882 (and (string-match "obj_new([^'\"]*['\"]\\([a-zA-Z0-9_]+\\)"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5883 string)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5884 (setq class (idlwave-sintern-class (match-string 1 string)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5885 (setq idlwave-current-obj_new-class class)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5886 (setq keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5887 (append keywords
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5888 (nth 5 (idlwave-rinfo-assq
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5889 (idlwave-sintern-method "INIT")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5890 'fun
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5891 class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5892 (idlwave-routines))))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5893
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5894 ;; If the class is `t', combine all keywords of all methods NAME
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5895 (when (eq class t)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5896 (loop for x in (idlwave-routines) do
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5897 (and (nth 2 x) ; non-nil class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5898 (or (and (eq (nth 1 x) type) ; default type
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5899 (eq (car x) name)) ; default name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5900 (and (eq (nth 1 x) type1) ; backup type
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5901 (eq (car x) name1))) ; backup name
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5902 (mapcar (lambda (k) (add-to-list 'keywords k))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5903 (nth 5 x))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5904 (setq keywords (idlwave-uniquify keywords)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5905 ;; Return the final list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5906 keywords))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5907
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5908 (defun idlwave-expand-keyword (keyword module)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5909 "Expand KEYWORD to one of the legal keyword parameters of MODULE.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5910 KEYWORD may be an exact match or an abbreviation of a keyword.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5911 If the match is exact, KEYWORD itself is returned, even if there may be other
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5912 keywords of which KEYWORD is an abbreviation. This is necessary because some
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5913 system routines have keywords which are prefixes of other keywords.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5914 If KEYWORD is an abbreviation of several keywords, a list of all possible
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5915 completions is returned.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5916 If the abbreviation was unique, the correct keyword is returned.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5917 If it cannot be a keyword, the function return nil.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5918 If we do not know about MODULE, just return KEYWORD literally."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5919 (let* ((name (car module))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5920 (type (nth 1 module))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5921 (class (nth 2 module))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5922 (kwd (idlwave-sintern-keyword keyword))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5923 (entry (idlwave-best-rinfo-assoc name type class (idlwave-routines)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5924 (kwd-alist (nth 5 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5925 (extra (or (assq (idlwave-sintern-keyword "_EXTRA") kwd-alist)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5926 (assq (idlwave-sintern-keyword "_REF_EXTRA") kwd-alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5927 (completion-ignore-case t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5928 candidates)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5929 (cond ((assq kwd kwd-alist)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5930 kwd)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5931 ((setq candidates (all-completions kwd kwd-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5932 (if (= (length candidates) 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5933 (car candidates)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5934 candidates))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5935 ((and entry extra)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5936 ;; Inheritance may cause this keyword to be correct
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5937 keyword)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5938 (entry
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5939 ;; We do know the function, which does not have the keyword.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5940 nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5941 (t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5942 ;; We do not know the function, so this just might be a correct
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5943 ;; keyword - return it as it is.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5944 keyword))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5945
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5946 (defvar idlwave-rinfo-mouse-map (make-sparse-keymap))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5947 (defvar idlwave-rinfo-map (make-sparse-keymap))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5948 (define-key idlwave-rinfo-mouse-map
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5949 (if (featurep 'xemacs) [button2] [mouse-2])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5950 'idlwave-mouse-active-rinfo)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5951 (define-key idlwave-rinfo-mouse-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5952 (if (featurep 'xemacs) [(shift button2)] [(shift mouse-2)])
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5953 'idlwave-mouse-active-rinfo-shift)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5954 (define-key idlwave-rinfo-mouse-map
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5955 (if (featurep 'xemacs) [button3] [mouse-3])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5956 'idlwave-mouse-active-rinfo-right)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5957 (define-key idlwave-rinfo-mouse-map " " 'idlwave-active-rinfo-space)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5958 (define-key idlwave-rinfo-map "q" 'idlwave-quit-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5959 (define-key idlwave-rinfo-mouse-map "q" 'idlwave-quit-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5960 (defvar idlwave-popup-source nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5961 (defvar idlwave-rinfo-marker (make-marker))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5962
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5963 (defun idlwave-quit-help ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5964 (interactive)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5965 (let ((ri-window (get-buffer-window "*Help*"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5966 (olh-window (get-buffer-window "*IDLWAVE Help*")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5967 (when (and olh-window
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5968 (fboundp 'idlwave-help-quit))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5969 (select-window olh-window)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5970 (idlwave-help-quit))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5971 (when (window-live-p ri-window)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5972 (delete-window ri-window))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5973
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5974 (defun idlwave-display-calling-sequence (name type class)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5975 ;; Display the calling sequence of module NAME, type TYPE in class CLASS.
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5976 (let* ((entry (or (idlwave-best-rinfo-assq name type class
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5977 (idlwave-routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5978 (idlwave-rinfo-assq name type class
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5979 idlwave-unresolved-routines)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5980 (name (or (car entry) name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5981 (class (or (nth 2 entry) class))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5982 (twins (idlwave-routine-twins entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5983 (dtwins (idlwave-study-twins twins))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5984 (all dtwins)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5985 (system (idlwave-rinfo-assq
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5986 name type class idlwave-system-routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5987 (have-sysdoc (and system (idlwave-help-directory)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5988 ;; (source (nth 3 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5989 (have-olh (and (or system idlwave-extra-help-function)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5990 (idlwave-help-directory)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5991 (calling-seq (nth 4 entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5992 (keywords (nth 5 entry))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5993 (olh (nth 6 entry))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5994 (help-echo-kwd
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5995 (if have-olh
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5996 "Button2: Insert KEYWORD (SHIFT=`/KEYWORD') Button3: Online Help "
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5997 "Button2: Insert KEYWORD (SHIFT=`/KEYWORD')."))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5998 (help-echo-use
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
5999 (if have-olh
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6000 "Button2/3: Online Help"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6001 nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6002 (help-echo-src
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6003 (if (idlwave-help-directory)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6004 "Button2: Pop to source and back. Button3: Source in Help window."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6005 "Button2: Pop to source and back."))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6006 (col 0)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6007 (data (list name type class (current-buffer) olh))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6008 (km-prop (if (featurep 'xemacs) 'keymap 'local-map))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6009 (face 'idlwave-help-link-face)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6010 beg props win cnt total)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6011 (setq keywords (idlwave-fix-keywords name type class keywords))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6012 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6013 ((null entry)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6014 (error "No %s %s known" type name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6015 ((or (null name) (equal name ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6016 (error "No function or procedure call at point."))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6017 ((null calling-seq)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6018 (error "Calling sequence of %s %s is not available" type name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6019 (t
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6020 (save-excursion
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6021 (move-marker idlwave-rinfo-marker (point))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6022 (set-buffer (get-buffer-create "*Help*"))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6023 (use-local-map idlwave-rinfo-map)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6024 (setq buffer-read-only nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6025 (erase-buffer)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6026 (set (make-local-variable 'idlwave-popup-source) nil)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6027 (set (make-local-variable 'idlwave-current-obj_new-class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6028 idlwave-current-obj_new-class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6029 (setq props (if have-olh
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6030 (list 'mouse-face 'highlight
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6031 km-prop idlwave-rinfo-mouse-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6032 'help-echo help-echo-use
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6033 'data (cons 'usage data))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6034 (if have-sysdoc (setq props (append (list 'face face) props)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6035 (insert "Usage: ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6036 (setq beg (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6037 (insert (if class
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6038 (format calling-seq class name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6039 (format calling-seq name))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6040 "\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6041 (add-text-properties beg (point) props)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6042
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6043 (insert "Keywords:")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6044 (if (null keywords)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6045 (insert " No keywords accepted.")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6046 (setq col 9)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6047 (mapcar
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6048 (lambda (x)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6049 (if (>= (+ col 1 (length (car x)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6050 (window-width))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6051 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6052 (insert "\n ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6053 (setq col 9)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6054 (insert " ")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6055 (setq beg (point)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6056 props (list 'mouse-face 'highlight
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6057 km-prop idlwave-rinfo-mouse-map
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6058 'data (cons 'keyword data)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6059 'help-echo help-echo-kwd
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6060 'keyword (car x)))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6061 (if have-sysdoc (setq props (append (list 'face face) props)))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6062 (insert (car x))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6063 (add-text-properties beg (point) props)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6064 (setq col (+ col 1 (length (car x)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6065 keywords))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6066
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6067 (setq cnt 1 total (length all))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6068 (while (setq entry (pop all))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6069 (setq props (list 'mouse-face 'highlight
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6070 km-prop idlwave-rinfo-mouse-map
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6071 'help-echo help-echo-src
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6072 'source (cons (car (nth 2 entry)) (nth 1 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6073 'data (cons 'source data)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6074 (idlwave-insert-source-location
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6075 (format "\n%-8s %s"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6076 (if (equal cnt 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6077 (if (> total 1) "Sources:" "Source:")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6078 "")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6079 (if (> total 1) "- " ""))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6080 entry props)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6081 (incf cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6082 (when (and all (> cnt idlwave-rinfo-max-source-lines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6083 ;; No more source lines, please
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6084 (insert (format
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6085 "\n Source information truncated to %d entries."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6086 idlwave-rinfo-max-source-lines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6087 (setq all nil)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6088
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6089 (setq buffer-read-only t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6090 (display-buffer "*Help*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6091 (if (and (setq win (get-buffer-window "*Help*"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6092 idlwave-resize-routine-help-window)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6093 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6094 (let ((ww (selected-window)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6095 (unwind-protect
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6096 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6097 (select-window win)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6098 (enlarge-window (- (/ (frame-height) 2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6099 (window-height)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6100 (shrink-window-if-larger-than-buffer))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6101 (select-window ww)))))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6102
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6103 (defun idlwave-insert-source-location (prefix entry &optional file-props)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6104 "Insert a source location into the routine info buffer.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6105 Start line with PREFIX.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6106 If a file name is inserted, add FILE-PROPS to it."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6107
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6108 (let* ((key (car entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6109 (file (nth 1 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6110 (types (nth 2 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6111 (shell-flag (member 'compiled types))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6112 (buffer-flag (member 'buffer types))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6113 (lib-flag (member 'lib types))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6114 (ndupl (or (and buffer-flag (idlwave-count-eq 'buffer types))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6115 (and lib-flag (idlwave-count-eq 'lib types))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6116 1))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6117 (doflags t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6118 beg special)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6119
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6120 (insert prefix)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6121
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6122 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6123 ((eq key 'system)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6124 (setq doflags nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6125 (insert "System "))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6126 ((eq key 'builtin)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6127 (setq doflags nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6128 (insert "Builtin "))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6129 ((and (not file) shell-flag)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6130 (insert "Unresolved"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6131 ((null file) (insert "ERROR"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6132 ((setq special (idlwave-special-lib-test file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6133 (insert (format "%-10s" special)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6134 ((idlwave-syslib-p file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6135 (if (string-match "obsolete" (file-name-directory file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6136 (insert "Obsolete ")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6137 (insert "SystemLib ")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6138 ((idlwave-lib-p file) (insert "Library "))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6139 (t (insert "Other ")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6140
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6141 (when doflags
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6142 (insert (concat
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6143 " ["
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6144 (if lib-flag "C" "-")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6145 (if shell-flag "S" "-")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6146 (if buffer-flag "B" "-")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6147 "] ")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6148 (when (> ndupl 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6149 (setq beg (point))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6150 (insert (format "(%dx) " ndupl))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6151 (add-text-properties beg (point) (list 'face 'bold)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6152 (when (and file (not (equal file "")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6153 (setq beg (point))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6154 (insert (apply 'abbreviate-file-name
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6155 (if (featurep 'xemacs) (list file t) (list file))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6156 (if file-props
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6157 (add-text-properties beg (point) file-props)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6158
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6159 (defun idlwave-special-lib-test (file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6160 "Check the path of FILE against the regexps which define special libs.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6161 Return the name of the special lib if there is a match."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6162 (let ((alist idlwave-special-lib-alist)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6163 entry rtn)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6164 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6165 ((stringp file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6166 (while (setq entry (pop alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6167 (if (string-match (car entry) file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6168 (setq rtn (cdr entry)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6169 alist nil)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6170 rtn)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6171 (t nil))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6172
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6173 (defun idlwave-mouse-active-rinfo-right (ev)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6174 (interactive "e")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6175 (idlwave-mouse-active-rinfo ev 'right))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6176
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6177 (defun idlwave-mouse-active-rinfo-shift (ev)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6178 (interactive "e")
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6179 (idlwave-mouse-active-rinfo ev nil 'shift))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6180
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6181 (defun idlwave-active-rinfo-space ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6182 (interactive)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6183 (idlwave-mouse-active-rinfo nil 'right))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6184
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6185 (defun idlwave-mouse-active-rinfo (ev &optional right shift)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6186 "Does the mouse actions in the routine info buffer.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6187 Optional args RIGHT and SHIFT indicate, if mouse-3 was used, and if SHIFT
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6188 was pressed."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6189 (interactive "e")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6190 (if ev (mouse-set-point ev))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6191 (let (data id name type class buf keyword bufwin source)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6192 (setq data (get-text-property (point) 'data)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6193 source (get-text-property (point) 'source)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6194 keyword (get-text-property (point) 'keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6195 id (car data)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6196 name (nth 1 data) type (nth 2 data) class (nth 3 data)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6197 buf (nth 4 data)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6198 bufwin (get-buffer-window buf t))
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6199 (cond ((eq id 'usage)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6200 (idlwave-require-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6201 (idlwave-online-help nil name type class))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6202 ((eq id 'source)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6203 (if (and right (idlwave-help-directory))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6204 (let ((idlwave-extra-help-function 'idlwave-help-with-source)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6205 (idlwave-help-source-try-header nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6206 ;; Fake idlwave-routines, to make help find the right entry
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6207 (idlwave-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6208 (list (list (nth 1 data) (nth 2 data) (nth 3 data) source ""))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6209 (idlwave-require-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6210 (idlwave-help-get-special-help name type class nil))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6211 (setq idlwave-popup-source (not idlwave-popup-source))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6212 (if idlwave-popup-source
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6213 (condition-case err
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6214 (idlwave-do-find-module name type class source)
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6215 (error
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6216 (setq idlwave-popup-source nil)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6217 (if (window-live-p bufwin) (select-window bufwin))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6218 (error (nth 1 err))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6219 (if bufwin
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6220 (select-window bufwin)
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6221 (pop-to-buffer buf))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6222 (goto-char (marker-position idlwave-rinfo-marker)))))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6223 ((eq id 'keyword)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6224 (if right
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6225 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6226 (idlwave-require-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6227 (idlwave-online-help nil name type class keyword))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6228 (idlwave-rinfo-insert-keyword keyword buf shift))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6229
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6230 (defun idlwave-rinfo-insert-keyword (keyword buffer &optional shift)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6231 "Insert KEYWORD in BUFFER. Make sure buffer is displayed in a window."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6232 (let ((bwin (get-buffer-window buffer)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6233 (if idlwave-complete-empty-string-as-lower-case
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6234 (setq keyword (downcase keyword)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6235 (if bwin
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6236 (select-window bwin)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6237 (pop-to-buffer buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6238 (setq bwin (get-buffer-window buffer)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6239 (if (eq (preceding-char) ?/)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6240 (insert keyword)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6241 (unless (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6242 (re-search-backward
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6243 "[(,][ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\)?[ \t]*\\="
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6244 (min (- (point) 100) (point-min)) t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6245 (insert ", "))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6246 (if shift (insert "/"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6247 (insert keyword)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6248 (if (and (not shift)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6249 idlwave-keyword-completion-adds-equal)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6250 (insert "=")))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6251
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6252 (defun idlwave-list-buffer-load-path-shadows (&optional arg)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6253 "List the load path shadows of all routines defined in current buffer."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6254 (interactive "P")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6255 (idlwave-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6256 (if (eq major-mode 'idlwave-mode)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6257 (idlwave-list-load-path-shadows
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6258 nil (idlwave-update-current-buffer-info 'save-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6259 "in current buffer")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6260 (error "Current buffer is not in idlwave-mode")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6261
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6262 (defun idlwave-list-shell-load-path-shadows (&optional arg)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6263 "List the load path shadows of all routines compiled under the shell.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6264 This is very useful for checking an IDL application. Just compile the
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6265 application, do RESOLVE_ALL, and `C-c C-i' to compile all referenced
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6266 routines and update IDLWAVE internal info. Then check for shadowing
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6267 with this command."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6268 (interactive "P")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6269 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6270 ((or (not (fboundp 'idlwave-shell-is-running))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6271 (not (idlwave-shell-is-running)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6272 (error "Shell is not running"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6273 ((null idlwave-compiled-routines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6274 (error "No compiled routines. Maybe you need to update with `C-c C-i'."))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6275 (t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6276 (idlwave-list-load-path-shadows nil idlwave-compiled-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6277 "in the shell"))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6278
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6279 (defun idlwave-list-all-load-path-shadows (&optional arg)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6280 "List the load path shadows of all routines known to IDLWAVE."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6281 (interactive "P")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6282 (idlwave-list-load-path-shadows nil nil "globally"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6283
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6284 (defun idlwave-list-load-path-shadows (arg &optional special-routines loc)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6285 "List the routines which are defined multiple times.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6286 Search the information IDLWAVE has about IDL routines for multiple
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6287 definitions.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6288 When SPECIAL-ROUTINES in non-nil, only look for shadows of these routines.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6289
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6290 When IDL hits a routine call which is not defined, it will search on
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6291 the load path in order to find a definition. The output of this
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6292 command can be used to detect possible name clashes during this process."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6293 (idlwave-routines) ; Make sure everything is loaded.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6294 (unless idlwave-library-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6295 (or (y-or-n-p
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6296 "You don't have a library catalog. Continue anyway? ")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6297 (error "Abort")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6298 (let* ((routines (append idlwave-system-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6299 idlwave-compiled-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6300 idlwave-library-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6301 idlwave-buffer-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6302 nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6303 (km-prop (if (featurep 'xemacs) 'keymap 'local-map))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6304 (keymap (make-sparse-keymap))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6305 (props (list 'mouse-face 'highlight
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6306 km-prop keymap
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6307 'help-echo "Mouse2: Find source"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6308 (nroutines (length (or special-routines routines)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6309 (step (/ nroutines 99))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6310 (n 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6311 (next-perc 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6312 (cnt 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6313 (idlwave-sort-prefer-buffer-info nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6314 routine twins dtwins twin done props1 lroutines)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6315
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6316 (if special-routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6317 ;; Just looking for shadows of a few special routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6318 (setq lroutines routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6319 routines special-routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6320
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6321 (message "Sorting routines...")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6322 (setq routines (sort routines
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6323 (lambda (a b)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6324 (string< (downcase (idlwave-make-full-name
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6325 (nth 2 a) (car a)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6326 (downcase (idlwave-make-full-name
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6327 (nth 2 b) (car b)))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6328 (message "Sorting routines...done")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6329
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6330 (define-key keymap (if (featurep 'xemacs) [(button2)] [(mouse-2)])
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6331 (lambda (ev)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6332 (interactive "e")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6333 (mouse-set-point ev)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6334 (apply 'idlwave-do-find-module
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6335 (get-text-property (point) 'find-args))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6336 (define-key keymap [(return)]
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6337 (lambda ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6338 (interactive)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6339 (apply 'idlwave-do-find-module
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6340 (get-text-property (point) 'find-args))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6341 (message "Compiling list...( 0%%)")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6342 (save-excursion
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6343 (set-buffer (get-buffer-create "*Shadows*"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6344 (setq buffer-read-only nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6345 (erase-buffer)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6346 (while (setq routine (pop routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6347 (setq n (1+ n))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6348 (if (= (* next-perc step) n)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6349 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6350 (message "Compiling list...(%2d%%)" next-perc)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6351 (setq next-perc (1+ next-perc))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6352 ;; Get a list of all twins
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6353 (setq twins (idlwave-routine-twins routine (or lroutines routines)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6354 (if (memq routine done)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6355 (setq dtwins nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6356 (setq dtwins (idlwave-study-twins twins)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6357 ;; Mark all twins as delt with
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6358 (setq done (append twins done))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6359 (when (or (> (length dtwins) 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6360 (> (idlwave-count-eq 'lib (nth 2 (car dtwins))) 1)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6361 (> (idlwave-count-eq 'buffer (nth 2 (car dtwins))) 1))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6362 (incf cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6363 (insert (format "\n%s%s"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6364 (idlwave-make-full-name (nth 2 routine) (car routine))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6365 (if (eq (nth 1 routine) 'fun) "()" "")))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6366 (while (setq twin (pop dtwins))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6367 (setq props1 (append (list 'find-args
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6368 (list (nth 0 routine)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6369 (nth 1 routine)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6370 (nth 2 routine)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6371 (cons 'lib (nth 1 twin))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6372 props))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6373 (idlwave-insert-source-location "\n - " twin props1))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6374 (goto-char (point-min))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6375 (setq buffer-read-only t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6376 (setq loc (or loc ""))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6377 (if (> cnt 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6378 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6379 (display-buffer (get-buffer "*Shadows*"))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6380 (message "%d case%s of shadowing found %s"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6381 cnt (if (= cnt 1) "" "s") loc))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6382 (message "No shadowing conflicts found %s" loc))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6383
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6384 (defun idlwave-print-source (routine)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6385 (let* ((source (nth 3 routine))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6386 (stype (car source))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6387 (sfile (cdr source)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6388 (if (and (eq stype 'lib) sfile)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6389 (progn
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6390 (setq sfile (idlwave-expand-lib-file-name sfile))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6391 (if (idlwave-syslib-p sfile) (setq stype 'syslib))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6392 (if (and (eq stype 'compiled)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6393 (or (not (stringp sfile))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6394 (not (string-match "\\S-" sfile))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6395 (setq stype 'unresolved))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6396 (princ (format " %-10s %s\n"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6397 stype
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6398 (if sfile sfile "No source code available")))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6399
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6400 (defun idlwave-routine-twins (entry &optional list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6401 "Return all twin entries of ENTRY in LIST.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6402 LIST defaults to `idlwave-routines'.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6403 Twin entries are those which have the same name, type, and class.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6404 ENTRY will also be returned, as the first item of this list."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6405 (let* ((name (car entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6406 (type (nth 1 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6407 (class (nth 2 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6408 (candidates (idlwave-all-assq name (or list (idlwave-routines))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6409 twins candidate)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6410 (while (setq candidate (pop candidates))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6411 (if (and (not (eq candidate entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6412 (eq type (nth 1 candidate))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6413 (eq class (nth 2 candidate)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6414 (push candidate twins)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6415 (if (setq candidate (idlwave-rinfo-assq name type class
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6416 idlwave-unresolved-routines))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6417 (push candidate twins))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6418 (cons entry (nreverse twins))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6419
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6420 (defun idlwave-study-twins (entries)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6421 "Return dangerous twins of first entry in TWINS.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6422 Dangerous twins are routines with same name, but in different files
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6423 on the load path.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6424 If a file is in the system library and has an entry in the
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6425 `idlwave-system-routines' list, we omit the latter because many IDL
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6426 routines are implemented as library routines."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6427 (let* ((entry (car entries))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6428 (name (car entry)) ;
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6429 (type (nth 1 entry)) ; Must be bound for
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6430 (class (nth 2 entry)) ; idlwave-routine-twin-compare
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6431 (cnt 0)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6432 source type file thefile alist syslibp key)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6433 (while (setq entry (pop entries))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6434 (incf cnt)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6435 (setq source (nth 3 entry)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6436 type (car source)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6437 file (cdr source))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6438 (if (eq type 'lib)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6439 (setq file (idlwave-expand-lib-file-name file)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6440 ;; Make KEY to index entry properly
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6441 (setq key (cond ((eq type 'system) type)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6442 (file (file-truename file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6443 (t 'unresolved)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6444 (if (and file
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6445 (not syslibp)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6446 (idlwave-syslib-p file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6447 ;; We do have an entry in the system library
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6448 (setq syslibp t))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6449
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6450 (setq thefile (or thefile file))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6451 (if (setq entry (assoc key alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6452 (push type (nth 2 entry))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6453 (push (list key file (list type)) alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6454
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6455 (setq alist (nreverse alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6456
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6457 (when syslibp
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6458 ;; File is system *library* - remove any system entry
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6459 (setq alist (delq (assoc 'system alist) alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6460
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6461 (when (and (idlwave-syslib-scanned-p)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6462 (setq entry (assoc 'system alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6463 (setcar entry 'builtin))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6464 (sort alist 'idlwave-routine-twin-compare)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6465
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6466 (defvar name)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6467 (defvar type)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6468 (defvar class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6469 (defvar idlwave-sort-prefer-buffer-info t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6470 "Internal variable used to influence `idlwave-routine-twin-compare'.")
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6471
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6472 (defmacro idlwave-xor (a b)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6473 `(and (or ,a ,b)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6474 (not (and ,a ,b))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6475
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6476 (defun idlwave-routine-entry-compare (a b)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6477 "Compare two routine info entries for sortiung. This is the general case.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6478 It first compates class, names, and type. If it turns out that A and B
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6479 are twins (same name, class, and type), calls another routine which
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6480 compares twins on the basis of their file names and path locations."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6481 (let ((name (car a)) (type (nth 1 a)) (class (nth 2 a)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6482 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6483 ((not (equal (idlwave-downcase-safe class)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6484 (idlwave-downcase-safe (nth 2 b))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6485 ;; Class decides
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6486 (cond ((null (nth 2 b)) nil)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6487 ((null class) t)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6488 (t (string< (downcase class) (downcase (nth 2 b))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6489 ((not (equal (downcase name) (downcase (car b))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6490 ;; Name decides
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6491 (string< (downcase name) (downcase (car b))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6492 ((not (eq type (nth 1 b)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6493 ;; Type decides
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6494 (< (if (eq type 'fun) 1 0) (if (eq (nth 1 b) 'fun) 1 0)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6495 (t
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6496 ;; A and B are twins - so the decision is more complicated.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6497 ;; Call twin-compare with the proper arguments.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6498 (idlwave-routine-entry-compare-twins a b)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6499
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6500 (defun idlwave-routine-entry-compare-twins (a b)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6501 "Compare two routine entries, under the assumption that they are twins.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6502 This basically calles `idlwave-routine-twin-compare' with the correct args."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6503 (let ((name (car a)) (type (nth 1 a)) (class (nth 2 a)) ; needed outside
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6504 (atype (car (nth 3 a)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6505 (btype (car (nth 3 b)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6506 (afile (cdr (nth 3 a)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6507 (bfile (cdr (nth 3 b))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6508 (if (eq atype 'lib)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6509 (setq afile (idlwave-expand-lib-file-name afile)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6510 (if (eq btype 'lib)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6511 (setq bfile (idlwave-expand-lib-file-name bfile)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6512 (idlwave-routine-twin-compare
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6513 (if (stringp afile)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6514 (list (file-truename afile) afile (list atype))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6515 (list atype afile (list atype)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6516 (if (stringp bfile)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6517 (list (file-truename bfile) bfile (list btype))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6518 (list btype bfile (list btype))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6519 ))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6520
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6521 (defun idlwave-routine-twin-compare (a b)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6522 "Compare two routine twin entries for sorting.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6523 In here, A and B are not normal routine info entries, but special
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6524 lists (KEY FILENAME (TYPES...)).
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6525 This expects NAME TYPE CLASS to be bound to the right values."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6526 (let* (;; Dis-assemble entries
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6527 (akey (car a)) (bkey (car b))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6528 (afile (nth 1 a)) (bfile (nth 1 b))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6529 (atypes (nth 2 a)) (btypes (nth 2 b))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6530 ;; System routines?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6531 (asysp (memq akey '(builtin system)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6532 (bsysp (memq bkey '(builtin system)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6533 ;; Compiled routines?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6534 (acompp (memq 'compiled atypes))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6535 (bcompp (memq 'compiled btypes))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6536 ;; Unresolved?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6537 (aunresp (or (eq akey 'unresolved)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6538 (and acompp (not afile))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6539 (bunresp (or (eq bkey 'unresolved)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6540 (and bcompp (not bfile))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6541 ;; Buffer info available?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6542 (abufp (memq 'buffer atypes))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6543 (bbufp (memq 'buffer btypes))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6544 ;; On search path?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6545 (tpath-alist (idlwave-true-path-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6546 (apathp (assoc akey tpath-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6547 (bpathp (assoc bkey tpath-alist))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6548 ;; How early on search path? High number means early since we
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6549 ;; measure the tail of the path list
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6550 (anpath (length (memq apathp tpath-alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6551 (bnpath (length (memq bpathp tpath-alist)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6552 ;; Look at file names
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6553 (aname (if (stringp afile) (downcase (file-name-nondirectory afile)) ""))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6554 (bname (if (stringp bfile) (downcase (file-name-nondirectory bfile)) ""))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6555 (fname-re (if class (format "\\`%s__\\(%s\\|define\\)\\.pro\\'"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6556 (regexp-quote (downcase class))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6557 (regexp-quote (downcase name)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6558 (format "\\`%s\\.pro" (regexp-quote (downcase name)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6559 ;; Is file name derived from the routine name?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6560 ;; Method file or class definition file?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6561 (anamep (string-match fname-re aname))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6562 (adefp (and class anamep (string= "define" (match-string 1 aname))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6563 (bnamep (string-match fname-re bname))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6564 (bdefp (and class bnamep (string= "define" (match-string 1 bname)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6565
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6566 ;; Now: follow JD's ideas about sorting. Looks really simple now,
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6567 ;; doesn't it? The difficult stuff is hidden above...
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6568 (cond
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6569 ((idlwave-xor asysp bsysp) asysp) ; System entries first
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6570 ((idlwave-xor aunresp bunresp) bunresp) ; Unresolved last
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6571 ((and idlwave-sort-prefer-buffer-info
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6572 (idlwave-xor abufp bbufp)) abufp) ; Buffers before non-buffers
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6573 ((idlwave-xor acompp bcompp) acompp) ; Compiled entries
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6574 ((idlwave-xor apathp bpathp) apathp) ; Library before non-library
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6575 ((idlwave-xor anamep bnamep) anamep) ; Correct file names first
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6576 ((and class anamep bnamep ; both file names match ->
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6577 (idlwave-xor adefp bdefp)) bdefp) ; __define after __method
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6578 ((> anpath bnpath) t) ; Who is first on path?
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6579 (t nil)))) ; Default
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6580
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6581 (defun idlwave-downcase-safe (string)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6582 "Donwcase if string, else return unchanged."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6583 (if (stringp string)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6584 (downcase string)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6585 string))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6586
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6587 (defun idlwave-count-eq (elt list)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6588 "How often is ELT in LIST?"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6589 (length (delq nil (mapcar (lambda (x) (eq x elt)) list))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6590
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6591 (defun idlwave-syslib-p (file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6592 "Non-nil of FILE is in the system library."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6593 (let* ((true-syslib (file-name-as-directory
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6594 (file-truename
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6595 (expand-file-name "lib" (idlwave-sys-dir)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6596 (true-file (file-truename file)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6597 (string-match (concat "^" (regexp-quote true-syslib)) true-file)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6598
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6599 (defun idlwave-lib-p (file)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6600 "Non-nil if file is in the library"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6601 (let ((true-dir (file-name-directory (file-truename file))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6602 (assoc true-dir (idlwave-true-path-alist))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6603
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6604 (defun idlwave-true-path-alist ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6605 "Return `idlwave-path-alist' alist with true-names.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6606 Info is cached, but relies on the functons setting `idlwave-path-alist'
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6607 to reset the variable `idlwave-true-path-alist' to nil."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6608 (or idlwave-true-path-alist
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6609 (setq idlwave-true-path-alist
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6610 (mapcar (lambda(x) (cons
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6611 (file-name-as-directory
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6612 (file-truename
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6613 (directory-file-name
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6614 (car x))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6615 (cdr x)))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6616 idlwave-path-alist))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6617
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6618 (defun idlwave-syslib-scanned-p ()
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6619 "Non-nil if the system lib file !DIR/lib has been scanned."
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6620 (let* ((true-syslib (file-name-as-directory
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6621 (file-truename
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6622 (expand-file-name "lib" (idlwave-sys-dir))))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6623 (cdr (assoc true-syslib (idlwave-true-path-alist)))))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6624
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6625 ;; ----------------------------------------------------------------------------
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6626 ;;
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6627 ;; Online Help display
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6628
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6629
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6630 ;; ----------------------------------------------------------------------------
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6631 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6632 ;; Additions for use with imenu.el and func-menu.el
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6633 ;; (pop-up a list of IDL units in the current file).
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6634 ;;
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6635
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6636 (defun idlwave-prev-index-position ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6637 "Search for the previous procedure or function.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6638 Return nil if not found. For use with imenu.el."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6639 (save-match-data
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6640 (cond
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6641 ((idlwave-find-key "\\<\\(pro\\|function\\)\\>" -1 'nomark))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6642 ;; ((idlwave-find-key idlwave-begin-unit-reg 1 'nomark)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6643 (t nil))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6644
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6645 (defun idlwave-unit-name ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6646 "Return the unit name.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6647 Assumes that point is at the beginning of the unit as found by
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6648 `idlwave-prev-index-position'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6649 (forward-sexp 2)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6650 (forward-sexp -1)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6651 (let ((begin (point)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6652 (re-search-forward "[a-zA-Z][a-zA-Z0-9$_]+\\(::[a-zA-Z][a-zA-Z0-9$_]+\\)?")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6653 (if (fboundp 'buffer-substring-no-properties)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6654 (buffer-substring-no-properties begin (point))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6655 (buffer-substring begin (point)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6656
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6657 (defun idlwave-function-menu ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6658 "Use `imenu' or `function-menu' to jump to a procedure or function."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6659 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6660 (if (string-match "XEmacs" emacs-version)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6661 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6662 (require 'func-menu)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6663 (function-menu))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6664 (require 'imenu)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6665 (imenu (imenu-choose-buffer-index))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6666
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6667 ;; Here we kack func-menu.el in order to support this new mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6668 ;; The latest versions of func-menu.el already have this stuff in, so
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6669 ;; we hack only if it is not already there.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6670 (when (fboundp 'eval-after-load)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6671 (eval-after-load "func-menu"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6672 '(progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6673 (or (assq 'idlwave-mode fume-function-name-regexp-alist)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6674 (not (boundp 'fume-function-name-regexp-idl)) ; avoid problems
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6675 (setq fume-function-name-regexp-alist
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6676 (cons '(idlwave-mode . fume-function-name-regexp-idl)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6677 fume-function-name-regexp-alist)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6678 (or (assq 'idlwave-mode fume-find-function-name-method-alist)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6679 (not (fboundp 'fume-find-next-idl-function-name)) ; avoid problems
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6680 (setq fume-find-function-name-method-alist
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6681 (cons '(idlwave-mode . fume-find-next-idl-function-name)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6682 fume-find-function-name-method-alist))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6683
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6684 (defun idlwave-edit-in-idlde ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6685 "Edit the current file in IDL Development environment."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6686 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6687 (start-process "idldeclient" nil
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6688 idlwave-shell-explicit-file-name "-c" "-e"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6689 (buffer-file-name) "&"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6690
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6691 (defun idlwave-launch-idlhelp ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6692 "Start the IDLhelp application."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6693 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6694 (start-process "idlhelp" nil idlwave-help-application))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6695
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6696 ;; Menus - using easymenu.el
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6697 (defvar idlwave-mode-menu-def
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6698 `("IDLWAVE"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6699 ["PRO/FUNC menu" idlwave-function-menu t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6700 ("Motion"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6701 ["Subprogram Start" idlwave-beginning-of-subprogram t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6702 ["Subprogram End" idlwave-end-of-subprogram t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6703 ["Block Start" idlwave-beginning-of-block t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6704 ["Block End" idlwave-end-of-block t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6705 ["Up Block" idlwave-backward-up-block t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6706 ["Down Block" idlwave-down-block t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6707 ["Skip Block Backward" idlwave-backward-block t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6708 ["Skip Block Forward" idlwave-forward-block t])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6709 ("Mark"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6710 ["Subprogram" idlwave-mark-subprogram t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6711 ["Block" idlwave-mark-block t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6712 ["Header" idlwave-mark-doclib t])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6713 ("Format"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6714 ["Indent Subprogram" idlwave-indent-subprogram t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6715 ["(Un)Comment Region" idlwave-toggle-comment-region "C-c ;"]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6716 ["Continue/Split line" idlwave-split-line t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6717 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6718 ["Toggle Auto Fill" idlwave-auto-fill-mode :style toggle
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6719 :selected (symbol-value idlwave-fill-function)])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6720 ("Templates"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6721 ["Procedure" idlwave-procedure t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6722 ["Function" idlwave-function t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6723 ["Doc Header" idlwave-doc-header t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6724 ["Log" idlwave-doc-modification t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6725 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6726 ["Case" idlwave-case t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6727 ["For" idlwave-for t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6728 ["Repeat" idlwave-repeat t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6729 ["While" idlwave-while t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6730 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6731 ["Close Block" idlwave-close-block t])
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6732 ("Completion"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6733 ["Complete" idlwave-complete t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6734 ("Complete Special"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6735 ["1 Procedure Name" (idlwave-complete 'procedure) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6736 ["2 Procedure Keyword" (idlwave-complete 'procedure-keyword) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6737 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6738 ["3 Function Name" (idlwave-complete 'function) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6739 ["4 Function Keyword" (idlwave-complete 'function-keyword) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6740 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6741 ["5 Procedure Method Name" (idlwave-complete 'procedure-method) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6742 ["6 Procedure Method Keyword" (idlwave-complete 'procedure-method-keyword) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6743 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6744 ["7 Function Method Name" (idlwave-complete 'function-method) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6745 ["8 Function Method Keyword" (idlwave-complete 'function-method-keyword) t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6746 "--"
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6747 ["9 Class Name" idlwave-complete-class t]))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6748 ("Routine Info"
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6749 ["Show Routine Info" idlwave-routine-info t]
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6750 ["Online Context Help" idlwave-context-help (idlwave-help-directory)]
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6751 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6752 ["Find Routine Source" idlwave-find-module t]
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6753 ["Resolve Routine" idlwave-resolve (featurep 'idlw-shell)]
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6754 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6755 ["Update Routine Info" idlwave-update-routine-info t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6756 "--"
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6757 "IDL Library Catalog"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6758 ["Select Catalog Directories" idlwave-create-libinfo-file t]
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6759 ["Scan Directories" (idlwave-update-routine-info '(16))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6760 idlwave-path-alist]
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6761 "--"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6762 "Routine Shadows"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6763 ["Check Current Buffer" idlwave-list-buffer-load-path-shadows t]
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6764 ["Check Compiled Routines" idlwave-list-shell-load-path-shadows t]
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6765 ["Check Everything" idlwave-list-all-load-path-shadows t])
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6766 ("Misc"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6767 ["Kill auto-created buffers" idlwave-kill-autoloaded-buffers t]
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6768 "--"
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6769 ["Insert TAB character" idlwave-hard-tab t])
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6770 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6771 ("External"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6772 ["Generate IDL tags" idlwave-make-tags t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6773 ["Start IDL shell" idlwave-shell t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6774 ["Edit file in IDLDE" idlwave-edit-in-idlde t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6775 ["Launch IDL Help" idlwave-launch-idlhelp t])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6776 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6777 ("Customize"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6778 ["Browse IDLWAVE Group" idlwave-customize t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6779 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6780 ["Build Full Customize Menu" idlwave-create-customize-menu
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6781 (fboundp 'customize-menu-create)])
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6782 ("Documentation"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6783 ["Describe Mode" describe-mode t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6784 ["Abbreviation List" idlwave-list-abbrevs t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6785 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6786 ["Commentary in idlwave.el" idlwave-show-commentary t]
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
6787 ["Commentary in idlw-shell.el" idlwave-shell-show-commentary t]
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6788 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6789 ["Info" idlwave-info t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6790 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6791 ["Launch IDL Help" idlwave-launch-idlhelp t])))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6792
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6793 (defvar idlwave-mode-debug-menu-def
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6794 '("Debug"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6795 ["Start IDL shell" idlwave-shell t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6796 ["Save and .RUN buffer" idlwave-shell-save-and-run
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6797 (and (boundp 'idlwave-shell-automatic-start)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6798 idlwave-shell-automatic-start)]))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6799
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6800 (if (or (featurep 'easymenu) (load "easymenu" t))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6801 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6802 (easy-menu-define idlwave-mode-menu idlwave-mode-map
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6803 "IDL and WAVE CL editing menu"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6804 idlwave-mode-menu-def)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6805 (easy-menu-define idlwave-mode-debug-menu idlwave-mode-map
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6806 "IDL and WAVE CL editing menu"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6807 idlwave-mode-debug-menu-def)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6808
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6809 (defun idlwave-customize ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6810 "Call the customize function with idlwave as argument."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6811 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6812 ;; Try to load the code for the shell, so that we can customize it
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6813 ;; as well.
27185
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
6814 (or (featurep 'idlw-shell)
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
6815 (load "idlw-shell" t))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6816 (customize-browse 'idlwave))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6817
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6818 (defun idlwave-create-customize-menu ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6819 "Create a full customization menu for IDLWAVE, insert it into the menu."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6820 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6821 (if (fboundp 'customize-menu-create)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6822 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6823 ;; Try to load the code for the shell, so that we can customize it
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6824 ;; as well.
27185
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
6825 (or (featurep 'idlw-shell)
ae5b17b9c403 fixed some bugs associated with the new file names
Carsten Dominik <dominik@science.uva.nl>
parents: 27107
diff changeset
6826 (load "idlw-shell" t))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6827 (easy-menu-change
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6828 '("IDLWAVE") "Customize"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6829 `(["Browse IDLWAVE group" idlwave-customize t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6830 "--"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6831 ,(customize-menu-create 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6832 ["Set" Custom-set t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6833 ["Save" Custom-save t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6834 ["Reset to Current" Custom-reset-current t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6835 ["Reset to Saved" Custom-reset-saved t]
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6836 ["Reset to Standard Settings" Custom-reset-standard t]))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6837 (message "\"IDLWAVE\"-menu now contains full customization menu"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6838 (error "Cannot expand menu (outdated version of cus-edit.el)")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6839
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6840 (defun idlwave-show-commentary ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6841 "Use the finder to view the file documentation from `idlwave.el'."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6842 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6843 (require 'finder)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6844 (finder-commentary "idlwave.el"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6845
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6846 (defun idlwave-shell-show-commentary ()
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
6847 "Use the finder to view the file documentation from `idlw-shell.el'."
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6848 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6849 (require 'finder)
27606
0396e9e8d57b (idlwave-template): Respect `idlwave-abbrev-change-case'.
Carsten Dominik <dominik@science.uva.nl>
parents: 27185
diff changeset
6850 (finder-commentary "idlw-shell.el"))
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6851
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6852 (defun idlwave-info ()
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6853 "Read documentation for IDLWAVE in the info system."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6854 (interactive)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6855 (require 'info)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6856 (Info-goto-node "(idlwave)"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6857
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6858 (defun idlwave-list-abbrevs (arg)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6859 "Show the code abbreviations define in IDLWAVE mode.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6860 This lists all abbrevs where the replacement text differs from the input text.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6861 These are the ones the users want to learn to speed up their writing.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6862
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6863 The function does *not* list abbrevs which replace a word with itself
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6864 to call a hook. These hooks are used to change the case of words or
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6865 to blink the matching `begin', and the user does not need to know them.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6866
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6867 With arg, list all abbrevs with the corresponding hook.
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6868
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6869 This function was written since `list-abbrevs' looks terrible for IDLWAVE mode."
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6870
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6871 (interactive "P")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6872 (let ((table (symbol-value 'idlwave-mode-abbrev-table))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6873 abbrevs
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6874 str rpl func fmt (len-str 0) (len-rpl 0))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6875 (mapatoms
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6876 (lambda (sym)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6877 (if (symbol-value sym)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6878 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6879 (setq str (symbol-name sym)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6880 rpl (symbol-value sym)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6881 func (symbol-function sym))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6882 (if arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6883 (setq func (prin1-to-string func))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6884 (if (and (listp func) (stringp (nth 2 func)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6885 (setq rpl (concat "EVAL: " (nth 2 func))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6886 func "")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6887 (setq func "")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6888 (if (or arg (not (string= rpl str)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6889 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6890 (setq len-str (max len-str (length str)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6891 (setq len-rpl (max len-rpl (length rpl)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6892 (setq abbrevs (cons (list str rpl func) abbrevs)))))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6893 table)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6894 ;; sort the list
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6895 (setq abbrevs (sort abbrevs (lambda (a b) (string< (car a) (car b)))))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6896 ;; Make the format
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6897 (setq fmt (format "%%-%ds %%-%ds %%s\n" len-str len-rpl))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6898 (with-output-to-temp-buffer "*Help*"
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6899 (if arg
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6900 (progn
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6901 (princ "Abbreviations and Actions in IDLWAVE-Mode\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6902 (princ "=========================================\n\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6903 (princ (format fmt "KEY" "REPLACE" "HOOK"))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6904 (princ (format fmt "---" "-------" "----")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6905 (princ "Code Abbreviations and Templates in IDLWAVE-Mode\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6906 (princ "================================================\n\n")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6907 (princ (format fmt "KEY" "ACTION" ""))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6908 (princ (format fmt "---" "------" "")))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6909 (mapcar
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6910 (lambda (list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6911 (setq str (car list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6912 rpl (nth 1 list)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6913 func (nth 2 list))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6914 (princ (format fmt str rpl func)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6915 abbrevs)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6916 ;; Make sure each abbreviation uses only one display line
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6917 (save-excursion
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6918 (set-buffer "*Help*")
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6919 (setq truncate-lines t)))
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6920
29774
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6921 ;; Try to load online help, but catch any errors.
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6922 (condition-case nil
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6923 (idlwave-require-online-help)
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6924 (error nil))
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6925
8eff9cc9cbae Files re-installed, because changes are too massive to document them here.
Carsten Dominik <dominik@science.uva.nl>
parents: 27606
diff changeset
6926 ;; Run the hook
26956
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6927 (run-hooks 'idlwave-load-hook)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6928
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6929 (provide 'idlwave)
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6930
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6931 ;;; idlwave.el ends here
67b3331ff24c Major mode for editing files of the Interactive Data Language
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6932