Mercurial > emacs
annotate lisp/progmodes/idlw-complete-structtag.el @ 98007:883843ca3292
* verilog-mode.el (verilog-library-extensions): Enable .sv
filename extensions to call verilog-mode.
(verilog-auto, verilog-auto-inst, verilog-faq)
(verilog-submit-bug-report): Update author support URLs.
(verilog-delete-auto, verilog-auto-inout-module)
(verilog-auto-inout-comp, verilog-auto): Add AUTOINOUTCOMP for
creating complemented testbench modules. Suggested by Yishay
Belkind.
(verilog-auto-inst-port, verilog-simplify-range-expression): When
verilog-auto-inst-param-value is set, don't require a
AUTO_TEMPLATE to expand parameter substitutions. Suggested by
Yishay Belkind.
(verilog-auto-inst-param-value): Add safe variable.
(verilog-re-search-forward, verilog-re-search-backward): Fix
returning wrong search results on Emacs 22.1.
(verilog-modi-cache-results, verilog-auto): Fix warning message
about "toggling font-lock-mode."
(verilog-auto): Fix loosing font-lock on errors.
(verilog-auto-inst-param-value, verilog-mode-version)
(verilog-mode-version-date, verilog-read-inst-param-value)
(verilog-auto-inst, verilog-auto-inst-param)
(verilog-auto-inst-port, verilog-simplify-range-expression): Allow
parameters to be replaced with their values, on the expansion of
an AUTOINST with Verilog 2001 style parameter settings. Suggested
by David Rogoff.
* verilog-mode.el (verilog-beg-block-re-ordered, verilog-calc-1):
Better support for the property statement. Sometimes this keyword
introduces a statement which requires an endproperty keyword, and
sometimes it doesn't, dependening on the work before the property
word. If property is prefixed with assert, assume or cover
keyword, then the statement is ended with a ';' Otherwise,
property is like task or specify, and is followed by some number
of statements, which are ended with an endproperty keyword.
(electric-verilog-tab): Support Emacs 22.2 style handling of tab
in a highlighted region: indent each line in region according to
mode. Supply this so it works in XEmacs and older Emacs.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 05 Sep 2008 22:13:55 +0000 |
parents | 52b7a8c22af5 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
1 ;;; idlw-complete-structtag.el --- Completion of structure tags. |
75347 | 2 |
79717 | 3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
75347 | 4 ;; Free Software Foundation, Inc. |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
5 |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
6 ;; Author: Carsten Dominik <dominik@astro.uva.nl> |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
7 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
8 ;; Version: 1.2 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
9 ;; Keywords: languages |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
10 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
12 |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
16 ;; (at your option) any later version. |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
17 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
21 ;; GNU General Public License for more details. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
22 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
25 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
26 ;;; Commentary: |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
27 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
28 ;; Completion of structure tags can be done automatically in the |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
29 ;; shell, since the list of tags can be determined dynamically through |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
30 ;; interaction with IDL. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
31 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
32 ;; Completion of structure tags in a source buffer is highly ambiguous |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
33 ;; since you never know what kind of structure a variable will hold at |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
34 ;; runtime. To make this feature useful in source buffers, we need a |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
35 ;; special assumption/convention. We will assume that the structure is |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
36 ;; defined in the same buffer and directly assigned to the correct |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
37 ;; variable. This is mainly useful for applications in which there is one |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
38 ;; main structure which contains a large amount of information (and many |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
39 ;; tags). For example, many widget applications define a "state" structure |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
40 ;; that contains all important data about the application. The different |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
41 ;; routines called by the event handler then use this structure. If you |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
42 ;; use the same variable name for this structure throughout your |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
43 ;; application (a good idea for many reasons), IDLWAVE can support |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
44 ;; completion for its tags. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
45 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
46 ;; This file is a completion plugin which implements this kind of |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
47 ;; completion. It is also an example which shows how completion plugins |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
48 ;; should be programmed. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
49 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
50 ;; New versions of IDLWAVE, documentation, and more information available |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
51 ;; from: |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
52 ;; http://idlwave.org |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
53 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
54 ;; INSTALLATION |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
55 ;; ============ |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
56 ;; Put this file on the emacs load path and load it with the following |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
57 ;; line in your .emacs file: |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
58 ;; |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
59 ;; (add-hook 'idlwave-load-hook |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
60 ;; (lambda () (require 'idlw-complete-structtag))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
61 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
62 ;; DESCRIPTION |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
63 ;; =========== |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
64 ;; Suppose your IDL program contains something like |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
65 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
66 ;; myvar = state.a* |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
67 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
68 ;; where the star marks the cursor position. If you now press the |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
69 ;; completion key M-TAB, IDLWAVE searches the current file for a |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
70 ;; structure definition |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
71 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
72 ;; state = {tag1:val1, tag2:val2, ...} |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
73 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
74 ;; and offers the tags for completion. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
75 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
76 ;; In the idlwave shell, idlwave sends a "print,tag_names()" for the |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
77 ;; variable to idl and determines the current tag list dynamically. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
78 ;; |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
79 ;; Notes |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
80 ;; ----- |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
81 ;; - The structure definition assignment "state = {...}" must use the |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
82 ;; same variable name as the the completion location "state.*". |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
83 ;; - The structure definition must be in the same file. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
84 ;; - The structure definition is searched backwards and then forward |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
85 ;; from the current position, until a definition with tags is found. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
86 ;; - The file is parsed again for each new completion variable and location. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
87 ;; - You can force an update of the tag list with the usual command |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
88 ;; to update routine info in IDLWAVE: C-c C-i |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
89 |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
90 (require 'idlwave) |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
91 |
86503
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78234
diff
changeset
|
92 (declare-function idlwave-shell-buffer "idlw-shell") |
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78234
diff
changeset
|
93 |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
94 ;; Some variables to identify the previously used structure |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
95 (defvar idlwave-current-tags-var nil) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
96 (defvar idlwave-current-tags-buffer nil) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
97 (defvar idlwave-current-tags-completion-pos nil) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
98 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
99 ;; The tag list used for completion will be stored in the following vars |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
100 (defvar idlwave-current-struct-tags nil) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
101 (defvar idlwave-sint-structtags nil) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
102 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
103 ;; Create the sintern type for structure talks |
86869
212857b620d4
(idlwave-sintern-structtag): Fix declaration.
Glenn Morris <rgm@gnu.org>
parents:
86868
diff
changeset
|
104 (declare-function idlwave-sintern-structtag "idlw-complete-structtag" t t) |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
105 (idlwave-new-sintern-type 'structtag) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
106 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
107 ;; Hook the plugin into idlwave |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
108 (add-to-list 'idlwave-complete-special 'idlwave-complete-structure-tag) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
109 (add-hook 'idlwave-update-rinfo-hook 'idlwave-structtag-reset) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
110 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
111 ;;; The main code follows below |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
112 (defvar idlwave-completion-help-info) |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
113 (defun idlwave-complete-structure-tag () |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
114 "Complete a structure tag. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
115 This works by looking in the current file for a structure assignment to a |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
116 variable with the same name and takes the tags from there. Quite useful |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
117 for big structures like the state variables of a widget application. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
118 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
119 In the idlwave shell, the current content of the variable is used to get |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
120 an up-to-date completion list." |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
121 (interactive) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
122 (let ((pos (point)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
123 start |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
124 (case-fold-search t)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
125 (if (save-excursion |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
126 ;; Check if the context is right. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
127 ;; In the shell, this could be extended to expressions like |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
128 ;; x[i+4].name.g*. But it is complicated because we would have |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
129 ;; to really parse this expression. For now, we allow only |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
130 ;; substructures, like "aaa.bbb.ccc.ddd" |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
131 (skip-chars-backward "[a-zA-Z0-9._$]") |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
132 (setq start (point)) ;; remember the start of the completion pos. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
133 (and (< (point) pos) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
134 (not (equal (char-before) ?!)) ; no sysvars |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
135 (looking-at "\\([a-zA-Z][.a-zA-Z0-9_]*\\)\\.") |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
136 (>= pos (match-end 0)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
137 (not (string= (downcase (match-string 1)) "self")))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
138 (let* ((var (downcase (match-string 1)))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
139 ;; Check if we need to update the "current" structure. Basically we |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
140 ;; do it always, except for subsequent completions at the same |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
141 ;; spot, to save a bit of time. Implementation: We require |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
142 ;; an update if |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
143 ;; - the variable is different or |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
144 ;; - the buffer is different or |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
145 ;; - we are completing at a different position |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
146 (if (or (not (string= var (or idlwave-current-tags-var "@"))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
147 (not (eq (current-buffer) idlwave-current-tags-buffer)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
148 (not (equal start idlwave-current-tags-completion-pos))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
149 (idlwave-prepare-structure-tag-completion var)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
150 (setq idlwave-current-tags-completion-pos start) |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
151 (setq idlwave-completion-help-info |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
152 (list 'idlwave-complete-structure-tag-help)) |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
153 (idlwave-complete-in-buffer 'structtag 'structtag |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
154 idlwave-current-struct-tags nil |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
155 "Select a structure tag" "structure tag") |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
156 t) ; we did the completion: return t to skip other completions |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
157 nil))) ; return nil to allow looking for other ways to complete |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
158 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
159 (defun idlwave-structtag-reset () |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
160 "Force an update of the current structure tag list upon next use." |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
161 (setq idlwave-current-tags-buffer nil)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
162 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
163 (defvar idlwave-structtag-struct-location nil |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
164 "The location of the structure definition, for help display.") |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
165 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
166 (defun idlwave-prepare-structure-tag-completion (var) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
167 "Find and parse the tag list for structure tag completion." |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
168 ;; This works differently in source buffers and in the shell |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
169 (if (eq major-mode 'idlwave-shell-mode) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
170 ;; OK, we are in the shell, do it dynamically |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
171 (progn |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
172 (message "preparing shell tags") |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
173 ;; The following call puts the tags into `idlwave-current-struct-tags' |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
174 (idlwave-complete-structure-tag-query-shell var) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
175 ;; initialize |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
176 (setq idlwave-sint-structtags nil |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
177 idlwave-current-tags-buffer (current-buffer) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
178 idlwave-current-tags-var var |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
179 idlwave-structtag-struct-location (point) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
180 idlwave-current-struct-tags |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
181 (mapcar (lambda (x) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
182 (list (idlwave-sintern-structtag x 'set))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
183 idlwave-current-struct-tags)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
184 (if (not idlwave-current-struct-tags) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
185 (error "Cannot complete structure tags of variable %s" var))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
186 ;; Not the shell, so probably a source buffer. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
187 (unless |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
188 (catch 'exit |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
189 (save-excursion |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
190 (goto-char (point-max)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
191 ;; Find possible definitions of the structure. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
192 (while (idlwave-find-structure-definition var nil 'all) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
193 (let ((tags (idlwave-struct-tags))) |
69821
5baeec79c0cd
Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
68773
diff
changeset
|
194 (when tags |
64001
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
195 ;; initialize |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
196 (setq idlwave-sint-structtags nil |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
197 idlwave-current-tags-buffer (current-buffer) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
198 idlwave-current-tags-var var |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
199 idlwave-structtag-struct-location (point) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
200 idlwave-current-struct-tags |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
201 (mapcar (lambda (x) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
202 (list (idlwave-sintern-structtag x 'set))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
203 tags)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
204 (throw 'exit t)))))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
205 (error "Cannot complete structure tags of variable %s" var)))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
206 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
207 (defun idlwave-complete-structure-tag-query-shell (var) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
208 "Ask the shell for the tags of the structure in variable or expression VAR." |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
209 (idlwave-shell-send-command |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
210 (format "if size(%s,/TYPE) eq 8 then print,tag_names(%s)" var var) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
211 'idlwave-complete-structure-tag-get-tags-from-help |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
212 'hide 'wait)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
213 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
214 (defvar idlwave-shell-prompt-pattern) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
215 (defvar idlwave-shell-command-output) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
216 (defun idlwave-complete-structure-tag-get-tags-from-help () |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
217 "Filter structure tag name output, result to `idlwave-current-struct-tags'." |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
218 (setq idlwave-current-struct-tags |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
219 (if (string-match (concat "tag_names(.*) *\n" |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
220 "\\(\\(.*[\r\n]?\\)*\\)" |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
221 "\\(" idlwave-shell-prompt-pattern "\\)") |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
222 idlwave-shell-command-output) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
223 (split-string (match-string 1 idlwave-shell-command-output))))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
224 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
225 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
226 ;; Fake help in the source buffer for structure tags. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
227 ;; kwd and name are global-variables here. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
228 (defvar name) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
229 (defvar kwd) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
230 (defvar idlwave-help-do-struct-tag) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
231 (defun idlwave-complete-structure-tag-help (mode word) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
232 (cond |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
233 ((eq mode 'test) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
234 ;; fontify only in source buffers, not in the shell. |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
235 (not (equal idlwave-current-tags-buffer |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
236 (get-buffer (idlwave-shell-buffer))))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
237 ((eq mode 'set) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
238 (setq kwd word |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
239 idlwave-help-do-struct-tag idlwave-structtag-struct-location)) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
240 (t (error "This should not happen")))) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
241 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
242 (provide 'idlw-complete-structtag) |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
243 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
244 ;;; idlw-complete-structtag.el ends here |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
245 |
82d080bf4f42
Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff
changeset
|
246 |
69837 | 247 ;; arch-tag: d1f9e55c-e504-4187-9c31-3c3651fa4bfa |