annotate lisp/progmodes/idlw-help.el @ 59172:18c133f09829

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 28 Dec 2004 17:55:12 +0000
parents 4773953f1a10
children 31aa9a390538
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
58295
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1 ;;; idlw-help.el --- HTML Help code for IDLWAVE
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
2 ;; Copyright (c) 2000 Carsten Dominik
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
3 ;; Copyright (c) 2001, 2002 J.D. Smith
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
4 ;; Copyright (c) 2003,2004 Free Software Foundation
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
5 ;;
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
6 ;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
7 ;; Carsten Dominik <dominik@astro.uva.nl>
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
8 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
9 ;; Version: 5.5
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
10
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
12
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
13 ;; This file is free software; you can redistribute it and/or modify
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
16 ;; any later version.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
17
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
18 ;; This file is distributed in the hope that it will be useful,
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
21 ;; GNU General Public License for more details.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
22
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
27
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
28 ;;; Commentary:
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
29
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
30 ;; The help link information for IDLWAVE's online help feature for
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
31 ;; system routines is extracted automatically from the IDL
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
32 ;; documentation, and is available, along with general routine
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
33 ;; information, in the file idlw-rinfo.el. The HTML help file
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
34 ;; themselves are not distributable with Emacs, but are available,
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
35 ;; along with new versions of IDLWAVE, documentation, and more
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
36 ;; information, at:
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
37 ;;
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
38 ;; http://idlwave.org
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
39 ;;
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
41
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
42
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
43 ;;; Code:
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
44 (require 'browse-url)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
45
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
46 (defgroup idlwave-online-help nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
47 "Online Help options for IDLWAVE mode."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
48 :group 'idlwave)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
49
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
50 (defcustom idlwave-html-help-pre-v6 nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
51 "Whether pre or post-v6.0 IDL help documents are being used."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
52 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
53 :type 'boolean)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
54
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
55 (defvar idlwave-html-link-sep
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
56 (if idlwave-html-help-pre-v6 "#" "#wp"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
57
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
58 (defcustom idlwave-html-help-location
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
59 (if (memq system-type '(ms-dos windows-nt))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
60 nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
61 "/usr/local/etc/")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
62 "The directory where the idl_html_help/ dir or idl.chm help file
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
63 (Windows only) lives."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
64 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
65 :type 'directory)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
66
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
67 (defcustom idlwave-help-use-hh nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
68 "Whether to use the HTMLHelp viewer with idl.chm (Windows only)."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
69 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
70 :type '(choice :tag "use help viewer"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
71 (const :tag "<none>" nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
72 (const :tag "hh" 'hh)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
73 (const :tag "keyhh" 'keyhh)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
74
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
75 (defcustom idlwave-help-browser-function browse-url-browser-function
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
76 "Function to use to display html help.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
77 Defaults to `browse-url-browser-function', which see."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
78 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
79 :type 'function)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
80
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
81 (defcustom idlwave-help-browser-generic-program browse-url-generic-program
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
82 "Program to run if using browse-url-generic-program."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
83 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
84 :type 'string)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
85
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
86 (defcustom idlwave-help-browser-generic-args
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
87 (if (boundp 'browse-url-generic-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
88 browse-url-generic-args "")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
89 "Program args to use if using browse-url-generic-program."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
90 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
91 :type 'string)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
92
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
93 (defcustom idlwave-help-browser-is-local nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
94 "Whether the browser will display locally in an Emacs window.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
95 Several browsers run and/or display inside Emacs windows, but most are
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
96 external programs. If the browser name contains \"-w3\", it is
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
97 assumed to be local to Emacs. For other local browsers, this variable
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
98 must be explicitly set non-nil in order for the variable
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
99 `idlwave-help-use-dedicated-frame' to function."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
100 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
101 :type 'boolean)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
102
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
103 (defvar idlwave-help-directory ""
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
104 "Obsolete variable. See idlwave-html-help-location.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
105
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
106 (defcustom idlwave-help-use-dedicated-frame t
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
107 "*Non-nil means, use a separate frame for Online Help if possible."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
108 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
109 :type 'boolean)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
110
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
111 (defcustom idlwave-help-frame-parameters
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
112 '((height . 32) (unsplittable . t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
113 "The frame parameters for the special Online Help frame.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
114 See also `idlwave-help-use-dedicated-frame'.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
115 If you do not set the frame width here, the value specified in
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
116 `idlw-help.el' will be used."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
117 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
118 :type '(repeat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
119 (cons symbol sexp)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
120
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
121 (defcustom idlwave-max-popup-menu-items 20
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
122 "Maximum number of items per pane in popup menus.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
123 Currently only used for class selection during completion help."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
124 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
125 :type 'integer)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
126
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
127 (defcustom idlwave-extra-help-function 'idlwave-help-with-source
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
128 "The function to call for online help if the normal help fails.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
129 Online help works only for system routines which are described in the
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
130 IDL manuals. A function may be specified to access help from other sources.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
131
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
132 The function must accept four arguments: NAME, TYPE, CLASS, KEYWORD.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
133 The Help buffer is current when this function is called, and the help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
134 text should be loaded into this buffer. If help is found, the
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
135 function should return the buffer position which should be used as
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
136 `window-start' in the help window. Also, the variable
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
137 `idlwave-help-mode-line-indicator' should be set to a useful string,
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
138 which will be displayed in the mode line of the help window. If
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
139 should also set the variable `idlwave-help-min-frame-width' to a
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
140 positive integer. IDLWAVE will ensure that the help frame is at least
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
141 that many columns wide. Failure to find help should be indicated by
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
142 throwing an error.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
143
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
144 When this variable is non-nil, IDLWAVE will allow the mouse-3 help click
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
145 for every routine and keyword, even though the item may not be highlighted
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
146 in blue (indicating the availability of system documentation).
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
147
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
148 The default value for this function is `idlwave-help-with-source' which
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
149 loads the routine source file into the help buffer. If you try to write
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
150 a different function which accesses a special help file or so, it is
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
151 probably a good idea to still call this function as a fallback."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
152 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
153 :type 'symbol)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
154
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
155 (defcustom idlwave-help-fontify-source-code nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
156 "*Non-nil means, fontify source code displayed as help like normal code."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
157 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
158 :type 'boolean)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
159
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
160 (defcustom idlwave-help-source-try-header t
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
161 "*Non-nil means, try to find help in routine header when displaying source.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
162 Routines which are not documented in the system manual use their source as
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
163 help text. When this variable is non-nil, we try to find a description of
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
164 the help item in the first routine doclib header above the routine definition.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
165 If the variable is nil, or if we cannot find/parse the header, the routine
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
166 definition is displayed instead."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
167 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
168 :type 'boolean)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
169
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
170
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
171 (defcustom idlwave-help-doclib-name "name"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
172 "*A regexp for the heading word to search for in doclib headers
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
173 which specifies the `name' section. Can be used for localization
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
174 support."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
175 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
176 :type 'string)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
177
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
178 (defcustom idlwave-help-doclib-keyword "KEYWORD"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
179 "*A regexp for the heading word to search for in doclib headers
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
180 which specifies the `keywords' section. Can be used for localization
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
181 support."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
182 :group 'idlwave-online-help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
183 :type 'string)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
184
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
185 (defface idlwave-help-link-face
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
186 '((((class color)) (:foreground "Blue"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
187 (t (:weight bold)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
188 "Face for highlighting links into IDLWAVE online help."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
189 :group 'idlwave-online-help)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
190
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
191 (defvar idlwave-help-activate-links-aggressively nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
192 "Obsolete variable.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
193
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
194 (defvar idlwave-completion-help-info)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
195
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
196 (defvar idlwave-help-frame nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
197 "The frame for display of IDL online help.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
198 (defvar idlwave-help-frame-width 102
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
199 "The default width of the help frame.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
200
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
201 (defvar idlwave-html-help-is-available nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
202 "Is the system online help text avaiable?")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
203
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
204 (defvar idlwave-help-mode-line-indicator ""
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
205 "Used for the special mode line in the idlwave-help-mode.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
206
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
207 (defvar idlwave-help-window-configuration nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
208 (defvar idlwave-help-special-topic-words nil) ; defined by get_rinfo
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
209
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
210 ;; Define the key bindings for the Help application
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
211
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
212 (defvar idlwave-help-mode-map (make-sparse-keymap)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
213 "The keymap used in idlwave-help-mode.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
214
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
215 (define-key idlwave-help-mode-map "q" 'idlwave-help-quit)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
216 (define-key idlwave-help-mode-map "w" 'widen)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
217 (define-key idlwave-help-mode-map "\C-m" (lambda (arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
218 (interactive "p")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
219 (scroll-up arg)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
220 (define-key idlwave-help-mode-map " " 'scroll-up)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
221 (define-key idlwave-help-mode-map [delete] 'scroll-down)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
222 (define-key idlwave-help-mode-map "h" 'idlwave-help-find-header)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
223 (define-key idlwave-help-mode-map "H" 'idlwave-help-find-first-header)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
224 (define-key idlwave-help-mode-map "." 'idlwave-help-toggle-header-match-and-def)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
225 (define-key idlwave-help-mode-map "F" 'idlwave-help-fontify)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
226 (define-key idlwave-help-mode-map "\M-?" 'idlwave-help-return-to-calling-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
227 (define-key idlwave-help-mode-map "x" 'idlwave-help-return-to-calling-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
228
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
229 ;; Define the menu for the Help application
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
230
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
231 (easy-menu-define
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
232 idlwave-help-menu idlwave-help-mode-map
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
233 "Menu for Help IDLWAVE system"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
234 '("IDLHelp"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
235 ["Definition <-> Help Text" idlwave-help-toggle-header-match-and-def t]
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
236 ["Find DocLib Header" idlwave-help-find-header t]
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
237 ["Find First DocLib Header" idlwave-help-find-first-header t]
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
238 ["Fontify help buffer" idlwave-help-fontify t]
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
239 "--"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
240 ["Quit" idlwave-help-quit t]))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
241
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
242 (defun idlwave-help-mode ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
243 "Major mode for displaying IDL Help.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
244
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
245 This is a VIEW mode for the ASCII version of IDL Help files,
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
246 with some extras. Its main purpose is speed - so don't
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
247 expect a fully hyper-linked help.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
248
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
249 Scrolling: SPC DEL RET
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
250 Text Searches: Inside Topic: Use Emacs search functions
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
251 Exit: [q]uit or mouse button 3 will kill the frame
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
252
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
253 When the hep text is a source file, the following commands are available
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
254
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
255 Fontification: [F]ontify the buffer like source code
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
256 Jump: [h] to function doclib header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
257 [H] to file doclib header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
258 [.] back and forward between header and definition
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
259
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
260 Here are all keybindings.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
261 \\{idlwave-help-mode-map}"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
262 (kill-all-local-variables)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
263 (buffer-disable-undo)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
264 (setq major-mode 'idlwave-help-mode
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
265 mode-name "IDLWAVE Help")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
266 (use-local-map idlwave-help-mode-map)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
267 (easy-menu-add idlwave-help-menu idlwave-help-mode-map)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
268 (setq truncate-lines t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
269 (setq case-fold-search t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
270 (setq mode-line-format
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
271 (list ""
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
272 'mode-line-modified
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
273 'mode-line-buffer-identification
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
274 ": " 'idlwave-help-mode-line-indicator
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
275 " -%-"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
276 (setq buffer-read-only t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
277 (set (make-local-variable 'idlwave-help-def-pos) nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
278 (set (make-local-variable 'idlwave-help-args) nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
279 (set (make-local-variable 'idlwave-help-in-header) nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
280 (run-hooks 'idlwave-help-mode-hook))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
281
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
282 (defun idlwave-html-help-location ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
283 "Return the help directory where HTML files are, or nil if that is unknown."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
284 (or (and (stringp idlwave-html-help-location)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
285 (> (length idlwave-html-help-location) 0)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
286 (file-directory-p idlwave-html-help-location)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
287 idlwave-html-help-location)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
288 (getenv "IDLWAVE_HELP_LOCATION")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
289 (and (memq system-type '(ms-dos windows-nt)) ; Base it on sysdir
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
290 idlwave-help-use-hh
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
291 (stringp idlwave-system-directory)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
292 (> (length idlwave-system-directory) 0)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
293 (file-directory-p idlwave-system-directory)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
294 (expand-file-name "HELP" idlwave-system-directory))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
295
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
296 (defvar idlwave-current-obj_new-class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
297 (defvar idlwave-help-diagnostics)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
298 (defvar idlwave-experimental)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
299 (defvar idlwave-last-context-help-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
300 (defun idlwave-do-context-help (&optional arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
301 "Wrapper around the call to idlwave-context-help1.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
302 It collects and prints the diagnostics messages."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
303 (let ((marker (list (current-buffer) (point)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
304 (idlwave-help-diagnostics nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
305 ;; Check for frame switching. When the command is invoked twice
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
306 ;; at the same position, we try to switch to the help frame
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
307 ;; FIXME: Frame switching works only on XEmacs
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
308 (if (and idlwave-experimental
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
309 (equal last-command this-command)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
310 (equal idlwave-last-context-help-pos marker))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
311 (idlwave-help-select-help-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
312 ;; Do the real thing.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
313 (setq idlwave-last-context-help-pos marker)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
314 (idlwave-do-context-help1 arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
315 (if idlwave-help-diagnostics
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
316 (message "%s" (mapconcat 'identity
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
317 (nreverse idlwave-help-diagnostics)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
318 "; "))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
319
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
320 (defvar idlwave-help-do-class-struct-tag nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
321 (defvar idlwave-help-do-struct-tag nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
322 (defun idlwave-do-context-help1 (&optional arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
323 "The work-horse version of `idlwave-context-help', which see."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
324 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
325 (if (equal (char-after) ?/)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
326 (forward-char 1)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
327 (if (equal (char-before) ?=)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
328 (backward-char 1)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
329 (let* ((idlwave-query-class nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
330 (idlwave-force-class-query (equal arg '(4)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
331 (chars "a-zA-Z0-9_$.!")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
332 (beg (save-excursion (skip-chars-backward chars) (point)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
333 (end (save-excursion (skip-chars-forward chars) (point)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
334 (this-word (buffer-substring-no-properties beg end))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
335 (st-ass (assoc (downcase this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
336 idlwave-help-special-topic-words))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
337 (classtag (and (string-match "self\\." this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
338 (< beg (- end 4))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
339 (structtag (and (fboundp 'idlwave-complete-structure-tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
340 (string-match "\\`\\([^.]+\\)\\." this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
341 (< beg (- end 4))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
342 module keyword cw mod1 mod2 mod3)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
343 (if (or arg
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
344 (and (not st-ass)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
345 (not classtag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
346 (not structtag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
347 (not (member (string-to-char this-word) '(?! ?.)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
348 ;; Need the module information
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
349 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
350 ;; MODULE is (name type class), for this or any inheriting class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
351 (setq module (idlwave-what-module-find-class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
352 cw (nth 2 (idlwave-where))) ;what would we complete here?
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
353 ;; Correct for OBJ_NEW, we may need an INIT method instead.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
354 (if (equal (idlwave-downcase-safe (car module)) "obj_new")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
355 (let* ((bos (save-excursion (idlwave-beginning-of-statement)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
356 (point)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
357 (str (buffer-substring bos (point))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
358 (if (string-match "OBJ_NEW([ \t]*['\"]\\([a-zA-Z][a-zA-Z0-9$_]+\\)['\"]" str)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
359 (setq module (list "init" 'fun (match-string 1 str))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
360 idlwave-current-obj_new-class (match-string 1 str))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
361 )))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
362 (cond
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
363 (arg (setq mod1 module))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
364
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
365 ;; A special topic -- only system help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
366 (st-ass (setq mod1 (list (cdr st-ass))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
367
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
368 ;; A system variable -- only system help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
369 ((string-match
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
370 "\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
371 this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
372 (let* ((word (match-string-no-properties 1 this-word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
373 (entry (assq (idlwave-sintern-sysvar word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
374 idlwave-system-variables-alist))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
375 (tag (match-string-no-properties 3 this-word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
376 (tag-target (if tag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
377 (cdr
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
378 (assq (idlwave-sintern-sysvartag tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
379 (cdr (assq 'tags entry))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
380 (link (nth 1 (assq 'link entry))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
381 (if tag-target
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
382 (setq link (idlwave-substitute-link-target link
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
383 tag-target)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
384 (setq mod1 (list link))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
385
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
386 ;; An executive command -- only system help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
387 ((string-match "^\\.\\([A-Z_]+\\)" this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
388 (let* ((word (match-string 1 this-word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
389 (link (cdr (assoc-ignore-case
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
390 word
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
391 idlwave-executive-commands-alist))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
392 (setq mod1 (list link))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
393
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
394 ;; A class -- system OR in-text help (via class__define).
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
395 ((and (eq cw 'class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
396 (or (idlwave-in-quote) ; e.g. obj_new
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
397 (re-search-backward "\\<inherits[ \t]+[A-Za-z0-9_]*\\="
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
398 (max (point-min) (- (point) 40)) t)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
399 ;; Class completion inside string delimiters must be
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
400 ;; the class inside OBJ_NEW.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
401 (let* ((entry (assq
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
402 (idlwave-sintern-class this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
403 idlwave-system-class-info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
404 (name (concat (downcase this-word) "__define"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
405 (link (nth 1 (assq 'link entry))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
406 (setq mod1 (list link name 'pro))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
407
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
408 ;; A class structure tag (self.BLAH) -- only in-text help available
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
409 (classtag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
410 (let ((tag (substring this-word (match-end 0)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
411 class-with found-in)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
412 (when (setq class-with
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
413 (idlwave-class-or-superclass-with-tag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
414 (nth 2 (idlwave-current-routine))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
415 tag))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
416 (setq found-in (idlwave-class-found-in class-with))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
417 (if (assq (idlwave-sintern-class class-with)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
418 idlwave-system-class-info)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
419 (error "No help available for system class tags"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
420 (setq idlwave-help-do-class-struct-tag t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
421 (setq mod1 (list nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
422 (if found-in
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
423 (cons (concat found-in "__define") class-with)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
424 (concat class-with "__define"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
425 'pro
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
426 nil ; no class.... it's a procedure!
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
427 tag)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
428
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
429 ;; A regular structure tag -- only in text, and if
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
430 ;; optional `complete-structtag' loaded.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
431 (structtag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
432 (let ((var (match-string 1 this-word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
433 (tag (substring this-word (match-end 0))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
434 ;; Check if we need to update the "current" structure
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
435 (idlwave-prepare-structure-tag-completion var)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
436 (setq idlwave-help-do-struct-tag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
437 idlwave-structtag-struct-location
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
438 mod1 (list nil nil nil nil tag))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
439
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
440 ;; A routine keyword -- in text or system help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
441 ((and (memq cw '(function-keyword procedure-keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
442 (stringp this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
443 (string-match "\\S-" this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
444 (not (string-match "!" this-word)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
445 (cond ((or (= (char-before beg) ?/)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
446 (save-excursion (goto-char end)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
447 (looking-at "[ \t]*=")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
448 ;; Certainly a keyword. Check for abbreviation etc.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
449 (setq keyword (idlwave-expand-keyword this-word module))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
450 (cond
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
451 ((null keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
452 (idlwave-help-diagnostics
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
453 (format "%s does not accept `%s' kwd"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
454 (idlwave-make-full-name (nth 2 module)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
455 (car module))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
456 (upcase this-word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
457 'ding))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
458 ((consp keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
459 (idlwave-help-diagnostics
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
460 (format "%d matches for kwd abbrev `%s'"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
461 (length keyword) this-word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
462 'ding)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
463 ;; We continue anyway with the first match...
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
464 (setq keyword (car keyword))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
465 ;; Keyword, or just module
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
466 (setq mod1 (append (list t) module (list keyword)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
467 (setq mod2 (append (list t) module)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
468 ((equal (char-after end) ?\()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
469 ;; A function - what-module will have caught this
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
470 (setq mod1 (append (list t) module)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
471 (t
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
472 ;; undecided - try function, keyword, then enclosing mod.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
473 ;; Check for keyword abbreviations, but do not report
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
474 ;; errors, because it might be something else.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
475 ;; FIXME: is this a good way to handle this?
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
476 (setq keyword (idlwave-expand-keyword this-word module))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
477 (if (consp keyword) (setq keyword (car keyword)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
478 (setq mod1 (append (list t) module (list keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
479 mod2 (list t this-word 'fun nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
480 mod3 (append (list t) module)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
481
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
482 ;; Everything else
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
483 (t
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
484 (setq mod1 (append (list t) module))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
485 (if mod3
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
486 (condition-case nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
487 (apply 'idlwave-online-help mod1)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
488 (error (condition-case nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
489 (apply 'idlwave-online-help mod2)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
490 (error (apply 'idlwave-online-help mod3)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
491 (if mod2
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
492 (condition-case nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
493 (apply 'idlwave-online-help mod1)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
494 (error (apply 'idlwave-online-help mod2)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
495 (if mod1
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
496 (apply 'idlwave-online-help mod1)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
497 (error "Don't know which item to show help for")))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
498
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
499 (defun idlwave-do-mouse-completion-help (ev)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
500 "Display online help on an item in the *Completions* buffer.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
501 Needs additional info stored in global `idlwave-completion-help-info'."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
502 (let* ((cw (selected-window))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
503 (info idlwave-completion-help-info) ; global passed in
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
504 (what (nth 0 info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
505 (name (nth 1 info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
506 (type (nth 2 info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
507 (class (nth 3 info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
508 (need-class class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
509 (kwd (nth 4 info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
510 (sclasses (nth 5 info))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
511 word link)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
512 (mouse-set-point ev)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
513
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
514
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
515 ;; See if we can also find help somewhere, e.g. for multiple classes
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
516 (setq word (idlwave-this-word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
517 (if (string= word "")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
518 (error "No help item selected"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
519 (setq link (get-text-property 0 'link word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
520 (select-window cw)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
521 (cond
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
522 ;; Routine name
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
523 ((memq what '(procedure function routine))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
524 (setq name word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
525 (if (or (eq class t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
526 (and (stringp class) sclasses))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
527 (let* ((classes (idlwave-all-method-classes
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
528 (idlwave-sintern-method name)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
529 type)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
530 (setq link t) ; No specific link valid yet
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
531 (if sclasses
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
532 (setq classes (idlwave-members-only
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
533 classes (cons class sclasses))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
534 (setq class (idlwave-popup-select ev classes
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
535 "Select Class" 'sort))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
536
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
537 ;; XXX is this necessary, given all-method-classes?
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
538 (if (stringp class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
539 (setq class (idlwave-find-inherited-class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
540 (idlwave-sintern-routine-or-method name class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
541 type (idlwave-sintern-class class)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
542
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
543 ;; Keyword
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
544 ((eq what 'keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
545 (setq kwd word)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
546 (if (or (eq class t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
547 (and (stringp class) sclasses))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
548 (let ((classes (idlwave-all-method-keyword-classes
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
549 (idlwave-sintern-method name)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
550 (idlwave-sintern-keyword kwd)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
551 type)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
552 (setq link t) ; Link can't be correct yet
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
553 (if sclasses
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
554 (setq classes (idlwave-members-only
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
555 classes (cons class sclasses))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
556 (setq class (idlwave-popup-select ev classes
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
557 "Select Class" 'sort))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
558 ;; XXX is this necessary, given all-method-keyword-classes?
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
559 (if (stringp class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
560 (setq class (idlwave-find-inherited-class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
561 (idlwave-sintern-routine-or-method name class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
562 type (idlwave-sintern-class class)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
563 (if (string= (downcase name) "obj_new")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
564 (setq class idlwave-current-obj_new-class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
565 name "Init"))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
566
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
567 ;; Class name
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
568 ((eq what 'class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
569 (setq class word
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
570 word nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
571
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
572 ;; A special named function to call which sets some of our variables
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
573 ((and (symbolp what)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
574 (fboundp what))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
575 (funcall what 'set word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
576
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
577 (t (error "Cannot help with this item")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
578 (if (and need-class (not class) (not (and link (not (eq link t)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
579 (error "Cannot help with this item"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
580 (idlwave-online-help link (or name word) type class kwd)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
581
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
582 (defvar idlwave-highlight-help-links-in-completion)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
583 (defvar idlwave-completion-help-links)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
584 (defun idlwave-highlight-linked-completions ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
585 "Highlight all completions for which help is available and attach link.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
586 Those words in `idlwave-completion-help-links' have links. The
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
587 `idlwave-help-link-face' face is used for this."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
588 (if idlwave-highlight-help-links-in-completion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
589 (with-current-buffer (get-buffer "*Completions*")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
590 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
591 (let* ((case-fold-search t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
592 (props (list 'face 'idlwave-help-link-face))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
593 (info idlwave-completion-help-info) ; global passed in
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
594 (what (nth 0 info)) ; what was completed, or a func
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
595 (class (nth 3 info)) ; any class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
596 word beg end doit)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
597 (goto-char (point-min))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
598 (re-search-forward "possible completions are:" nil t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
599 (while (re-search-forward "\\s-\\([A-Za-z0-9_.]+\\)\\(\\s-\\|\\'\\)"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
600 nil t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
601 (setq beg (match-beginning 1) end (match-end 1)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
602 word (match-string 1) doit nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
603 ;; Call special completion function test
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
604 (if (and (symbolp what)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
605 (fboundp what))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
606 (setq doit (funcall what 'test word))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
607 ;; Look for special link property passed in help-links
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
608 (if idlwave-completion-help-links
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
609 (setq doit (assoc-ignore-case
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
610 word idlwave-completion-help-links))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
611 (when doit
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
612 (if (consp doit)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
613 (setq props (append props `(link ,(cdr doit)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
614 (let ((buffer-read-only nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
615 (add-text-properties beg end props)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
616 (goto-char end)))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
617
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
618 ;; Arrange for this function to be called after completion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
619 (add-hook 'idlwave-completion-setup-hook
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
620 'idlwave-highlight-linked-completions)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
621
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
622 (defvar idlwave-help-return-frame nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
623 "The frame to return to from the help frame.")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
624
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
625 (defun idlwave-help-quit ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
626 "Exit IDLWAVE Help buffer. Kill the dedicated frame if any."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
627 (interactive)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
628 (cond ((and idlwave-help-use-dedicated-frame
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
629 (eq (selected-frame) idlwave-help-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
630 (if (and idlwave-experimental
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
631 (frame-live-p idlwave-help-return-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
632 ;; Try to select the return frame.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
633 ;; This can crash on slow network connections, obviously when
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
634 ;; we kill the help frame before the return-frame is selected.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
635 ;; To protect the workings, we wait for up to one second
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
636 ;; and check if the return-frame *is* now selected.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
637 ;; This is marked "eperimental" since we are not sure when its OK.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
638 (let ((maxtime 1.0) (time 0.) (step 0.1))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
639 (select-frame idlwave-help-return-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
640 (while (and (sit-for step)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
641 (not (eq (selected-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
642 idlwave-help-return-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
643 (< (setq time (+ time step)) maxtime)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
644 (delete-frame idlwave-help-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
645 ((window-configuration-p idlwave-help-window-configuration)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
646 (set-window-configuration idlwave-help-window-configuration)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
647 (select-window (previous-window)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
648 (t (kill-buffer (idlwave-help-get-help-buffer)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
649
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
650
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
651 (defvar default-toolbar-visible-p)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
652
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
653 (defun idlwave-help-display-help-window (&optional pos-or-func)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
654 "Display the help window.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
655 Move window start to POS-OR-FUNC, if passed as a position, or call it
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
656 if passed as a function. See `idlwave-help-use-dedicated-frame'."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
657 (let ((cw (selected-window))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
658 (buf (idlwave-help-get-help-buffer)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
659 (if (and window-system idlwave-help-use-dedicated-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
660 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
661 (idlwave-help-show-help-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
662 (switch-to-buffer buf))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
663 ;; Do it in this frame and save the window configuration
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
664 (if (not (get-buffer-window buf nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
665 (setq idlwave-help-window-configuration
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
666 (current-window-configuration)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
667 (display-buffer buf nil (selected-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
668 (select-window (get-buffer-window buf)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
669 (raise-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
670 (if pos-or-func
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
671 (if (functionp pos-or-func)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
672 (funcall pos-or-func)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
673 (goto-char pos-or-func)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
674 (recenter 0)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
675 (select-window cw)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
676
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
677 (defun idlwave-help-select-help-frame ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
678 "Select the help frame."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
679 (if (and (frame-live-p idlwave-help-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
680 (not (eq (selected-frame) idlwave-help-frame)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
681 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
682 (setq idlwave-help-return-frame (selected-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
683 (select-frame idlwave-help-frame))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
684
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
685 (defun idlwave-help-return-to-calling-frame ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
686 "Select the frame from which the help frame was selected."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
687 (interactive)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
688 (if (and (frame-live-p idlwave-help-return-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
689 (not (eq (selected-frame) idlwave-help-return-frame)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
690 (select-frame idlwave-help-return-frame)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
691
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
692 (defun idlwave-online-help (link &optional name type class keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
693 "Display HTML or other special help on a certain topic.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
694 Either loads an HTML link, if LINK is non-nil, or gets special-help on
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
695 the optional arguments, if any special help is defined. If LINK is
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
696 `t', first look up the optional arguments in the routine info list to
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
697 see if a link is set for it. Try extra help functions if necessary."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
698 ;; Lookup link
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
699 (if (eq link t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
700 (let ((entry (idlwave-best-rinfo-assoc name type class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
701 (idlwave-routines) nil t)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
702 (cond
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
703 ;; Try keyword link
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
704 ((and keyword
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
705 (setq link (cdr (idlwave-entry-find-keyword entry keyword)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
706 ;; Default, regular entry link
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
707 (t (setq link (idlwave-entry-has-help entry))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
708
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
709 (cond
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
710 ;; An explicit link
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
711 ((stringp link)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
712 (idlwave-help-html-link link))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
713
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
714 ;; Any extra help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
715 (idlwave-extra-help-function
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
716 (idlwave-help-get-special-help name type class keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
717
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
718 ;; Nothing worked
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
719 (t (idlwave-help-error name type class keyword))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
720
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
721
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
722 (defun idlwave-help-get-special-help (name type class keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
723 "Call the function given by `idlwave-extra-help-function'."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
724 (let* ((cw (selected-window))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
725 (help-pos (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
726 (set-buffer (idlwave-help-get-help-buffer))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
727 (let ((buffer-read-only nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
728 (funcall idlwave-extra-help-function
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
729 name type class keyword)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
730 (if help-pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
731 (idlwave-help-display-help-window help-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
732 (idlwave-help-error name type class keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
733 (select-window cw)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
734
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
735 (defun idlwave-help-html-link (link)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
736 "Get html help on a given LINK."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
737 (let ((browse-url-browser-function idlwave-help-browser-function)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
738 (help-loc (idlwave-html-help-location))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
739 (browse-url-generic-program idlwave-help-browser-generic-program)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
740 ;(browse-url-generic-args idlwave-help-browser-generic-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
741 full-link)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
742
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
743 (if (and (memq system-type '(ms-dos windows-nt))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
744 idlwave-help-use-hh)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
745 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
746 (setq browse-url-browser-function 'browse-url-generic
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
747 full-link (concat (expand-file-name "idl.chm" help-loc)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
748 "::/"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
749 link))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
750 (if (memq 'keyhh idlwave-help-use-hh)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
751 (setq browse-url-generic-program "KEYHH"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
752 browse-url-generic-args '("-IDLWAVE"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
753 (setq browse-url-generic-program "HH")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
754 ;; Just a regular file name (+ anchor name)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
755 (unless (and (stringp help-loc)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
756 (file-directory-p help-loc))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
757 (error
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
758 "Invalid help location; customize `idlwave-html-help-location'."))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
759 (setq full-link (concat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
760 "file://"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
761 (expand-file-name
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
762 link
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
763 (expand-file-name "idl_html_help" help-loc)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
764
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
765 ;; Check for a local browser
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
766 (if (or idlwave-help-browser-is-local
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
767 (string-match "w3" (symbol-name idlwave-help-browser-function)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
768 (idlwave-help-display-help-window '(lambda () (browse-url full-link)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
769 (browse-url full-link))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
770
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
771 ;; A special help routine for source-level syntax help in files.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
772 (defvar idlwave-help-def-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
773 (defvar idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
774 (defvar idlwave-help-in-header)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
775 (defvar idlwave-help-fontify-source-code)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
776 (defvar idlwave-help-source-try-header)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
777 (defun idlwave-help-with-source (name type class keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
778 "Provide help for routines not documented in the IDL manuals. Works
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
779 by loading the routine source file into the help buffer. Depending on
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
780 the value of `idlwave-help-source-try-header', it attempts to show the
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
781 routine definition or the header description. If
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
782 `idlwave-help-do-class-struct-tag' is non-nil, keyword is a tag to
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
783 show help on from the class definition structure. If
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
784 `idlwave-help-do-struct-tag' is non-nil, show help from the matching
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
785 structure tag definition.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
786
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
787 This function can be used as `idlwave-extra-help-function'."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
788 (let* ((class-struct-tag idlwave-help-do-class-struct-tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
789 (struct-tag idlwave-help-do-struct-tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
790 (case-fold-search t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
791 (real-class (if (consp name) (cdr name)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
792 (name (if (consp name) (car name) name))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
793 (class-only (and (stringp class) (not (stringp name))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
794 file header-pos def-pos in-buf)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
795 (if class-only ;Help with class? Using "Init" as source.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
796 (setq name "Init"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
797 type 'fun))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
798 (if (not struct-tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
799 (setq file
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
800 (idlwave-routine-source-file
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
801 (nth 3 (idlwave-best-rinfo-assoc
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
802 name (or type t) class (idlwave-routines))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
803 (setq idlwave-help-def-pos nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
804 idlwave-help-args (list name type class keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
805 idlwave-help-in-header nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
806 idlwave-help-do-struct-tag nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
807 idlwave-help-do-class-struct-tag nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
808 (if (or struct-tag (stringp file))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
809 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
810 (setq in-buf ; structure-tag completion is always in current buffer
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
811 (if struct-tag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
812 idlwave-current-tags-buffer
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
813 (idlwave-get-buffer-visiting file)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
814 ;; see if file is in a visited buffer, insert those contents
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
815 (if in-buf
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
816 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
817 (setq file (buffer-file-name in-buf))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
818 (erase-buffer)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
819 (insert-buffer in-buf))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
820 (if (file-exists-p file) ;; otherwise just load the file
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
821 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
822 (erase-buffer)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
823 (insert-file-contents file nil nil nil 'replace))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
824 (idlwave-help-error name type class keyword)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
825 (if (and idlwave-help-fontify-source-code (not in-buf))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
826 (idlwave-help-fontify)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
827 (idlwave-help-error name type class keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
828 (setq idlwave-help-mode-line-indicator file)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
829
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
830 ;; Try to find a good place to display
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
831 (setq def-pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
832 ;; Find the class structure tag if that's what we're after
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
833 (cond
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
834 ;; Class structure tags: find the class or named structure
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
835 ;; definition
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
836 (class-struct-tag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
837 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
838 (setq class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
839 (if (string-match "[a-zA-Z0-9]\\(__\\)" name)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
840 (substring name 0 (match-beginning 1))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
841 idlwave-current-tags-class))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
842 (and
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
843 (idlwave-find-class-definition class nil real-class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
844 (idlwave-find-struct-tag keyword))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
845
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
846 ;; Generic structure tags: the structure definition
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
847 ;; location within the file has been recorded in
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
848 ;; `struct-tag'
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
849 (struct-tag
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
850 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
851 (and
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
852 (integerp struct-tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
853 (goto-char struct-tag)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
854 (idlwave-find-struct-tag keyword))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
855
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
856 ;; Just find the routine definition
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
857 (t
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
858 (if class-only (point-min)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
859 (idlwave-help-find-routine-definition name type class keyword))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
860 idlwave-help-def-pos def-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
861
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
862 (if (and idlwave-help-source-try-header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
863 (not (or struct-tag class-struct-tag)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
864 ;; Check if we can find the header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
865 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
866 (goto-char (or def-pos (point-max)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
867 (setq header-pos (idlwave-help-find-in-doc-header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
868 name type class keyword 'exact)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
869 idlwave-help-in-header header-pos)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
870
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
871 (if (or header-pos def-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
872 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
873 (if (boundp 'idlwave-help-min-frame-width)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
874 (setq idlwave-help-min-frame-width 80))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
875 (goto-char (or header-pos def-pos)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
876 (idlwave-help-error name type class keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
877
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
878 (point)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
879
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
880
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
881 (defun idlwave-help-find-routine-definition (name type class keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
882 "Find the definition of routine CLASS::NAME in current buffer.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
883 KEYWORD is ignored. Returns the point of match if successful, nil otherwise."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
884 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
885 (goto-char (point-max))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
886 (if (re-search-backward
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
887 (concat "^[ \t]*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
888 (if (eq type 'pro) "pro"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
889 (if (eq type 'fun) "function"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
890 "\\(pro\\|function\\)"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
891 "[ \t]+"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
892 (regexp-quote (downcase (idlwave-make-full-name class name)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
893 "[, \t\r\n]")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
894 nil t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
895 (match-beginning 0)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
896 nil)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
897
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
898 (defvar idlwave-doclib-start)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
899 (defvar idlwave-doclib-end)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
900 (defun idlwave-help-find-in-doc-header (name type class keyword
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
901 &optional exact)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
902 "Find the requested help in the doc-header above point.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
903
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
904 First checks if there is a doc-lib header which describes the correct
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
905 routine. Then tries to find the KEYWORDS section and the KEYWORD, if
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
906 given. Returns the point which should be window start of the help
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
907 window. If EXACT is non-nil, the full help position must be found -
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
908 down to the keyword requested. This setting is for context help, if
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
909 the exact spot is needed.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
910
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
911 If EXACT is nil, the position of the header is returned if it
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
912 describes the correct routine - even if the keyword description cannot
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
913 be found. TYPE is ignored.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
914
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
915 This function expects a more or less standard routine header. In
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
916 particlar it looks for the `NAME:' tag, either with a colon, or alone
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
917 on a line. Then `NAME:' must be followed by the routine name on the
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
918 same or the next line. When KEYWORD is non-nil, looks first for a
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
919 `KEYWORDS' section. It is amazing how inconsisten this is through
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
920 some IDL libraries I have seen. We settle for a line containing an
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
921 upper case \"KEYWORD\" string. If this line is not fould we search
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
922 for the keyword anyway to increase the hit-rate
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
923
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
924 When one of these sections exists we check for a line starting with any of
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
925
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
926 /KEYWORD KEYWORD- KEYWORD= KEYWORD
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
927
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
928 with spaces allowed between the keyword and the following dash or equal sign.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
929 If there is a match, we assume it is the keyword description."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
930 (let* ((case-fold-search t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
931 (rname (if (stringp class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
932 (concat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
933 "\\("
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
934 ;; Traditional name or class::name
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
935 "\\("
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
936 "\\(" (regexp-quote (downcase class)) "::\\)?"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
937 (regexp-quote (downcase name))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
938 "\\>\\)"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
939 (concat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
940 "\\|"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
941 ;; class__define or just class
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
942 (regexp-quote (downcase class)) "\\(__define\\)?")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
943 "\\)")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
944 (regexp-quote (downcase name))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
945
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
946 ;; NAME tag plus the routine name. The new version is from JD.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
947 (name-re (concat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
948 "\\(^;+\\*?[ \t]*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
949 idlwave-help-doclib-name
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
950 "\\([ \t]*:\\|[ \t]*$\\)[ \t]*\\(\n;+[ \t]*\\)*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
951 rname
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
952 "\\|"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
953 "^;+[ \t]*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
954 rname
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
955 ":[ \t]*$\\)"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
956
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
957 ;; Header start plus name
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
958 (header-re (concat "\\(" idlwave-doclib-start "\\).*\n"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
959 "\\(^;+.*\n\\)*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
960 "\\(" name-re "\\)"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
961 ;; A keywords section
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
962 (kwds-re (concat ; forgiving
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
963 "^;+\\*?[ \t]*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
964 "\\([-A-Z_ ]*"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
965 idlwave-help-doclib-keyword
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
966 "[-A-Z_ ]*\\)"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
967 "\\(:\\|[ \t]*\n\\)"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
968
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
969 ;; The individual keyword description line.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
970 (kwd-re (if keyword ; hard (well...)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
971 (concat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
972 "^;+[ \t]+"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
973 "\\(/" (regexp-quote (upcase keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
974 "\\|" (regexp-quote (upcase keyword)) "[ \t]*[-=:\n]"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
975 "\\)")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
976 (kwd-re2 (if keyword ; forgiving
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
977 (concat
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
978 "^;+[ \t]+"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
979 (regexp-quote (upcase keyword))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
980 "\\>")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
981 dstart dend name-pos kwds-pos kwd-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
982 (catch 'exit
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
983 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
984 (goto-char (point-min))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
985 (while (and (setq dstart (re-search-forward idlwave-doclib-start nil t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
986 (setq dend (re-search-forward idlwave-doclib-end nil t)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
987 ;; found a routine header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
988 (goto-char dstart)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
989 (if (setq name-pos (re-search-forward name-re dend t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
990 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
991 (if keyword
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
992 ;; We do need a keyword
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
993 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
994 ;; Try to find a keyword section, but don't force it.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
995 (goto-char name-pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
996 (if (let ((case-fold-search nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
997 (re-search-forward kwds-re dend t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
998 (setq kwds-pos (match-beginning 0)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
999 ;; Find the keyword description
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1000 (if (or (let ((case-fold-search nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1001 (re-search-forward kwd-re dend t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1002 (re-search-forward kwd-re dend t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1003 (let ((case-fold-search nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1004 (re-search-forward kwd-re2 dend t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1005 (re-search-forward kwd-re2 dend t))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1006 (setq kwd-pos (match-beginning 0))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1007 (if exact
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1008 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1009 (idlwave-help-diagnostics
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1010 (format "Could not find description of kwd %s"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1011 (upcase keyword)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1012 (throw 'exit nil))))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1013 ;; Return the best position we got
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1014 (throw 'exit (or kwd-pos kwds-pos name-pos dstart)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1015 (goto-char dend))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1016 (idlwave-help-diagnostics "Could not find doclib header")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1017 (throw 'exit nil))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1018
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1019 (defun idlwave-help-diagnostics (string &optional ding)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1020 "Add a diagnostics string to the list.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1021 When DING is non-nil, ring the bell as well."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1022 (if (boundp 'idlwave-help-diagnostics)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1023 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1024 (setq idlwave-help-diagnostics
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1025 (cons string idlwave-help-diagnostics))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1026 (if ding (ding)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1027
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1028 (defun idlwave-help-toggle-header-top-and-def (arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1029 (interactive "P")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1030 (let (pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1031 (if idlwave-help-in-header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1032 ;; Header was the last thing displayed
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1033 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1034 (setq idlwave-help-in-header nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1035 (setq pos idlwave-help-def-pos))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1036 ;; Try to display header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1037 (setq pos (idlwave-help-find-in-doc-header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1038 (nth 0 idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1039 (nth 1 idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1040 (nth 2 idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1041 nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1042 (if pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1043 (setq idlwave-help-in-header t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1044 (error "Cannot find doclib header for routine %s"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1045 (idlwave-make-full-name (nth 2 idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1046 (nth 0 idlwave-help-args)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1047 (if pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1048 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1049 (goto-char pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1050 (recenter 0)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1051
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1052 (defun idlwave-help-find-first-header (arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1053 (interactive "P")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1054 (let (pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1055 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1056 (goto-char (point-min))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1057 (if (re-search-forward idlwave-doclib-start nil t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1058 (setq pos (match-beginning 0))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1059 (if pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1060 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1061 (goto-char pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1062 (recenter 0))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1063 (error "No DocLib Header in current file"))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1064
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1065 (defun idlwave-help-find-header (arg)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1066 "Jump to the DocLib Header."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1067 (interactive "P")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1068 (if arg
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1069 (idlwave-help-find-first-header nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1070 (setq idlwave-help-in-header nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1071 (idlwave-help-toggle-header-match-and-def arg 'top)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1072
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1073 (defun idlwave-help-toggle-header-match-and-def (arg &optional top)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1074 (interactive "P")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1075 (let ((args idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1076 pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1077 (if idlwave-help-in-header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1078 ;; Header was the last thing displayed
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1079 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1080 (setq idlwave-help-in-header nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1081 (setq pos idlwave-help-def-pos))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1082 ;; Try to display header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1083 (setq pos (apply 'idlwave-help-find-in-doc-header
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1084 (if top
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1085 (list (car args) (nth 1 args) (nth 2 args) nil)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1086 args)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1087 (if pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1088 (setq idlwave-help-in-header t)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1089 (error "Cannot find doclib header for routine %s"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1090 (idlwave-make-full-name (nth 2 idlwave-help-args)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1091 (nth 0 idlwave-help-args)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1092 (if pos
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1093 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1094 (goto-char pos)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1095 (recenter 0)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1096
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1097 (defvar font-lock-verbose)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1098 (defvar idlwave-mode-syntax-table)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1099 (defvar idlwave-font-lock-defaults)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1100 (defun idlwave-help-fontify ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1101 "Fontify the Help buffer as source code.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1102 Useful when source code is displayed as help. See the option
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1103 `idlwave-help-fontify-source-code'."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1104 (interactive)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1105 (if (featurep 'font-lock)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1106 (let ((major-mode 'idlwave-mode)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1107 (font-lock-verbose
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1108 (if (interactive-p) font-lock-verbose nil))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1109 (syntax-table (syntax-table)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1110 (unwind-protect
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1111 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1112 (set-syntax-table idlwave-mode-syntax-table)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1113 (set (make-local-variable 'font-lock-defaults)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1114 idlwave-font-lock-defaults)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1115 (font-lock-fontify-buffer))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1116 (set-syntax-table syntax-table)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1117
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1118
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1119 (defun idlwave-help-error (name type class keyword)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1120 (error "Can't find help on %s%s %s"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1121 (or (and (or class name) (idlwave-make-full-name class name))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1122 "<unknown>")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1123 (if keyword (format ", keyword %s" (upcase keyword)) "")
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1124 (if idlwave-html-help-location
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1125 ""
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1126 "(help location unknown)")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1127
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1128 (defun idlwave-help-show-help-frame ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1129 "Show the help frame, creating it if necessary"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1130 ;; Use a special frame for this
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1131 (unless (frame-live-p idlwave-help-frame)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1132 (setq idlwave-help-frame
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1133 (make-frame idlwave-help-frame-parameters))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1134 ;; Strip menubar (?) and toolbar from the Help frame.
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1135 (if (fboundp 'set-specifier)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1136 (progn
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1137 ;; XEmacs
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1138 (let ((sval (cons idlwave-help-frame nil)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1139 ;; (set-specifier menubar-visible-p sval)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1140 (set-specifier default-toolbar-visible-p sval)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1141 ;; Emacs
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1142 (modify-frame-parameters idlwave-help-frame
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1143 '(;;(menu-bar-lines . 0)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1144 (tool-bar-lines . 0)))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1145 (select-frame idlwave-help-frame))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1146
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1147 (defun idlwave-help-get-help-buffer ()
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1148 "Return the IDLWAVE Help buffer. Make it first if necessary."
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1149 (let ((buf (get-buffer "*IDLWAVE Help*")))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1150 (if buf
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1151 nil
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1152 (setq buf (get-buffer-create "*IDLWAVE Help*"))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1153 (save-excursion
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1154 (set-buffer buf)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1155 (idlwave-help-mode)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1156 buf))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1157
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1158 (defun idlwave-grep (regexp list)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1159 (let (rtn)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1160 (while list
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1161 (if (string-match regexp (car list))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1162 (setq rtn (cons (car list) rtn)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1163 (setq list (cdr list)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1164 (nreverse rtn)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1165
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1166 (defun idlwave-entry-has-help (entry)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1167 (and entry (car (nth 5 entry))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1168
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1169 (defun idlwave-has-help (name type class)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1170 "Does this have help associated with it?"
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1171 (let ((entry (idlwave-best-rinfo-assoc name type class (idlwave-routines))))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1172 (idlwave-entry-has-help entry)))
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1173
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1174 (provide 'idlw-help)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1175 (provide 'idlwave-help)
fda404732a9a Initial checkin of HTML help support module.
J.D. Smith <jdsmith@as.arizona.edu>
parents:
diff changeset
1176
58296
4773953f1a10 Restore arch taglines
Miles Bader <miles@gnu.org>
parents: 58295
diff changeset
1177 ;; arch-tag: d27b5505-59de-497f-ba3f-f199fd4fb911
4773953f1a10 Restore arch taglines
Miles Bader <miles@gnu.org>
parents: 58295
diff changeset
1178 ;;; idlw-help.el ends here