diff options
| author | J.D. Smith | 2006-04-06 18:46:56 +0000 |
|---|---|---|
| committer | J.D. Smith | 2006-04-06 18:46:56 +0000 |
| commit | 1af825358c1e6845b95e64980b417d9490e007b3 (patch) | |
| tree | 0132027a6aa5049b03d5972dc5e1c52e6f9b44b0 /lisp | |
| parent | 8e0b12d3cffee376a0922f88b0d049f96252b852 (diff) | |
| download | emacs-1af825358c1e6845b95e64980b417d9490e007b3.tar.gz emacs-1af825358c1e6845b95e64980b417d9490e007b3.zip | |
Update to IDLWAVE version 6.0; see idlwave.org.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/idlw-complete-structtag.el | 22 | ||||
| -rw-r--r-- | lisp/progmodes/idlw-help.el | 377 |
2 files changed, 256 insertions, 143 deletions
diff --git a/lisp/progmodes/idlw-complete-structtag.el b/lisp/progmodes/idlw-complete-structtag.el index cec25fcc25e..bd11602001e 100644 --- a/lisp/progmodes/idlw-complete-structtag.el +++ b/lisp/progmodes/idlw-complete-structtag.el | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | ;;; idlw-complete-structtag.el --- Completion of structure tags. | 1 | ;;; idlw-complete-structtag.el --- Completion of structure tags. |
| 2 | ;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 | 2 | ;; Copyright (c) 2001,2002,2003,2004,2005,2006 Free Software Foundation |
| 3 | ;; Free Software Foundation, Inc. | ||
| 4 | 3 | ||
| 5 | ;; Author: Carsten Dominik <dominik@science.uva.nl> | 4 | ;; Author: Carsten Dominik <dominik@astro.uva.nl> |
| 6 | ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> | 5 | ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> |
| 7 | ;; Version: 1.2 | 6 | ;; Version: 1.2 |
| 8 | ;; Keywords: languages | 7 | ;; Keywords: languages |
| @@ -54,10 +53,10 @@ | |||
| 54 | ;; | 53 | ;; |
| 55 | ;; INSTALLATION | 54 | ;; INSTALLATION |
| 56 | ;; ============ | 55 | ;; ============ |
| 57 | ;; Put this file on the emacs load path and load it with the following | 56 | ;; Put this file on the emacs load path and load it with the following |
| 58 | ;; line in your .emacs file: | 57 | ;; line in your .emacs file: |
| 59 | ;; | 58 | ;; |
| 60 | ;; (add-hook 'idlwave-load-hook | 59 | ;; (add-hook 'idlwave-load-hook |
| 61 | ;; (lambda () (require 'idlw-complete-structtag))) | 60 | ;; (lambda () (require 'idlw-complete-structtag))) |
| 62 | ;; | 61 | ;; |
| 63 | ;; DESCRIPTION | 62 | ;; DESCRIPTION |
| @@ -88,7 +87,7 @@ | |||
| 88 | ;; - You can force an update of the tag list with the usual command | 87 | ;; - You can force an update of the tag list with the usual command |
| 89 | ;; to update routine info in IDLWAVE: C-c C-i | 88 | ;; to update routine info in IDLWAVE: C-c C-i |
| 90 | 89 | ||
| 91 | (defvar idlwave-completion-help-info) | 90 | (require 'idlwave) |
| 92 | 91 | ||
| 93 | ;; Some variables to identify the previously used structure | 92 | ;; Some variables to identify the previously used structure |
| 94 | (defvar idlwave-current-tags-var nil) | 93 | (defvar idlwave-current-tags-var nil) |
| @@ -107,7 +106,7 @@ | |||
| 107 | (add-hook 'idlwave-update-rinfo-hook 'idlwave-structtag-reset) | 106 | (add-hook 'idlwave-update-rinfo-hook 'idlwave-structtag-reset) |
| 108 | 107 | ||
| 109 | ;;; The main code follows below | 108 | ;;; The main code follows below |
| 110 | 109 | (defvar idlwave-completion-help-info) | |
| 111 | (defun idlwave-complete-structure-tag () | 110 | (defun idlwave-complete-structure-tag () |
| 112 | "Complete a structure tag. | 111 | "Complete a structure tag. |
| 113 | This works by looking in the current file for a structure assignment to a | 112 | This works by looking in the current file for a structure assignment to a |
| @@ -146,9 +145,9 @@ an up-to-date completion list." | |||
| 146 | (not (equal start idlwave-current-tags-completion-pos))) | 145 | (not (equal start idlwave-current-tags-completion-pos))) |
| 147 | (idlwave-prepare-structure-tag-completion var)) | 146 | (idlwave-prepare-structure-tag-completion var)) |
| 148 | (setq idlwave-current-tags-completion-pos start) | 147 | (setq idlwave-current-tags-completion-pos start) |
| 149 | (setq idlwave-completion-help-info | 148 | (setq idlwave-completion-help-info |
| 150 | (list 'idlwave-complete-structure-tag-help)) | 149 | (list 'idlwave-complete-structure-tag-help)) |
| 151 | (idlwave-complete-in-buffer 'structtag 'structtag | 150 | (idlwave-complete-in-buffer 'structtag 'structtag |
| 152 | idlwave-current-struct-tags nil | 151 | idlwave-current-struct-tags nil |
| 153 | "Select a structure tag" "structure tag") | 152 | "Select a structure tag" "structure tag") |
| 154 | t) ; we did the completion: return t to skip other completions | 153 | t) ; we did the completion: return t to skip other completions |
| @@ -167,7 +166,7 @@ an up-to-date completion list." | |||
| 167 | (if (eq major-mode 'idlwave-shell-mode) | 166 | (if (eq major-mode 'idlwave-shell-mode) |
| 168 | ;; OK, we are in the shell, do it dynamically | 167 | ;; OK, we are in the shell, do it dynamically |
| 169 | (progn | 168 | (progn |
| 170 | (message "preparing shell tags") | 169 | (message "preparing shell tags") |
| 171 | ;; The following call puts the tags into `idlwave-current-struct-tags' | 170 | ;; The following call puts the tags into `idlwave-current-struct-tags' |
| 172 | (idlwave-complete-structure-tag-query-shell var) | 171 | (idlwave-complete-structure-tag-query-shell var) |
| 173 | ;; initialize | 172 | ;; initialize |
| @@ -189,7 +188,7 @@ an up-to-date completion list." | |||
| 189 | ;; Find possible definitions of the structure. | 188 | ;; Find possible definitions of the structure. |
| 190 | (while (idlwave-find-structure-definition var nil 'all) | 189 | (while (idlwave-find-structure-definition var nil 'all) |
| 191 | (let ((tags (idlwave-struct-tags))) | 190 | (let ((tags (idlwave-struct-tags))) |
| 192 | (when tags | 191 | (when tags |
| 193 | ;; initialize | 192 | ;; initialize |
| 194 | (setq idlwave-sint-structtags nil | 193 | (setq idlwave-sint-structtags nil |
| 195 | idlwave-current-tags-buffer (current-buffer) | 194 | idlwave-current-tags-buffer (current-buffer) |
| @@ -242,4 +241,3 @@ an up-to-date completion list." | |||
| 242 | ;;; idlw-complete-structtag.el ends here | 241 | ;;; idlw-complete-structtag.el ends here |
| 243 | 242 | ||
| 244 | 243 | ||
| 245 | ;; arch-tag: d1f9e55c-e504-4187-9c31-3c3651fa4bfa | ||
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el index 17961fa7d9a..d5f9da9ad4c 100644 --- a/lisp/progmodes/idlw-help.el +++ b/lisp/progmodes/idlw-help.el | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | ;;; idlw-help.el --- HTML Help code for IDLWAVE | 1 | ;;; idlw-help.el --- HTML Help code for IDLWAVE |
| 2 | ;; Copyright (c) 2000 Carsten Dominik | 2 | ;; Copyright (c) 2000 Carsten Dominik |
| 3 | ;; Copyright (c) 2001, 2002 J.D. Smith | 3 | ;; Copyright (c) 2001, 2002 J.D. Smith |
| 4 | ;; Copyright (c) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. | 4 | ;; Copyright (c) 2003,2004,2005,2006 Free Software Foundation |
| 5 | ;; | 5 | ;; |
| 6 | ;; Authors: J.D. Smith <jdsmith@as.arizona.edu> | 6 | ;; Authors: J.D. Smith <jdsmith@as.arizona.edu> |
| 7 | ;; Carsten Dominik <dominik@science.uva.nl> | 7 | ;; Carsten Dominik <dominik@science.uva.nl> |
| 8 | ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> | 8 | ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> |
| 9 | ;; Version: 5.7_22 | 9 | ;; Version: 6.0_em22 |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | 12 | ||
| @@ -36,13 +36,13 @@ | |||
| 36 | ;; information, at: | 36 | ;; information, at: |
| 37 | ;; | 37 | ;; |
| 38 | ;; http://idlwave.org | 38 | ;; http://idlwave.org |
| 39 | ;; | 39 | ;; |
| 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | ;;; Code: | 43 | (require 'idlwave) |
| 44 | (defvar browse-url-generic-args) | ||
| 45 | 44 | ||
| 45 | ;;; Code: | ||
| 46 | (defvar idlwave-help-browse-url-available nil | 46 | (defvar idlwave-help-browse-url-available nil |
| 47 | "Whether browse-url is available") | 47 | "Whether browse-url is available") |
| 48 | 48 | ||
| @@ -60,25 +60,32 @@ | |||
| 60 | :group 'idlwave-online-help | 60 | :group 'idlwave-online-help |
| 61 | :type 'boolean) | 61 | :type 'boolean) |
| 62 | 62 | ||
| 63 | (defvar idlwave-html-link-sep | 63 | (defvar idlwave-html-link-sep |
| 64 | (if idlwave-html-help-pre-v6 "#" "#wp")) | 64 | (if idlwave-html-help-pre-v6 "#" "#wp")) |
| 65 | 65 | ||
| 66 | (defcustom idlwave-html-help-location | 66 | (defcustom idlwave-html-system-help-location "help/online_help/" |
| 67 | (if (memq system-type '(ms-dos windows-nt)) | 67 | "The directory, relative to idlwave-system-directory, where the idl |
| 68 | HTML help files live, for IDL 6.2 and later. This location, if found, | ||
| 69 | is used in preference to the old idlwave-html-help-location." | ||
| 70 | :group 'idlwave-online-help | ||
| 71 | :type 'directory) | ||
| 72 | |||
| 73 | (defcustom idlwave-html-help-location | ||
| 74 | (if (memq system-type '(ms-dos windows-nt)) | ||
| 68 | nil | 75 | nil |
| 69 | "/usr/local/etc/") | 76 | "/usr/local/etc/") |
| 70 | "The directory where the idl_html_help/ dir or idl.chm help file | 77 | "The directory where the idl_html_help/ dir lives. Obsolete for IDL |
| 71 | (Windows only) lives." | 78 | 6.2 or later (see idlwave-html-system-help-location)." |
| 72 | :group 'idlwave-online-help | 79 | :group 'idlwave-online-help |
| 73 | :type 'directory) | 80 | :type 'directory) |
| 74 | 81 | ||
| 75 | (defcustom idlwave-help-use-hh nil | 82 | (defvar idlwave-help-use-hh nil |
| 76 | "Whether to use the HTMLHelp viewer with idl.chm (Windows only)." | 83 | "Obsolete variable.") |
| 84 | |||
| 85 | (defcustom idlwave-help-use-assistant t | ||
| 86 | "Whether to use the IDL Assistant as the help browser." | ||
| 77 | :group 'idlwave-online-help | 87 | :group 'idlwave-online-help |
| 78 | :type '(choice :tag "use help viewer" | 88 | :type 'boolean) |
| 79 | (const :tag "<none>" nil) | ||
| 80 | (const :tag "hh" 'hh) | ||
| 81 | (const :tag "keyhh" 'keyhh))) | ||
| 82 | 89 | ||
| 83 | (defcustom idlwave-help-browser-function browse-url-browser-function | 90 | (defcustom idlwave-help-browser-function browse-url-browser-function |
| 84 | "Function to use to display html help. | 91 | "Function to use to display html help. |
| @@ -91,7 +98,9 @@ Defaults to `browse-url-browser-function', which see." | |||
| 91 | :group 'idlwave-online-help | 98 | :group 'idlwave-online-help |
| 92 | :type 'string) | 99 | :type 'string) |
| 93 | 100 | ||
| 94 | (defcustom idlwave-help-browser-generic-args | 101 | (defvar browse-url-generic-args) |
| 102 | |||
| 103 | (defcustom idlwave-help-browser-generic-args | ||
| 95 | (if (boundp 'browse-url-generic-args) | 104 | (if (boundp 'browse-url-generic-args) |
| 96 | browse-url-generic-args "") | 105 | browse-url-generic-args "") |
| 97 | "Program args to use if using browse-url-generic-program." | 106 | "Program args to use if using browse-url-generic-program." |
| @@ -198,7 +207,7 @@ support." | |||
| 198 | 207 | ||
| 199 | (defvar idlwave-help-activate-links-aggressively nil | 208 | (defvar idlwave-help-activate-links-aggressively nil |
| 200 | "Obsolete variable.") | 209 | "Obsolete variable.") |
| 201 | 210 | ||
| 202 | (defvar idlwave-completion-help-info) | 211 | (defvar idlwave-completion-help-info) |
| 203 | 212 | ||
| 204 | (defvar idlwave-help-frame nil | 213 | (defvar idlwave-help-frame nil |
| @@ -289,22 +298,39 @@ Here are all keybindings. | |||
| 289 | (set (make-local-variable 'idlwave-help-def-pos) nil) | 298 | (set (make-local-variable 'idlwave-help-def-pos) nil) |
| 290 | (set (make-local-variable 'idlwave-help-args) nil) | 299 | (set (make-local-variable 'idlwave-help-args) nil) |
| 291 | (set (make-local-variable 'idlwave-help-in-header) nil) | 300 | (set (make-local-variable 'idlwave-help-in-header) nil) |
| 292 | (run-mode-hooks 'idlwave-help-mode-hook)) | 301 | (run-hooks 'idlwave-help-mode-hook)) |
| 293 | 302 | ||
| 294 | (defvar idlwave-system-directory) | ||
| 295 | (defun idlwave-html-help-location () | 303 | (defun idlwave-html-help-location () |
| 296 | "Return the help directory where HTML files are, or nil if that is unknown." | 304 | "Return the help directory where HTML files are, or nil if that is unknown." |
| 297 | (or (and (stringp idlwave-html-help-location) | 305 | (let ((syshelp-dir (expand-file-name |
| 298 | (> (length idlwave-html-help-location) 0) | 306 | idlwave-html-system-help-location (idlwave-sys-dir))) |
| 299 | (file-directory-p idlwave-html-help-location) | 307 | (help-dir (or (and (stringp idlwave-html-help-location) |
| 300 | idlwave-html-help-location) | 308 | (> (length idlwave-html-help-location) 0) |
| 301 | (getenv "IDLWAVE_HELP_LOCATION") | 309 | idlwave-html-help-location) |
| 302 | (and (memq system-type '(ms-dos windows-nt)) ; Base it on sysdir | 310 | (getenv "IDLWAVE_HELP_LOCATION")))) |
| 303 | idlwave-help-use-hh | 311 | (if (file-directory-p syshelp-dir) |
| 304 | (stringp idlwave-system-directory) | 312 | syshelp-dir |
| 305 | (> (length idlwave-system-directory) 0) | 313 | (setq help-dir (expand-file-name "idl_html_help" help-dir)) |
| 306 | (file-directory-p idlwave-system-directory) | 314 | (if (file-directory-p help-dir) help-dir)))) |
| 307 | (expand-file-name "HELP" idlwave-system-directory)))) | 315 | |
| 316 | (defvar idlwave-help-assistant-available nil) | ||
| 317 | |||
| 318 | (defun idlwave-help-check-locations () | ||
| 319 | ;; Check help locations and assistant. | ||
| 320 | (let ((sys-dir (idlwave-sys-dir)) | ||
| 321 | (help-loc (idlwave-html-help-location))) | ||
| 322 | (if (or (not (file-directory-p sys-dir)) | ||
| 323 | (not (file-directory-p help-loc))) | ||
| 324 | (message | ||
| 325 | "HTML help location not found: try setting `idlwave-system-directory' and/or `idlwave-html-help-location'.")) | ||
| 326 | ;; see if we have the assistant | ||
| 327 | (when (and idlwave-help-use-assistant | ||
| 328 | (not (eq (idlwave-help-assistant-available) t))) | ||
| 329 | (message "Cannot locate IDL Assistant, enabling default browser.") | ||
| 330 | (setq idlwave-help-use-assistant nil) | ||
| 331 | (unless idlwave-help-browse-url-available | ||
| 332 | (error "browse-url is not available; install it or IDL Assistant to use HTML help."))))) | ||
| 333 | |||
| 308 | 334 | ||
| 309 | (defvar idlwave-current-obj_new-class) | 335 | (defvar idlwave-current-obj_new-class) |
| 310 | (defvar idlwave-help-diagnostics) | 336 | (defvar idlwave-help-diagnostics) |
| @@ -326,7 +352,7 @@ It collects and prints the diagnostics messages." | |||
| 326 | (setq idlwave-last-context-help-pos marker) | 352 | (setq idlwave-last-context-help-pos marker) |
| 327 | (idlwave-do-context-help1 arg) | 353 | (idlwave-do-context-help1 arg) |
| 328 | (if idlwave-help-diagnostics | 354 | (if idlwave-help-diagnostics |
| 329 | (message "%s" (mapconcat 'identity | 355 | (message "%s" (mapconcat 'identity |
| 330 | (nreverse idlwave-help-diagnostics) | 356 | (nreverse idlwave-help-diagnostics) |
| 331 | "; ")))))) | 357 | "; ")))))) |
| 332 | 358 | ||
| @@ -339,7 +365,7 @@ It collects and prints the diagnostics messages." | |||
| 339 | (defun idlwave-do-context-help1 (&optional arg) | 365 | (defun idlwave-do-context-help1 (&optional arg) |
| 340 | "The work-horse version of `idlwave-context-help', which see." | 366 | "The work-horse version of `idlwave-context-help', which see." |
| 341 | (save-excursion | 367 | (save-excursion |
| 342 | (if (equal (char-after) ?/) | 368 | (if (equal (char-after) ?/) |
| 343 | (forward-char 1) | 369 | (forward-char 1) |
| 344 | (if (equal (char-before) ?=) | 370 | (if (equal (char-before) ?=) |
| 345 | (backward-char 1))) | 371 | (backward-char 1))) |
| @@ -349,15 +375,15 @@ It collects and prints the diagnostics messages." | |||
| 349 | (beg (save-excursion (skip-chars-backward chars) (point))) | 375 | (beg (save-excursion (skip-chars-backward chars) (point))) |
| 350 | (end (save-excursion (skip-chars-forward chars) (point))) | 376 | (end (save-excursion (skip-chars-forward chars) (point))) |
| 351 | (this-word (buffer-substring-no-properties beg end)) | 377 | (this-word (buffer-substring-no-properties beg end)) |
| 352 | (st-ass (assoc (downcase this-word) | 378 | (st-ass (assoc-string this-word |
| 353 | idlwave-help-special-topic-words)) | 379 | idlwave-help-special-topic-words t)) |
| 354 | (classtag (and (string-match "self\\." this-word) | 380 | (classtag (and (string-match "self\\." this-word) |
| 355 | (< beg (- end 4)))) | 381 | (< beg (- end 4)))) |
| 356 | (structtag (and (fboundp 'idlwave-complete-structure-tag) | 382 | (structtag (and (fboundp 'idlwave-complete-structure-tag) |
| 357 | (string-match "\\`\\([^.]+\\)\\." this-word) | 383 | (string-match "\\`\\([^.]+\\)\\." this-word) |
| 358 | (< beg (- end 4)))) | 384 | (< beg (- end 4)))) |
| 359 | module keyword cw mod1 mod2 mod3) | 385 | module keyword cw mod1 mod2 mod3) |
| 360 | (if (or arg | 386 | (if (or arg |
| 361 | (and (not st-ass) | 387 | (and (not st-ass) |
| 362 | (not classtag) | 388 | (not classtag) |
| 363 | (not structtag) | 389 | (not structtag) |
| @@ -376,15 +402,15 @@ It collects and prints the diagnostics messages." | |||
| 376 | (setq module (list "init" 'fun (match-string 1 str)) | 402 | (setq module (list "init" 'fun (match-string 1 str)) |
| 377 | idlwave-current-obj_new-class (match-string 1 str)) | 403 | idlwave-current-obj_new-class (match-string 1 str)) |
| 378 | ))))) | 404 | ))))) |
| 379 | (cond | 405 | (cond |
| 380 | (arg (setq mod1 module)) | 406 | (arg (setq mod1 module)) |
| 381 | 407 | ||
| 382 | ;; A special topic -- only system help | 408 | ;; A special topic -- only system help |
| 383 | (st-ass (setq mod1 (list (cdr st-ass)))) | 409 | (st-ass (setq mod1 (list (cdr st-ass)))) |
| 384 | 410 | ||
| 385 | ;; A system variable -- only system help | 411 | ;; A system variable -- only system help |
| 386 | ((string-match | 412 | ((string-match |
| 387 | "\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?" | 413 | "\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?" |
| 388 | this-word) | 414 | this-word) |
| 389 | (let* ((word (match-string-no-properties 1 this-word)) | 415 | (let* ((word (match-string-no-properties 1 this-word)) |
| 390 | (entry (assq (idlwave-sintern-sysvar word) | 416 | (entry (assq (idlwave-sintern-sysvar word) |
| @@ -396,10 +422,10 @@ It collects and prints the diagnostics messages." | |||
| 396 | (cdr (assq 'tags entry)))))) | 422 | (cdr (assq 'tags entry)))))) |
| 397 | (link (nth 1 (assq 'link entry)))) | 423 | (link (nth 1 (assq 'link entry)))) |
| 398 | (if tag-target | 424 | (if tag-target |
| 399 | (setq link (idlwave-substitute-link-target link | 425 | (setq link (idlwave-substitute-link-target link |
| 400 | tag-target))) | 426 | tag-target))) |
| 401 | (setq mod1 (list link)))) | 427 | (setq mod1 (list link)))) |
| 402 | 428 | ||
| 403 | ;; An executive command -- only system help | 429 | ;; An executive command -- only system help |
| 404 | ((string-match "^\\.\\([A-Z_]+\\)" this-word) | 430 | ((string-match "^\\.\\([A-Z_]+\\)" this-word) |
| 405 | (let* ((word (match-string 1 this-word)) | 431 | (let* ((word (match-string 1 this-word)) |
| @@ -407,7 +433,7 @@ It collects and prints the diagnostics messages." | |||
| 407 | word | 433 | word |
| 408 | idlwave-executive-commands-alist t)))) | 434 | idlwave-executive-commands-alist t)))) |
| 409 | (setq mod1 (list link)))) | 435 | (setq mod1 (list link)))) |
| 410 | 436 | ||
| 411 | ;; A class -- system OR in-text help (via class__define). | 437 | ;; A class -- system OR in-text help (via class__define). |
| 412 | ((and (eq cw 'class) | 438 | ((and (eq cw 'class) |
| 413 | (or (idlwave-in-quote) ; e.g. obj_new | 439 | (or (idlwave-in-quote) ; e.g. obj_new |
| @@ -421,28 +447,28 @@ It collects and prints the diagnostics messages." | |||
| 421 | (name (concat (downcase this-word) "__define")) | 447 | (name (concat (downcase this-word) "__define")) |
| 422 | (link (nth 1 (assq 'link entry)))) | 448 | (link (nth 1 (assq 'link entry)))) |
| 423 | (setq mod1 (list link name 'pro)))) | 449 | (setq mod1 (list link name 'pro)))) |
| 424 | 450 | ||
| 425 | ;; A class structure tag (self.BLAH) -- only in-text help available | 451 | ;; A class structure tag (self.BLAH) -- only in-text help available |
| 426 | (classtag | 452 | (classtag |
| 427 | (let ((tag (substring this-word (match-end 0))) | 453 | (let ((tag (substring this-word (match-end 0))) |
| 428 | class-with found-in) | 454 | class-with found-in) |
| 429 | (when (setq class-with | 455 | (when (setq class-with |
| 430 | (idlwave-class-or-superclass-with-tag | 456 | (idlwave-class-or-superclass-with-tag |
| 431 | (nth 2 (idlwave-current-routine)) | 457 | (nth 2 (idlwave-current-routine)) |
| 432 | tag)) | 458 | tag)) |
| 433 | (setq found-in (idlwave-class-found-in class-with)) | 459 | (setq found-in (idlwave-class-found-in class-with)) |
| 434 | (if (assq (idlwave-sintern-class class-with) | 460 | (if (assq (idlwave-sintern-class class-with) |
| 435 | idlwave-system-class-info) | 461 | idlwave-system-class-info) |
| 436 | (error "No help available for system class tags")) | 462 | (error "No help available for system class tags")) |
| 437 | (setq idlwave-help-do-class-struct-tag t) | 463 | (setq idlwave-help-do-class-struct-tag t) |
| 438 | (setq mod1 (list nil | 464 | (setq mod1 (list nil |
| 439 | (if found-in | 465 | (if found-in |
| 440 | (cons (concat found-in "__define") class-with) | 466 | (cons (concat found-in "__define") class-with) |
| 441 | (concat class-with "__define")) | 467 | (concat class-with "__define")) |
| 442 | 'pro | 468 | 'pro |
| 443 | nil ; no class.... it's a procedure! | 469 | nil ; no class.... it's a procedure! |
| 444 | tag))))) | 470 | tag))))) |
| 445 | 471 | ||
| 446 | ;; A regular structure tag -- only in text, and if | 472 | ;; A regular structure tag -- only in text, and if |
| 447 | ;; optional `complete-structtag' loaded. | 473 | ;; optional `complete-structtag' loaded. |
| 448 | (structtag | 474 | (structtag |
| @@ -453,7 +479,7 @@ It collects and prints the diagnostics messages." | |||
| 453 | (setq idlwave-help-do-struct-tag | 479 | (setq idlwave-help-do-struct-tag |
| 454 | idlwave-structtag-struct-location | 480 | idlwave-structtag-struct-location |
| 455 | mod1 (list nil nil nil nil tag)))) | 481 | mod1 (list nil nil nil nil tag)))) |
| 456 | 482 | ||
| 457 | ;; A routine keyword -- in text or system help | 483 | ;; A routine keyword -- in text or system help |
| 458 | ((and (memq cw '(function-keyword procedure-keyword)) | 484 | ((and (memq cw '(function-keyword procedure-keyword)) |
| 459 | (stringp this-word) | 485 | (stringp this-word) |
| @@ -495,7 +521,7 @@ It collects and prints the diagnostics messages." | |||
| 495 | (setq mod1 (append (list t) module (list keyword)) | 521 | (setq mod1 (append (list t) module (list keyword)) |
| 496 | mod2 (list t this-word 'fun nil) | 522 | mod2 (list t this-word 'fun nil) |
| 497 | mod3 (append (list t) module))))) | 523 | mod3 (append (list t) module))))) |
| 498 | 524 | ||
| 499 | ;; Everything else | 525 | ;; Everything else |
| 500 | (t | 526 | (t |
| 501 | (setq mod1 (append (list t) module)))) | 527 | (setq mod1 (append (list t) module)))) |
| @@ -528,14 +554,14 @@ Needs additional info stored in global `idlwave-completion-help-info'." | |||
| 528 | word link) | 554 | word link) |
| 529 | (mouse-set-point ev) | 555 | (mouse-set-point ev) |
| 530 | 556 | ||
| 531 | 557 | ||
| 532 | ;; See if we can also find help somewhere, e.g. for multiple classes | 558 | ;; See if we can also find help somewhere, e.g. for multiple classes |
| 533 | (setq word (idlwave-this-word)) | 559 | (setq word (idlwave-this-word)) |
| 534 | (if (string= word "") | 560 | (if (string= word "") |
| 535 | (error "No help item selected")) | 561 | (error "No help item selected")) |
| 536 | (setq link (get-text-property 0 'link word)) | 562 | (setq link (get-text-property 0 'link word)) |
| 537 | (select-window cw) | 563 | (select-window cw) |
| 538 | (cond | 564 | (cond |
| 539 | ;; Routine name | 565 | ;; Routine name |
| 540 | ((memq what '(procedure function routine)) | 566 | ((memq what '(procedure function routine)) |
| 541 | (setq name word) | 567 | (setq name word) |
| @@ -546,9 +572,9 @@ Needs additional info stored in global `idlwave-completion-help-info'." | |||
| 546 | type))) | 572 | type))) |
| 547 | (setq link t) ; No specific link valid yet | 573 | (setq link t) ; No specific link valid yet |
| 548 | (if sclasses | 574 | (if sclasses |
| 549 | (setq classes (idlwave-members-only | 575 | (setq classes (idlwave-members-only |
| 550 | classes (cons class sclasses)))) | 576 | classes (cons class sclasses)))) |
| 551 | (setq class (idlwave-popup-select ev classes | 577 | (setq class (idlwave-popup-select ev classes |
| 552 | "Select Class" 'sort)))) | 578 | "Select Class" 'sort)))) |
| 553 | 579 | ||
| 554 | ;; XXX is this necessary, given all-method-classes? | 580 | ;; XXX is this necessary, given all-method-classes? |
| @@ -568,7 +594,7 @@ Needs additional info stored in global `idlwave-completion-help-info'." | |||
| 568 | type))) | 594 | type))) |
| 569 | (setq link t) ; Link can't be correct yet | 595 | (setq link t) ; Link can't be correct yet |
| 570 | (if sclasses | 596 | (if sclasses |
| 571 | (setq classes (idlwave-members-only | 597 | (setq classes (idlwave-members-only |
| 572 | classes (cons class sclasses)))) | 598 | classes (cons class sclasses)))) |
| 573 | (setq class (idlwave-popup-select ev classes | 599 | (setq class (idlwave-popup-select ev classes |
| 574 | "Select Class" 'sort)) | 600 | "Select Class" 'sort)) |
| @@ -580,14 +606,14 @@ Needs additional info stored in global `idlwave-completion-help-info'." | |||
| 580 | (if (string= (downcase name) "obj_new") | 606 | (if (string= (downcase name) "obj_new") |
| 581 | (setq class idlwave-current-obj_new-class | 607 | (setq class idlwave-current-obj_new-class |
| 582 | name "Init")))) | 608 | name "Init")))) |
| 583 | 609 | ||
| 584 | ;; Class name | 610 | ;; Class name |
| 585 | ((eq what 'class) | 611 | ((eq what 'class) |
| 586 | (setq class word | 612 | (setq class word |
| 587 | word nil)) | 613 | word nil)) |
| 588 | 614 | ||
| 589 | ;; A special named function to call which sets some of our variables | 615 | ;; A special named function to call which sets some of our variables |
| 590 | ((and (symbolp what) | 616 | ((and (symbolp what) |
| 591 | (fboundp what)) | 617 | (fboundp what)) |
| 592 | (funcall what 'set word)) | 618 | (funcall what 'set word)) |
| 593 | 619 | ||
| @@ -602,7 +628,7 @@ Needs additional info stored in global `idlwave-completion-help-info'." | |||
| 602 | "Highlight all completions for which help is available and attach link. | 628 | "Highlight all completions for which help is available and attach link. |
| 603 | Those words in `idlwave-completion-help-links' have links. The | 629 | Those words in `idlwave-completion-help-links' have links. The |
| 604 | `idlwave-help-link' face is used for this." | 630 | `idlwave-help-link' face is used for this." |
| 605 | (if idlwave-highlight-help-links-in-completion | 631 | (if idlwave-highlight-help-links-in-completion |
| 606 | (with-current-buffer (get-buffer "*Completions*") | 632 | (with-current-buffer (get-buffer "*Completions*") |
| 607 | (save-excursion | 633 | (save-excursion |
| 608 | (let* ((case-fold-search t) | 634 | (let* ((case-fold-search t) |
| @@ -618,7 +644,7 @@ Those words in `idlwave-completion-help-links' have links. The | |||
| 618 | (setq beg (match-beginning 1) end (match-end 1) | 644 | (setq beg (match-beginning 1) end (match-end 1) |
| 619 | word (match-string 1) doit nil) | 645 | word (match-string 1) doit nil) |
| 620 | ;; Call special completion function test | 646 | ;; Call special completion function test |
| 621 | (if (and (symbolp what) | 647 | (if (and (symbolp what) |
| 622 | (fboundp what)) | 648 | (fboundp what)) |
| 623 | (setq doit (funcall what 'test word)) | 649 | (setq doit (funcall what 'test word)) |
| 624 | ;; Look for special link property passed in help-links | 650 | ;; Look for special link property passed in help-links |
| @@ -649,13 +675,13 @@ Those words in `idlwave-completion-help-links' have links. The | |||
| 649 | ;; Try to select the return frame. | 675 | ;; Try to select the return frame. |
| 650 | ;; This can crash on slow network connections, obviously when | 676 | ;; This can crash on slow network connections, obviously when |
| 651 | ;; we kill the help frame before the return-frame is selected. | 677 | ;; we kill the help frame before the return-frame is selected. |
| 652 | ;; To protect the workings, we wait for up to one second | 678 | ;; To protect the workings, we wait for up to one second |
| 653 | ;; and check if the return-frame *is* now selected. | 679 | ;; and check if the return-frame *is* now selected. |
| 654 | ;; This is marked "eperimental" since we are not sure when its OK. | 680 | ;; This is marked "eperimental" since we are not sure when its OK. |
| 655 | (let ((maxtime 1.0) (time 0.) (step 0.1)) | 681 | (let ((maxtime 1.0) (time 0.) (step 0.1)) |
| 656 | (select-frame idlwave-help-return-frame) | 682 | (select-frame idlwave-help-return-frame) |
| 657 | (while (and (sit-for step) | 683 | (while (and (sit-for step) |
| 658 | (not (eq (selected-frame) | 684 | (not (eq (selected-frame) |
| 659 | idlwave-help-return-frame)) | 685 | idlwave-help-return-frame)) |
| 660 | (< (setq time (+ time step)) maxtime))))) | 686 | (< (setq time (+ time step)) maxtime))))) |
| 661 | (delete-frame idlwave-help-frame)) | 687 | (delete-frame idlwave-help-frame)) |
| @@ -668,7 +694,7 @@ Those words in `idlwave-completion-help-links' have links. The | |||
| 668 | (defvar default-toolbar-visible-p) | 694 | (defvar default-toolbar-visible-p) |
| 669 | 695 | ||
| 670 | (defun idlwave-help-display-help-window (&optional pos-or-func) | 696 | (defun idlwave-help-display-help-window (&optional pos-or-func) |
| 671 | "Display the help window. | 697 | "Display the help window. |
| 672 | Move window start to POS-OR-FUNC, if passed as a position, or call it | 698 | Move window start to POS-OR-FUNC, if passed as a position, or call it |
| 673 | if passed as a function. See `idlwave-help-use-dedicated-frame'." | 699 | if passed as a function. See `idlwave-help-use-dedicated-frame'." |
| 674 | (let ((cw (selected-window)) | 700 | (let ((cw (selected-window)) |
| @@ -679,13 +705,13 @@ if passed as a function. See `idlwave-help-use-dedicated-frame'." | |||
| 679 | (switch-to-buffer buf)) | 705 | (switch-to-buffer buf)) |
| 680 | ;; Do it in this frame and save the window configuration | 706 | ;; Do it in this frame and save the window configuration |
| 681 | (if (not (get-buffer-window buf nil)) | 707 | (if (not (get-buffer-window buf nil)) |
| 682 | (setq idlwave-help-window-configuration | 708 | (setq idlwave-help-window-configuration |
| 683 | (current-window-configuration))) | 709 | (current-window-configuration))) |
| 684 | (display-buffer buf nil (selected-frame)) | 710 | (display-buffer buf nil (selected-frame)) |
| 685 | (select-window (get-buffer-window buf))) | 711 | (select-window (get-buffer-window buf))) |
| 686 | (raise-frame) | 712 | (raise-frame) |
| 687 | (if pos-or-func | 713 | (if pos-or-func |
| 688 | (if (functionp pos-or-func) | 714 | (if (functionp pos-or-func) |
| 689 | (funcall pos-or-func) | 715 | (funcall pos-or-func) |
| 690 | (goto-char pos-or-func) | 716 | (goto-char pos-or-func) |
| 691 | (recenter 0))) | 717 | (recenter 0))) |
| @@ -707,31 +733,43 @@ if passed as a function. See `idlwave-help-use-dedicated-frame'." | |||
| 707 | (select-frame idlwave-help-return-frame))) | 733 | (select-frame idlwave-help-return-frame))) |
| 708 | 734 | ||
| 709 | (defun idlwave-online-help (link &optional name type class keyword) | 735 | (defun idlwave-online-help (link &optional name type class keyword) |
| 710 | "Display HTML or other special help on a certain topic. | 736 | "Display HTML or other special help on a certain topic. |
| 711 | Either loads an HTML link, if LINK is non-nil, or gets special-help on | 737 | Either loads an HTML link, if LINK is non-nil, or gets special-help on |
| 712 | the optional arguments, if any special help is defined. If LINK is | 738 | the optional arguments, if any special help is defined. If LINK is |
| 713 | `t', first look up the optional arguments in the routine info list to | 739 | `t', first look up the optional arguments in the routine info list to |
| 714 | see if a link is set for it. Try extra help functions if necessary." | 740 | see if a link is set for it. Try extra help functions if necessary." |
| 715 | ;; Lookup link | 741 | ;; Lookup link |
| 716 | (if (eq link t) | 742 | (if (eq link t) |
| 717 | (let ((entry (idlwave-best-rinfo-assoc name type class | 743 | (let ((entry (idlwave-best-rinfo-assoc name type class |
| 718 | (idlwave-routines) nil t))) | 744 | (idlwave-routines) nil t))) |
| 719 | (cond | 745 | (if entry |
| 720 | ;; Try keyword link | 746 | (cond |
| 721 | ((and keyword | 747 | ;; Try keyword link |
| 722 | (setq link (cdr (idlwave-entry-find-keyword entry keyword))))) | 748 | ((and keyword |
| 723 | ;; Default, regular entry link | 749 | (setq link (cdr |
| 724 | (t (setq link (idlwave-entry-has-help entry)))))) | 750 | (idlwave-entry-find-keyword entry keyword))))) |
| 751 | ;; Default, regular entry link | ||
| 752 | (t (setq link (idlwave-entry-has-help entry)))) | ||
| 753 | (if (and | ||
| 754 | class | ||
| 755 | ;; Check for system class help | ||
| 756 | (setq entry (assq (idlwave-sintern-class class) | ||
| 757 | idlwave-system-class-info) | ||
| 758 | link (nth 1 (assq 'link entry)))) | ||
| 759 | (message | ||
| 760 | (concat "No routine info for %s" | ||
| 761 | ", falling back on class help.") | ||
| 762 | (idlwave-make-full-name class name)))))) | ||
| 725 | 763 | ||
| 726 | (cond | 764 | (cond |
| 727 | ;; An explicit link | 765 | ;; An explicit link |
| 728 | ((stringp link) | 766 | ((stringp link) |
| 729 | (idlwave-help-html-link link)) | 767 | (idlwave-help-html-link link)) |
| 730 | 768 | ||
| 731 | ;; Any extra help | 769 | ;; Any extra help |
| 732 | (idlwave-extra-help-function | 770 | (idlwave-extra-help-function |
| 733 | (idlwave-help-get-special-help name type class keyword)) | 771 | (idlwave-help-get-special-help name type class keyword)) |
| 734 | 772 | ||
| 735 | ;; Nothing worked | 773 | ;; Nothing worked |
| 736 | (t (idlwave-help-error name type class keyword)))) | 774 | (t (idlwave-help-error name type class keyword)))) |
| 737 | 775 | ||
| @@ -742,7 +780,7 @@ see if a link is set for it. Try extra help functions if necessary." | |||
| 742 | (help-pos (save-excursion | 780 | (help-pos (save-excursion |
| 743 | (set-buffer (idlwave-help-get-help-buffer)) | 781 | (set-buffer (idlwave-help-get-help-buffer)) |
| 744 | (let ((buffer-read-only nil)) | 782 | (let ((buffer-read-only nil)) |
| 745 | (funcall idlwave-extra-help-function | 783 | (funcall idlwave-extra-help-function |
| 746 | name type class keyword))))) | 784 | name type class keyword))))) |
| 747 | (if help-pos | 785 | (if help-pos |
| 748 | (idlwave-help-display-help-window help-pos) | 786 | (idlwave-help-display-help-window help-pos) |
| @@ -757,36 +795,22 @@ see if a link is set for it. Try extra help functions if necessary." | |||
| 757 | ;(browse-url-generic-args idlwave-help-browser-generic-args) | 795 | ;(browse-url-generic-args idlwave-help-browser-generic-args) |
| 758 | full-link) | 796 | full-link) |
| 759 | 797 | ||
| 760 | (unless idlwave-help-browse-url-available | 798 | ;; Just a regular file name (+ anchor name) |
| 761 | (error "browse-url is not available -- install it to use HTML help.")) | 799 | (unless (and (stringp help-loc) |
| 800 | (file-directory-p help-loc)) | ||
| 801 | (error "Invalid help location.")) | ||
| 802 | (setq full-link (browse-url-file-url (expand-file-name link help-loc))) | ||
| 762 | 803 | ||
| 763 | (if (and (memq system-type '(ms-dos windows-nt)) | 804 | ;; Select the browser |
| 764 | idlwave-help-use-hh) | 805 | (cond |
| 765 | (progn | 806 | (idlwave-help-use-assistant |
| 766 | (setq browse-url-browser-function 'browse-url-generic | 807 | (idlwave-help-assistant-open-link link)) |
| 767 | full-link (concat (expand-file-name "idl.chm" help-loc) | 808 | |
| 768 | "::/" | 809 | ((or idlwave-help-browser-is-local |
| 769 | link)) | 810 | (string-match "w3" (symbol-name idlwave-help-browser-function))) |
| 770 | (if (memq 'keyhh idlwave-help-use-hh) | 811 | (idlwave-help-display-help-window '(lambda () (browse-url full-link)))) |
| 771 | (setq browse-url-generic-program "KEYHH" | 812 | |
| 772 | browse-url-generic-args '("-IDLWAVE")) | 813 | (t (browse-url full-link))))) |
| 773 | (setq browse-url-generic-program "HH"))) | ||
| 774 | ;; Just a regular file name (+ anchor name) | ||
| 775 | (unless (and (stringp help-loc) | ||
| 776 | (file-directory-p help-loc)) | ||
| 777 | (error | ||
| 778 | "Invalid help location; customize `idlwave-html-help-location'.")) | ||
| 779 | (setq full-link (concat | ||
| 780 | "file://" | ||
| 781 | (expand-file-name | ||
| 782 | link | ||
| 783 | (expand-file-name "idl_html_help" help-loc))))) | ||
| 784 | |||
| 785 | ;; Check for a local browser | ||
| 786 | (if (or idlwave-help-browser-is-local | ||
| 787 | (string-match "w3" (symbol-name idlwave-help-browser-function))) | ||
| 788 | (idlwave-help-display-help-window '(lambda () (browse-url full-link))) | ||
| 789 | (browse-url full-link)))) | ||
| 790 | 814 | ||
| 791 | ;; A special help routine for source-level syntax help in files. | 815 | ;; A special help routine for source-level syntax help in files. |
| 792 | (defvar idlwave-help-fontify-source-code) | 816 | (defvar idlwave-help-fontify-source-code) |
| @@ -814,7 +838,7 @@ This function can be used as `idlwave-extra-help-function'." | |||
| 814 | (if class-only ;Help with class? Using "Init" as source. | 838 | (if class-only ;Help with class? Using "Init" as source. |
| 815 | (setq name "Init" | 839 | (setq name "Init" |
| 816 | type 'fun)) | 840 | type 'fun)) |
| 817 | (if (not struct-tag) | 841 | (if (not struct-tag) |
| 818 | (setq file | 842 | (setq file |
| 819 | (idlwave-routine-source-file | 843 | (idlwave-routine-source-file |
| 820 | (nth 3 (idlwave-best-rinfo-assoc | 844 | (nth 3 (idlwave-best-rinfo-assoc |
| @@ -827,16 +851,15 @@ This function can be used as `idlwave-extra-help-function'." | |||
| 827 | (if (or struct-tag (stringp file)) | 851 | (if (or struct-tag (stringp file)) |
| 828 | (progn | 852 | (progn |
| 829 | (setq in-buf ; structure-tag completion is always in current buffer | 853 | (setq in-buf ; structure-tag completion is always in current buffer |
| 830 | (if struct-tag | 854 | (if struct-tag |
| 831 | idlwave-current-tags-buffer | 855 | idlwave-current-tags-buffer |
| 832 | (idlwave-get-buffer-visiting file))) | 856 | (idlwave-get-buffer-visiting file))) |
| 833 | ;; see if file is in a visited buffer, insert those contents | 857 | ;; see if file is in a visited buffer, insert those contents |
| 834 | (if in-buf | 858 | (if in-buf |
| 835 | (progn | 859 | (progn |
| 836 | (setq file (buffer-file-name in-buf)) | 860 | (setq file (buffer-file-name in-buf)) |
| 837 | (erase-buffer) | 861 | (erase-buffer) |
| 838 | (insert-buffer-substring in-buf) | 862 | (insert-buffer-substring in-buf)) |
| 839 | (goto-char (point-min))) | ||
| 840 | (if (file-exists-p file) ;; otherwise just load the file | 863 | (if (file-exists-p file) ;; otherwise just load the file |
| 841 | (progn | 864 | (progn |
| 842 | (erase-buffer) | 865 | (erase-buffer) |
| @@ -850,19 +873,19 @@ This function can be used as `idlwave-extra-help-function'." | |||
| 850 | ;; Try to find a good place to display | 873 | ;; Try to find a good place to display |
| 851 | (setq def-pos | 874 | (setq def-pos |
| 852 | ;; Find the class structure tag if that's what we're after | 875 | ;; Find the class structure tag if that's what we're after |
| 853 | (cond | 876 | (cond |
| 854 | ;; Class structure tags: find the class or named structure | 877 | ;; Class structure tags: find the class or named structure |
| 855 | ;; definition | 878 | ;; definition |
| 856 | (class-struct-tag | 879 | (class-struct-tag |
| 857 | (save-excursion | 880 | (save-excursion |
| 858 | (setq class | 881 | (setq class |
| 859 | (if (string-match "[a-zA-Z0-9]\\(__\\)" name) | 882 | (if (string-match "[a-zA-Z0-9]\\(__\\)" name) |
| 860 | (substring name 0 (match-beginning 1)) | 883 | (substring name 0 (match-beginning 1)) |
| 861 | idlwave-current-tags-class)) | 884 | idlwave-current-tags-class)) |
| 862 | (and | 885 | (and |
| 863 | (idlwave-find-class-definition class nil real-class) | 886 | (idlwave-find-class-definition class nil real-class) |
| 864 | (idlwave-find-struct-tag keyword)))) | 887 | (idlwave-find-struct-tag keyword)))) |
| 865 | 888 | ||
| 866 | ;; Generic structure tags: the structure definition | 889 | ;; Generic structure tags: the structure definition |
| 867 | ;; location within the file has been recorded in | 890 | ;; location within the file has been recorded in |
| 868 | ;; `struct-tag' | 891 | ;; `struct-tag' |
| @@ -872,14 +895,14 @@ This function can be used as `idlwave-extra-help-function'." | |||
| 872 | (integerp struct-tag) | 895 | (integerp struct-tag) |
| 873 | (goto-char struct-tag) | 896 | (goto-char struct-tag) |
| 874 | (idlwave-find-struct-tag keyword)))) | 897 | (idlwave-find-struct-tag keyword)))) |
| 875 | 898 | ||
| 876 | ;; Just find the routine definition | 899 | ;; Just find the routine definition |
| 877 | (t | 900 | (t |
| 878 | (if class-only (point-min) | 901 | (if class-only (point-min) |
| 879 | (idlwave-help-find-routine-definition name type class keyword)))) | 902 | (idlwave-help-find-routine-definition name type class keyword)))) |
| 880 | idlwave-help-def-pos def-pos) | 903 | idlwave-help-def-pos def-pos) |
| 881 | 904 | ||
| 882 | (if (and idlwave-help-source-try-header | 905 | (if (and idlwave-help-source-try-header |
| 883 | (not (or struct-tag class-struct-tag))) | 906 | (not (or struct-tag class-struct-tag))) |
| 884 | ;; Check if we can find the header | 907 | ;; Check if we can find the header |
| 885 | (save-excursion | 908 | (save-excursion |
| @@ -889,7 +912,7 @@ This function can be used as `idlwave-extra-help-function'." | |||
| 889 | idlwave-help-in-header header-pos))) | 912 | idlwave-help-in-header header-pos))) |
| 890 | 913 | ||
| 891 | (if (or header-pos def-pos) | 914 | (if (or header-pos def-pos) |
| 892 | (progn | 915 | (progn |
| 893 | (if (boundp 'idlwave-help-min-frame-width) | 916 | (if (boundp 'idlwave-help-min-frame-width) |
| 894 | (setq idlwave-help-min-frame-width 80)) | 917 | (setq idlwave-help-min-frame-width 80)) |
| 895 | (goto-char (or header-pos def-pos))) | 918 | (goto-char (or header-pos def-pos))) |
| @@ -903,7 +926,7 @@ This function can be used as `idlwave-extra-help-function'." | |||
| 903 | KEYWORD is ignored. Returns the point of match if successful, nil otherwise." | 926 | KEYWORD is ignored. Returns the point of match if successful, nil otherwise." |
| 904 | (save-excursion | 927 | (save-excursion |
| 905 | (goto-char (point-max)) | 928 | (goto-char (point-max)) |
| 906 | (if (re-search-backward | 929 | (if (re-search-backward |
| 907 | (concat "^[ \t]*" | 930 | (concat "^[ \t]*" |
| 908 | (if (eq type 'pro) "pro" | 931 | (if (eq type 'pro) "pro" |
| 909 | (if (eq type 'fun) "function" | 932 | (if (eq type 'fun) "function" |
| @@ -949,22 +972,22 @@ with spaces allowed between the keyword and the following dash or equal sign. | |||
| 949 | If there is a match, we assume it is the keyword description." | 972 | If there is a match, we assume it is the keyword description." |
| 950 | (let* ((case-fold-search t) | 973 | (let* ((case-fold-search t) |
| 951 | (rname (if (stringp class) | 974 | (rname (if (stringp class) |
| 952 | (concat | 975 | (concat |
| 953 | "\\(" | 976 | "\\(" |
| 954 | ;; Traditional name or class::name | 977 | ;; Traditional name or class::name |
| 955 | "\\(" | 978 | "\\(" |
| 956 | "\\(" (regexp-quote (downcase class)) "::\\)?" | 979 | "\\(" (regexp-quote (downcase class)) "::\\)?" |
| 957 | (regexp-quote (downcase name)) | 980 | (regexp-quote (downcase name)) |
| 958 | "\\>\\)" | 981 | "\\>\\)" |
| 959 | (concat | 982 | (concat |
| 960 | "\\|" | 983 | "\\|" |
| 961 | ;; class__define or just class | 984 | ;; class__define or just class |
| 962 | (regexp-quote (downcase class)) "\\(__define\\)?") | 985 | (regexp-quote (downcase class)) "\\(__define\\)?") |
| 963 | "\\)") | 986 | "\\)") |
| 964 | (regexp-quote (downcase name)))) | 987 | (regexp-quote (downcase name)))) |
| 965 | 988 | ||
| 966 | ;; NAME tag plus the routine name. The new version is from JD. | 989 | ;; NAME tag plus the routine name. The new version is from JD. |
| 967 | (name-re (concat | 990 | (name-re (concat |
| 968 | "\\(^;+\\*?[ \t]*" | 991 | "\\(^;+\\*?[ \t]*" |
| 969 | idlwave-help-doclib-name | 992 | idlwave-help-doclib-name |
| 970 | "\\([ \t]*:\\|[ \t]*$\\)[ \t]*\\(\n;+[ \t]*\\)*" | 993 | "\\([ \t]*:\\|[ \t]*$\\)[ \t]*\\(\n;+[ \t]*\\)*" |
| @@ -999,7 +1022,7 @@ If there is a match, we assume it is the keyword description." | |||
| 999 | (regexp-quote (upcase keyword)) | 1022 | (regexp-quote (upcase keyword)) |
| 1000 | "\\>"))) | 1023 | "\\>"))) |
| 1001 | dstart dend name-pos kwds-pos kwd-pos) | 1024 | dstart dend name-pos kwds-pos kwd-pos) |
| 1002 | (catch 'exit | 1025 | (catch 'exit |
| 1003 | (save-excursion | 1026 | (save-excursion |
| 1004 | (goto-char (point-min)) | 1027 | (goto-char (point-min)) |
| 1005 | (while (and (setq dstart (re-search-forward idlwave-doclib-start nil t)) | 1028 | (while (and (setq dstart (re-search-forward idlwave-doclib-start nil t)) |
| @@ -1007,7 +1030,7 @@ If there is a match, we assume it is the keyword description." | |||
| 1007 | ;; found a routine header | 1030 | ;; found a routine header |
| 1008 | (goto-char dstart) | 1031 | (goto-char dstart) |
| 1009 | (if (setq name-pos (re-search-forward name-re dend t)) | 1032 | (if (setq name-pos (re-search-forward name-re dend t)) |
| 1010 | (progn | 1033 | (progn |
| 1011 | (if keyword | 1034 | (if keyword |
| 1012 | ;; We do need a keyword | 1035 | ;; We do need a keyword |
| 1013 | (progn | 1036 | (progn |
| @@ -1089,7 +1112,7 @@ When DING is non-nil, ring the bell as well." | |||
| 1089 | (idlwave-help-find-first-header nil) | 1112 | (idlwave-help-find-first-header nil) |
| 1090 | (setq idlwave-help-in-header nil) | 1113 | (setq idlwave-help-in-header nil) |
| 1091 | (idlwave-help-toggle-header-match-and-def arg 'top))) | 1114 | (idlwave-help-toggle-header-match-and-def arg 'top))) |
| 1092 | 1115 | ||
| 1093 | (defun idlwave-help-toggle-header-match-and-def (arg &optional top) | 1116 | (defun idlwave-help-toggle-header-match-and-def (arg &optional top) |
| 1094 | (interactive "P") | 1117 | (interactive "P") |
| 1095 | (let ((args idlwave-help-args) | 1118 | (let ((args idlwave-help-args) |
| @@ -1101,7 +1124,7 @@ When DING is non-nil, ring the bell as well." | |||
| 1101 | (setq pos idlwave-help-def-pos)) | 1124 | (setq pos idlwave-help-def-pos)) |
| 1102 | ;; Try to display header | 1125 | ;; Try to display header |
| 1103 | (setq pos (apply 'idlwave-help-find-in-doc-header | 1126 | (setq pos (apply 'idlwave-help-find-in-doc-header |
| 1104 | (if top | 1127 | (if top |
| 1105 | (list (car args) (nth 1 args) (nth 2 args) nil) | 1128 | (list (car args) (nth 1 args) (nth 2 args) nil) |
| 1106 | args))) | 1129 | args))) |
| 1107 | (if pos | 1130 | (if pos |
| @@ -1135,7 +1158,7 @@ Useful when source code is displayed as help. See the option | |||
| 1135 | (font-lock-fontify-buffer)) | 1158 | (font-lock-fontify-buffer)) |
| 1136 | (set-syntax-table syntax-table))))) | 1159 | (set-syntax-table syntax-table))))) |
| 1137 | 1160 | ||
| 1138 | 1161 | ||
| 1139 | (defun idlwave-help-error (name type class keyword) | 1162 | (defun idlwave-help-error (name type class keyword) |
| 1140 | (error "Can't find help on %s%s %s" | 1163 | (error "Can't find help on %s%s %s" |
| 1141 | (or (and (or class name) (idlwave-make-full-name class name)) | 1164 | (or (and (or class name) (idlwave-make-full-name class name)) |
| @@ -1191,6 +1214,98 @@ Useful when source code is displayed as help. See the option | |||
| 1191 | (let ((entry (idlwave-best-rinfo-assoc name type class (idlwave-routines)))) | 1214 | (let ((entry (idlwave-best-rinfo-assoc name type class (idlwave-routines)))) |
| 1192 | (idlwave-entry-has-help entry))) | 1215 | (idlwave-entry-has-help entry))) |
| 1193 | 1216 | ||
| 1217 | ;;----- Control the IDL Assistant, which shipped with IDL v6.2 | ||
| 1218 | (defvar idlwave-help-assistant-process nil) | ||
| 1219 | (defvar idlwave-help-assistant-socket nil) | ||
| 1220 | |||
| 1221 | ;; The Windows version does not have a !DIR/bin/* set of front-end | ||
| 1222 | ;; scripts, but instead only links directly to bin.x86. As a result, | ||
| 1223 | ;; we must pass the -profile argument as well. | ||
| 1224 | (defvar idlwave-help-assistant-command | ||
| 1225 | (if (memq system-type '(ms-dos windows-nt)) | ||
| 1226 | "bin/bin.x86/idl_assistant" | ||
| 1227 | "bin/idl_assistant") | ||
| 1228 | "The command, rooted at idlwave-system-directory, which invokes the | ||
| 1229 | IDL assistant.") | ||
| 1230 | |||
| 1231 | (defun idlwave-help-assistant-available () | ||
| 1232 | (if idlwave-help-assistant-available | ||
| 1233 | (eq idlwave-help-assistant-available t) | ||
| 1234 | (setq idlwave-help-assistant-available | ||
| 1235 | (if (file-executable-p (idlwave-help-assistant-command)) | ||
| 1236 | t | ||
| 1237 | 'not-available)))) | ||
| 1238 | |||
| 1239 | (defun idlwave-help-assistant-command () | ||
| 1240 | (expand-file-name idlwave-help-assistant-command (idlwave-sys-dir))) | ||
| 1241 | |||
| 1242 | (defun idlwave-help-assistant-start (&optional link) | ||
| 1243 | "Start the IDL Assistant, loading LINK, if passed." | ||
| 1244 | (when (or (not idlwave-help-assistant-socket) | ||
| 1245 | (not (eq (process-status idlwave-help-assistant-socket) 'open))) | ||
| 1246 | (let* ((help-loc (idlwave-html-help-location)) | ||
| 1247 | (command (idlwave-help-assistant-command)) | ||
| 1248 | (extra-args | ||
| 1249 | (nconc | ||
| 1250 | (if (memq system-type '(ms-dos windows-nt)) | ||
| 1251 | `("-profile" ,(expand-file-name "idl.adp" help-loc))) | ||
| 1252 | (if link | ||
| 1253 | `("-file" ,(expand-file-name link help-loc))))) | ||
| 1254 | port) | ||
| 1255 | (if idlwave-help-assistant-socket | ||
| 1256 | (delete-process idlwave-help-assistant-socket)) | ||
| 1257 | |||
| 1258 | (setq idlwave-help-assistant-process | ||
| 1259 | (apply 'start-process | ||
| 1260 | "IDL_ASSISTANT_PROC" nil command "-server" extra-args)) | ||
| 1261 | |||
| 1262 | (set-process-filter idlwave-help-assistant-process | ||
| 1263 | (lambda (proc string) | ||
| 1264 | (setq port (string-to-number string)))) | ||
| 1265 | (unless (accept-process-output idlwave-help-assistant-process 15) | ||
| 1266 | (error "Failed binding IDL_ASSISTANT socket")) | ||
| 1267 | (if (not port) | ||
| 1268 | (error "Unable to open IDL_ASSISTANT.") | ||
| 1269 | (set-process-filter idlwave-help-assistant-process nil) | ||
| 1270 | (setq idlwave-help-assistant-socket | ||
| 1271 | (open-network-stream "IDL_ASSISTANT_SOCK" | ||
| 1272 | nil "localhost" port)) | ||
| 1273 | (if (eq (process-status idlwave-help-assistant-socket) 'open) | ||
| 1274 | (process-send-string idlwave-help-assistant-socket | ||
| 1275 | (concat "setHelpPath " help-loc "\n")) | ||
| 1276 | (idlwave-help-assistant-close) | ||
| 1277 | (error "Cannot communicate with IDL_ASSISTANT")))))) | ||
| 1278 | |||
| 1279 | (defun idlwave-help-assistant-raise () | ||
| 1280 | (idlwave-help-assistant-start) | ||
| 1281 | (process-send-string idlwave-help-assistant-socket "raise\n")) | ||
| 1282 | |||
| 1283 | (defun idlwave-help-assistant-open-link (&optional link) | ||
| 1284 | ;; Open a link (file name with anchor, no leading path) in the assistant. | ||
| 1285 | (if link | ||
| 1286 | (let ((file (expand-file-name link (idlwave-html-help-location)))) | ||
| 1287 | (idlwave-help-assistant-start link) | ||
| 1288 | (process-send-string idlwave-help-assistant-socket | ||
| 1289 | (concat "openLink " file "\n")) | ||
| 1290 | (string-match "\.html" link) | ||
| 1291 | (process-send-string idlwave-help-assistant-socket | ||
| 1292 | (concat "searchIndexNoOpen " | ||
| 1293 | (substring link 0 (match-beginning 0)) | ||
| 1294 | "\n"))) | ||
| 1295 | (idlwave-help-assistant-raise))) | ||
| 1296 | |||
| 1297 | (defun idlwave-help-assistant-close () | ||
| 1298 | (when (and idlwave-help-assistant-process | ||
| 1299 | (eq (process-status idlwave-help-assistant-process) 'run)) | ||
| 1300 | (when idlwave-help-assistant-socket | ||
| 1301 | (process-send-string idlwave-help-assistant-socket "quit\n") | ||
| 1302 | (delete-process idlwave-help-assistant-socket)) | ||
| 1303 | (stop-process idlwave-help-assistant-process) | ||
| 1304 | (delete-process idlwave-help-assistant-process) | ||
| 1305 | (setq idlwave-help-assistant-socket nil | ||
| 1306 | idlwave-help-assistant-process nil))) | ||
| 1307 | |||
| 1308 | |||
| 1194 | (provide 'idlw-help) | 1309 | (provide 'idlw-help) |
| 1195 | (provide 'idlwave-help) | 1310 | (provide 'idlwave-help) |
| 1196 | 1311 | ||