annotate lisp/progmodes/idlw-complete-structtag.el @ 87649:107ccd98fa12

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-987
author Miles Bader <miles@gnu.org>
date Tue, 08 Jan 2008 20:46:54 +0000
parents 212857b620d4 a1342e6e097a
children 52b7a8c22af5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 69837
diff changeset
2
79717
a1342e6e097a Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 69837
diff changeset
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
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
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
78234
c1ec1c8a8d2e Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
15 ;; the Free Software Foundation; either version 3, or (at your option)
64001
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
16 ;; any later version.
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
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 64067
diff changeset
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 64067
diff changeset
26 ;; Boston, MA 02110-1301, USA.
64001
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 ;;; Commentary:
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
29
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
30 ;; 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
31 ;; 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
32 ;; 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
33
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
34 ;; 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
35 ;; 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
36 ;; 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
37 ;; 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
38 ;; 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
39 ;; 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
40 ;; 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
41 ;; 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
42 ;; 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
43 ;; 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
44 ;; 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
45 ;; 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
46 ;; 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
47 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
48 ;; 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
49 ;; 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
50 ;; 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
51 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
52 ;; 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
53 ;; from:
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
54 ;; 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
55 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
56 ;; INSTALLATION
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
57 ;; ============
69821
5baeec79c0cd Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents: 68773
diff changeset
58 ;; 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
59 ;; 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
60 ;;
69821
5baeec79c0cd Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents: 68773
diff changeset
61 ;; (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
62 ;; (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
63 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
64 ;; DESCRIPTION
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 ;; 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
67 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
68 ;; 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
69 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
70 ;; 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
71 ;; 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
72 ;; structure definition
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 ;; 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
75 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
76 ;; 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
77 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
78 ;; 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
79 ;; 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
80 ;;
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
81 ;; Notes
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
82 ;; -----
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 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
84 ;; 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
85 ;; - 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
86 ;; - 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
87 ;; 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
88 ;; - 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
89 ;; - 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
90 ;; 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
91
69821
5baeec79c0cd Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents: 68773
diff changeset
92 (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
93
86503
2c08ad76fc1f * progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78234
diff changeset
94 (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
95
64001
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
96 ;; 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
97 (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
98 (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
99 (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
100
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
101 ;; 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
102 (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
103 (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
104
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
105 ;; Create the sintern type for structure talks
86869
212857b620d4 (idlwave-sintern-structtag): Fix declaration.
Glenn Morris <rgm@gnu.org>
parents: 86868
diff changeset
106 (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
107 (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
108
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
109 ;; 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
110 (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
111 (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
112
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
113 ;;; 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
114 (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
115 (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
116 "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
117 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
118 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
119 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
120
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
121 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
122 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
123 (interactive)
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
124 (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
125 start
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
126 (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
127 (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
128 ;; 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
129 ;; 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
130 ;; 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
131 ;; 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
132 ;; 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
133 (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
134 (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
135 (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
136 (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
137 (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
138 (>= 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
139 (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
140 (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
141 ;; 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
142 ;; 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
143 ;; 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
144 ;; 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
145 ;; - 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
146 ;; - 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
147 ;; - 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
148 (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
149 (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
150 (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
151 (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
152 (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
153 (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
154 (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
155 (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
156 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
157 "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
158 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
159 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
160
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
161 (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
162 "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
163 (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
164
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
165 (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
166 "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
167
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
168 (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
169 "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
170 ;; 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
171 (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
172 ;; 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
173 (progn
69821
5baeec79c0cd Update to IDLWAVE version 6.0; see idlwave.org.
J.D. Smith <jdsmith@as.arizona.edu>
parents: 68773
diff changeset
174 (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
175 ;; 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
176 (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
177 ;; initialize
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
178 (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
179 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
180 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
181 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
182 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
183 (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
184 (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
185 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
186 (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
187 (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
188 ;; 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
189 (unless
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
190 (catch 'exit
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
191 (save-excursion
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
192 (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
193 ;; 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
194 (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
195 (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
196 (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
197 ;; initialize
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
198 (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
199 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
200 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
201 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
202 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
203 (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
204 (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
205 tags))
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
206 (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
207 (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
208
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
209 (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
210 "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
211 (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
212 (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
213 '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
214 'hide 'wait))
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
215
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
216 (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
217 (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
218 (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
219 "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
220 (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
221 (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
222 "\\(\\(.*[\r\n]?\\)*\\)"
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
223 "\\(" 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
224 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
225 (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
226
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
227
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
228 ;; 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
229 ;; 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
230 (defvar name)
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
231 (defvar kwd)
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
232 (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
233 (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
234 (cond
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
235 ((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
236 ;; 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
237 (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
238 (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
239 ((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
240 (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
241 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
242 (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
243
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
244 (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
245
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
246 ;;; 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
247
82d080bf4f42 Updated to IDLWAVE v5.7 (see idlwave.org), and variable cleanup
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
248
69837
15cb8a20aec0 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 69821
diff changeset
249 ;; arch-tag: d1f9e55c-e504-4187-9c31-3c3651fa4bfa