2004-11-17 05:58:20 +00:00
|
|
|
|
;;; idlw-help.el --- HTML Help code for IDLWAVE
|
2007-01-21 03:53:13 +00:00
|
|
|
|
|
2011-01-25 04:08:28 +00:00
|
|
|
|
;; Copyright (C) 2000-2011 Free Software Foundation, Inc.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
|
2005-07-04 01:51:24 +00:00
|
|
|
|
;; Carsten Dominik <dominik@science.uva.nl>
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
|
2010-08-29 16:17:13 +00:00
|
|
|
|
;; Version: 6.1.22
|
2010-08-29 20:10:43 +00:00
|
|
|
|
;; Package: idlwave
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:14:39 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 07:14:39 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; The help link information for IDLWAVE's online help feature for
|
|
|
|
|
;; system routines is extracted automatically from the IDL
|
|
|
|
|
;; documentation, and is available, along with general routine
|
|
|
|
|
;; information, in the file idlw-rinfo.el. The HTML help file
|
|
|
|
|
;; themselves are not distributable with Emacs, but are available,
|
|
|
|
|
;; along with new versions of IDLWAVE, documentation, and more
|
|
|
|
|
;; information, at:
|
|
|
|
|
;;
|
|
|
|
|
;; http://idlwave.org
|
2008-05-06 07:14:39 +00:00
|
|
|
|
;;
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
2005-08-30 11:08:18 +00:00
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
;;; Code:
|
2007-11-20 00:57:10 +00:00
|
|
|
|
(defvar idlwave-help-browse-url-available t
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Whether browse-url is available.")
|
2005-07-04 01:51:24 +00:00
|
|
|
|
|
2007-11-20 00:57:10 +00:00
|
|
|
|
(require 'browse-url)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defgroup idlwave-online-help nil
|
|
|
|
|
"Online Help options for IDLWAVE mode."
|
|
|
|
|
:group 'idlwave)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-html-help-pre-v6 nil
|
|
|
|
|
"Whether pre or post-v6.0 IDL help documents are being used."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(defvar idlwave-html-link-sep
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if idlwave-html-help-pre-v6 "#" "#wp"))
|
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(defcustom idlwave-html-system-help-location "help/online_help/"
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"The directory, relative to `idlwave-system-directory', where the IDL
|
2006-04-06 18:46:56 +00:00
|
|
|
|
HTML help files live, for IDL 6.2 and later. This location, if found,
|
2010-01-02 01:05:44 +00:00
|
|
|
|
is used in preference to the old `idlwave-html-help-location'."
|
2006-04-06 18:46:56 +00:00
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'directory)
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(defcustom idlwave-html-help-location
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(if (memq system-type '(ms-dos windows-nt))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
nil
|
|
|
|
|
"/usr/local/etc/")
|
2006-04-06 18:46:56 +00:00
|
|
|
|
"The directory where the idl_html_help/ dir lives. Obsolete for IDL
|
2010-01-02 01:05:44 +00:00
|
|
|
|
6.2 or later (see `idlwave-html-system-help-location')."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'directory)
|
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(defvar idlwave-help-use-hh nil
|
2008-05-06 07:14:39 +00:00
|
|
|
|
"Obsolete variable.")
|
2006-04-06 18:46:56 +00:00
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-use-assistant t
|
|
|
|
|
"Whether to use the IDL Assistant as the help browser."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
:group 'idlwave-online-help
|
2006-04-06 18:46:56 +00:00
|
|
|
|
:type 'boolean)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-browser-function browse-url-browser-function
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Function to use to display HTML help.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
Defaults to `browse-url-browser-function', which see."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'function)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-browser-generic-program browse-url-generic-program
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Program to run if using `browse-url-generic-program'."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(defvar browse-url-generic-args)
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(defcustom idlwave-help-browser-generic-args
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if (boundp 'browse-url-generic-args)
|
|
|
|
|
browse-url-generic-args "")
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Program args to use if using `browse-url-generic-program'."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-browser-is-local nil
|
|
|
|
|
"Whether the browser will display locally in an Emacs window.
|
|
|
|
|
Several browsers run and/or display inside Emacs windows, but most are
|
|
|
|
|
external programs. If the browser name contains \"-w3\", it is
|
|
|
|
|
assumed to be local to Emacs. For other local browsers, this variable
|
|
|
|
|
must be explicitly set non-nil in order for the variable
|
|
|
|
|
`idlwave-help-use-dedicated-frame' to function."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-directory ""
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Obsolete variable. See `idlwave-html-help-location'.")
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-use-dedicated-frame t
|
|
|
|
|
"*Non-nil means, use a separate frame for Online Help if possible."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-frame-parameters
|
|
|
|
|
'((height . 32) (unsplittable . t))
|
|
|
|
|
"The frame parameters for the special Online Help frame.
|
|
|
|
|
See also `idlwave-help-use-dedicated-frame'.
|
|
|
|
|
If you do not set the frame width here, the value specified in
|
|
|
|
|
`idlw-help.el' will be used."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type '(repeat
|
|
|
|
|
(cons symbol sexp)))
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-max-popup-menu-items 20
|
|
|
|
|
"Maximum number of items per pane in popup menus.
|
|
|
|
|
Currently only used for class selection during completion help."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'integer)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-extra-help-function 'idlwave-help-with-source
|
|
|
|
|
"The function to call for online help if the normal help fails.
|
|
|
|
|
Online help works only for system routines which are described in the
|
|
|
|
|
IDL manuals. A function may be specified to access help from other sources.
|
|
|
|
|
|
|
|
|
|
The function must accept four arguments: NAME, TYPE, CLASS, KEYWORD.
|
|
|
|
|
The Help buffer is current when this function is called, and the help
|
|
|
|
|
text should be loaded into this buffer. If help is found, the
|
|
|
|
|
function should return the buffer position which should be used as
|
|
|
|
|
`window-start' in the help window. Also, the variable
|
|
|
|
|
`idlwave-help-mode-line-indicator' should be set to a useful string,
|
|
|
|
|
which will be displayed in the mode line of the help window. If
|
|
|
|
|
should also set the variable `idlwave-help-min-frame-width' to a
|
|
|
|
|
positive integer. IDLWAVE will ensure that the help frame is at least
|
|
|
|
|
that many columns wide. Failure to find help should be indicated by
|
|
|
|
|
throwing an error.
|
|
|
|
|
|
|
|
|
|
When this variable is non-nil, IDLWAVE will allow the mouse-3 help click
|
|
|
|
|
for every routine and keyword, even though the item may not be highlighted
|
|
|
|
|
in blue (indicating the availability of system documentation).
|
|
|
|
|
|
|
|
|
|
The default value for this function is `idlwave-help-with-source' which
|
|
|
|
|
loads the routine source file into the help buffer. If you try to write
|
|
|
|
|
a different function which accesses a special help file or so, it is
|
|
|
|
|
probably a good idea to still call this function as a fallback."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'symbol)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-fontify-source-code nil
|
|
|
|
|
"*Non-nil means, fontify source code displayed as help like normal code."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-source-try-header t
|
|
|
|
|
"*Non-nil means, try to find help in routine header when displaying source.
|
|
|
|
|
Routines which are not documented in the system manual use their source as
|
|
|
|
|
help text. When this variable is non-nil, we try to find a description of
|
|
|
|
|
the help item in the first routine doclib header above the routine definition.
|
|
|
|
|
If the variable is nil, or if we cannot find/parse the header, the routine
|
|
|
|
|
definition is displayed instead."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-doclib-name "name"
|
|
|
|
|
"*A regexp for the heading word to search for in doclib headers
|
|
|
|
|
which specifies the `name' section. Can be used for localization
|
|
|
|
|
support."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
|
|
|
|
(defcustom idlwave-help-doclib-keyword "KEYWORD"
|
|
|
|
|
"*A regexp for the heading word to search for in doclib headers
|
|
|
|
|
which specifies the `keywords' section. Can be used for localization
|
|
|
|
|
support."
|
|
|
|
|
:group 'idlwave-online-help
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2005-06-14 23:20:55 +00:00
|
|
|
|
(defface idlwave-help-link
|
2011-01-09 21:24:07 +00:00
|
|
|
|
'((t :inherit link))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
"Face for highlighting links into IDLWAVE online help."
|
|
|
|
|
:group 'idlwave-online-help)
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-activate-links-aggressively nil
|
|
|
|
|
"Obsolete variable.")
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(defvar idlwave-completion-help-info)
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-frame nil
|
|
|
|
|
"The frame for display of IDL online help.")
|
|
|
|
|
(defvar idlwave-help-frame-width 102
|
|
|
|
|
"The default width of the help frame.")
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-html-help-is-available nil
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Is the system online help text available?")
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-mode-line-indicator ""
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Used for the special mode line in the `idlwave-help-mode'.")
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-window-configuration nil)
|
|
|
|
|
(defvar idlwave-help-special-topic-words nil) ; defined by get_rinfo
|
|
|
|
|
|
|
|
|
|
;; Define the key bindings for the Help application
|
|
|
|
|
|
Move keymap initialization into declaration.
* lisp/textmodes/enriched.el (enriched-mode-map):
* lisp/textmodes/bib-mode.el (bib-mode-map):
* lisp/term/lk201.el (lk201-function-map):
* lisp/tar-mode.el (tar-mode-map):
* lisp/replace.el (occur-mode-map):
* lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map):
* lisp/progmodes/idlw-help.el (idlwave-help-mode-map):
* lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu):
* lisp/play/solitaire.el (solitaire-mode-map):
* lisp/play/snake.el (snake-mode-map, snake-null-map):
* lisp/play/pong.el (pong-mode-map):
* lisp/play/handwrite.el (menu-bar-handwrite-map):
* lisp/play/gametree.el (gametree-mode-map):
* lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map
(rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map):
* lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map)
(newsticker--url-keymap):
* lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map):
* lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu)
(menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu)
(menu-bar-edit-menu, menu-bar-custom-menu)
(menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu)
(menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu)
(menu-bar-line-wrapping-menu, menu-bar-options-menu)
(menu-bar-games-menu, menu-bar-encryption-decryption-menu)
(menu-bar-tools-menu, menu-bar-describe-menu)
(menu-bar-search-documentation-menu, menu-bar-manuals-menu)
(menu-bar-help-menu):
* lisp/mail/rmailsum.el (rmail-summary-mode-map):
* lisp/kmacro.el (kmacro-step-edit-map):
* lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map)
(ibuffer-mode-operate-map):
* lisp/hi-lock.el (hi-lock-menu, hi-lock-map):
* lisp/emulation/vip.el (vip-mode-map):
* lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map):
* lisp/bookmark.el (bookmark-bmenu-mode-map):
* lisp/help-mode.el (help-mode-map):
* lisp/erc/erc-list.el (erc-list-menu-mode-map):
* lisp/org/org-remember.el (org-remember-mode-map):
* lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.
2011-02-10 16:56:00 +00:00
|
|
|
|
(defvar idlwave-help-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "q" 'idlwave-help-quit)
|
|
|
|
|
(define-key map "w" 'widen)
|
|
|
|
|
(define-key map "\C-m" (lambda (arg)
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(scroll-up arg)))
|
|
|
|
|
(define-key map " " 'scroll-up)
|
|
|
|
|
(define-key map [delete] 'scroll-down)
|
|
|
|
|
(define-key map "h" 'idlwave-help-find-header)
|
|
|
|
|
(define-key map "H" 'idlwave-help-find-first-header)
|
|
|
|
|
(define-key map "." 'idlwave-help-toggle-header-match-and-def)
|
|
|
|
|
(define-key map "F" 'idlwave-help-fontify)
|
|
|
|
|
(define-key map "\M-?" 'idlwave-help-return-to-calling-frame)
|
|
|
|
|
(define-key map "x" 'idlwave-help-return-to-calling-frame)
|
|
|
|
|
map)
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"The keymap used in `idlwave-help-mode'.")
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
;; Define the menu for the Help application
|
|
|
|
|
|
|
|
|
|
(easy-menu-define
|
|
|
|
|
idlwave-help-menu idlwave-help-mode-map
|
|
|
|
|
"Menu for Help IDLWAVE system"
|
|
|
|
|
'("IDLHelp"
|
|
|
|
|
["Definition <-> Help Text" idlwave-help-toggle-header-match-and-def t]
|
|
|
|
|
["Find DocLib Header" idlwave-help-find-header t]
|
|
|
|
|
["Find First DocLib Header" idlwave-help-find-first-header t]
|
|
|
|
|
["Fontify help buffer" idlwave-help-fontify t]
|
|
|
|
|
"--"
|
|
|
|
|
["Quit" idlwave-help-quit t]))
|
|
|
|
|
|
2005-07-04 01:51:24 +00:00
|
|
|
|
(defvar idlwave-help-def-pos)
|
|
|
|
|
(defvar idlwave-help-args)
|
|
|
|
|
(defvar idlwave-help-in-header)
|
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
byte compiler.
(cperl-mode): Use with-no-warnings for setting vc-header-alist.
* progmodes/idlwave.el (idlwave-shell-get-path-info)
(idlwave-shell-temp-file, idlwave-shell-is-running)
(widget-value, comint-dynamic-complete-filename, Info-goto-node):
* progmodes/idlw-help.el (idlwave-prepare-structure-tag-completion)
(idlwave-all-method-classes, idlwave-all-method-keyword-classes)
(idlwave-beginning-of-statement, idlwave-best-rinfo-assoc)
(idlwave-class-found-in, idlwave-class-or-superclass-with-tag)
(idlwave-completing-read, idlwave-current-routine)
(idlwave-downcase-safe, idlwave-entry-find-keyword)
(idlwave-expand-keyword, idlwave-find-class-definition)
(idlwave-find-inherited-class, idlwave-find-struct-tag)
(idlwave-get-buffer-visiting, idlwave-in-quote)
(idlwave-make-full-name, idlwave-members-only)
(idlwave-popup-select, idlwave-routine-source-file)
(idlwave-routines, idlwave-sintern-class)
(idlwave-sintern-keyword, idlwave-sintern-method)
(idlwave-sintern-routine-or-method)
(idlwave-substitute-link-target, idlwave-sys-dir)
(idlwave-this-word, idlwave-what-module-find-class)
(idlwave-where):
* progmodes/idlw-complete-structtag.el (idlwave-shell-buffer):
* mail/uce.el (rmail-msg-is-pruned)
(rmail-maybe-set-message-counters, rmail-msgbeg, rmail-msgend)
(rmail-toggle-header):
* mail/sendmail.el (dired-view-file, dired-get-filename):
* mail/rmailkwd.el (rmail-maybe-set-message-counters)
(rmail-display-labels, rmail-msgbeg)
(rmail-set-message-deleted-p, rmail-message-labels-p)
(rmail-show-message, mail-comma-list-regexp)
(mail-parse-comma-list):
* mail/rmail.el (rmail-spam-filter, rmail-summary-goto-msg)
(rmail-summary-mark-undeleted, rmail-summary-mark-deleted)
(rfc822-addresses, mail-abbrev-make-syntax-table)
(mail-sendmail-delimit-header, mail-header-end):
* mail/hashcash.el (message-narrow-to-headers-or-head)
(message-fetch-field, message-goto-eoh)
(message-narrow-to-headers):
* vc.el (view-mode-exit): Declare as functions.
* mail/vms-pmail.el:
* vmsproc.el:
* vms-patch.el: Don't byte compile these files, they don't work.
* Makefile.in (SOME_MACHINE_LISP): Remove VMS files, they are not
compiled anymore.
2007-11-27 06:57:07 +00:00
|
|
|
|
(declare-function idlwave-prepare-structure-tag-completion "idlw-complete-structtag")
|
|
|
|
|
(declare-function idlwave-all-method-classes "idlwave")
|
|
|
|
|
(declare-function idlwave-all-method-keyword-classes "idlwave")
|
|
|
|
|
(declare-function idlwave-beginning-of-statement "idlwave")
|
|
|
|
|
(declare-function idlwave-best-rinfo-assoc "idlwave")
|
|
|
|
|
(declare-function idlwave-class-found-in "idlwave")
|
|
|
|
|
(declare-function idlwave-class-or-superclass-with-tag "idlwave")
|
|
|
|
|
(declare-function idlwave-completing-read "idlwave")
|
|
|
|
|
(declare-function idlwave-current-routine "idlwave")
|
|
|
|
|
(declare-function idlwave-downcase-safe "idlwave")
|
|
|
|
|
(declare-function idlwave-entry-find-keyword "idlwave")
|
|
|
|
|
(declare-function idlwave-expand-keyword "idlwave")
|
|
|
|
|
(declare-function idlwave-find-class-definition "idlwave")
|
|
|
|
|
(declare-function idlwave-find-inherited-class "idlwave")
|
|
|
|
|
(declare-function idlwave-find-struct-tag "idlwave")
|
|
|
|
|
(declare-function idlwave-get-buffer-visiting "idlwave")
|
|
|
|
|
(declare-function idlwave-in-quote "idlwave")
|
|
|
|
|
(declare-function idlwave-make-full-name "idlwave")
|
|
|
|
|
(declare-function idlwave-members-only "idlwave")
|
|
|
|
|
(declare-function idlwave-popup-select "idlwave")
|
|
|
|
|
(declare-function idlwave-routine-source-file "idlwave")
|
|
|
|
|
(declare-function idlwave-routines "idlwave")
|
|
|
|
|
(declare-function idlwave-sintern-class "idlwave")
|
|
|
|
|
(declare-function idlwave-sintern-keyword "idlwave")
|
|
|
|
|
(declare-function idlwave-sintern-method "idlwave")
|
|
|
|
|
(declare-function idlwave-sintern-routine-or-method "idlwave")
|
2007-11-30 08:42:44 +00:00
|
|
|
|
(declare-function idlwave-sintern-sysvar "idlwave" t t);idlwave-new-sintern-type
|
|
|
|
|
(declare-function idlwave-sintern-sysvartag "idlwave" t t)
|
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
byte compiler.
(cperl-mode): Use with-no-warnings for setting vc-header-alist.
* progmodes/idlwave.el (idlwave-shell-get-path-info)
(idlwave-shell-temp-file, idlwave-shell-is-running)
(widget-value, comint-dynamic-complete-filename, Info-goto-node):
* progmodes/idlw-help.el (idlwave-prepare-structure-tag-completion)
(idlwave-all-method-classes, idlwave-all-method-keyword-classes)
(idlwave-beginning-of-statement, idlwave-best-rinfo-assoc)
(idlwave-class-found-in, idlwave-class-or-superclass-with-tag)
(idlwave-completing-read, idlwave-current-routine)
(idlwave-downcase-safe, idlwave-entry-find-keyword)
(idlwave-expand-keyword, idlwave-find-class-definition)
(idlwave-find-inherited-class, idlwave-find-struct-tag)
(idlwave-get-buffer-visiting, idlwave-in-quote)
(idlwave-make-full-name, idlwave-members-only)
(idlwave-popup-select, idlwave-routine-source-file)
(idlwave-routines, idlwave-sintern-class)
(idlwave-sintern-keyword, idlwave-sintern-method)
(idlwave-sintern-routine-or-method)
(idlwave-substitute-link-target, idlwave-sys-dir)
(idlwave-this-word, idlwave-what-module-find-class)
(idlwave-where):
* progmodes/idlw-complete-structtag.el (idlwave-shell-buffer):
* mail/uce.el (rmail-msg-is-pruned)
(rmail-maybe-set-message-counters, rmail-msgbeg, rmail-msgend)
(rmail-toggle-header):
* mail/sendmail.el (dired-view-file, dired-get-filename):
* mail/rmailkwd.el (rmail-maybe-set-message-counters)
(rmail-display-labels, rmail-msgbeg)
(rmail-set-message-deleted-p, rmail-message-labels-p)
(rmail-show-message, mail-comma-list-regexp)
(mail-parse-comma-list):
* mail/rmail.el (rmail-spam-filter, rmail-summary-goto-msg)
(rmail-summary-mark-undeleted, rmail-summary-mark-deleted)
(rfc822-addresses, mail-abbrev-make-syntax-table)
(mail-sendmail-delimit-header, mail-header-end):
* mail/hashcash.el (message-narrow-to-headers-or-head)
(message-fetch-field, message-goto-eoh)
(message-narrow-to-headers):
* vc.el (view-mode-exit): Declare as functions.
* mail/vms-pmail.el:
* vmsproc.el:
* vms-patch.el: Don't byte compile these files, they don't work.
* Makefile.in (SOME_MACHINE_LISP): Remove VMS files, they are not
compiled anymore.
2007-11-27 06:57:07 +00:00
|
|
|
|
(declare-function idlwave-substitute-link-target "idlwave")
|
|
|
|
|
(declare-function idlwave-sys-dir "idlwave")
|
|
|
|
|
(declare-function idlwave-this-word "idlwave")
|
|
|
|
|
(declare-function idlwave-what-module-find-class "idlwave")
|
|
|
|
|
(declare-function idlwave-where "idlwave")
|
2005-07-04 01:51:24 +00:00
|
|
|
|
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
|
|
|
|
(define-derived-mode idlwave-help-mode special-mode "IDLWAVE Help"
|
2004-11-17 05:58:20 +00:00
|
|
|
|
"Major mode for displaying IDL Help.
|
|
|
|
|
|
|
|
|
|
This is a VIEW mode for the ASCII version of IDL Help files,
|
|
|
|
|
with some extras. Its main purpose is speed - so don't
|
|
|
|
|
expect a fully hyper-linked help.
|
|
|
|
|
|
|
|
|
|
Scrolling: SPC DEL RET
|
|
|
|
|
Text Searches: Inside Topic: Use Emacs search functions
|
|
|
|
|
Exit: [q]uit or mouse button 3 will kill the frame
|
|
|
|
|
|
|
|
|
|
When the hep text is a source file, the following commands are available
|
|
|
|
|
|
|
|
|
|
Fontification: [F]ontify the buffer like source code
|
|
|
|
|
Jump: [h] to function doclib header
|
|
|
|
|
[H] to file doclib header
|
2010-01-02 01:05:44 +00:00
|
|
|
|
[.] back and forth between header and definition
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
Here are all keybindings.
|
|
|
|
|
\\{idlwave-help-mode-map}"
|
|
|
|
|
(buffer-disable-undo)
|
|
|
|
|
(easy-menu-add idlwave-help-menu idlwave-help-mode-map)
|
|
|
|
|
(setq truncate-lines t)
|
|
|
|
|
(setq case-fold-search t)
|
|
|
|
|
(setq mode-line-format
|
|
|
|
|
(list ""
|
|
|
|
|
'mode-line-modified
|
|
|
|
|
'mode-line-buffer-identification
|
|
|
|
|
": " 'idlwave-help-mode-line-indicator
|
|
|
|
|
" -%-"))
|
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
|
(set (make-local-variable 'idlwave-help-def-pos) nil)
|
|
|
|
|
(set (make-local-variable 'idlwave-help-args) nil)
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
|
|
|
|
(set (make-local-variable 'idlwave-help-in-header) nil))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defun idlwave-html-help-location ()
|
|
|
|
|
"Return the help directory where HTML files are, or nil if that is unknown."
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(let ((syshelp-dir (expand-file-name
|
2006-04-06 18:46:56 +00:00
|
|
|
|
idlwave-html-system-help-location (idlwave-sys-dir)))
|
|
|
|
|
(help-dir (or (and (stringp idlwave-html-help-location)
|
|
|
|
|
(> (length idlwave-html-help-location) 0)
|
|
|
|
|
idlwave-html-help-location)
|
|
|
|
|
(getenv "IDLWAVE_HELP_LOCATION"))))
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(if (and syshelp-dir (file-directory-p syshelp-dir))
|
2006-04-06 18:46:56 +00:00
|
|
|
|
syshelp-dir
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if help-dir
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setq help-dir (expand-file-name "idl_html_help" help-dir))
|
|
|
|
|
(if (file-directory-p help-dir) help-dir))))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-assistant-available nil)
|
2006-04-06 18:46:56 +00:00
|
|
|
|
|
|
|
|
|
(defun idlwave-help-check-locations ()
|
|
|
|
|
;; Check help locations and assistant.
|
|
|
|
|
(let ((sys-dir (idlwave-sys-dir))
|
|
|
|
|
(help-loc (idlwave-html-help-location)))
|
|
|
|
|
(if (or (not (file-directory-p sys-dir))
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(not help-loc)
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(not (file-directory-p help-loc)))
|
|
|
|
|
(message
|
|
|
|
|
"HTML help location not found: try setting `idlwave-system-directory' and/or `idlwave-html-help-location'."))
|
|
|
|
|
;; see if we have the assistant
|
|
|
|
|
(when (and idlwave-help-use-assistant
|
|
|
|
|
(not (eq (idlwave-help-assistant-available) t)))
|
|
|
|
|
(message "Cannot locate IDL Assistant, enabling default browser.")
|
|
|
|
|
(setq idlwave-help-use-assistant nil)
|
|
|
|
|
(unless idlwave-help-browse-url-available
|
2009-09-24 01:37:14 +00:00
|
|
|
|
(error "browse-url is not available; install it or IDL Assistant to use HTML help")))))
|
2006-04-06 18:46:56 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar idlwave-current-obj_new-class)
|
|
|
|
|
(defvar idlwave-help-diagnostics)
|
|
|
|
|
(defvar idlwave-experimental)
|
|
|
|
|
(defvar idlwave-last-context-help-pos)
|
|
|
|
|
(defun idlwave-do-context-help (&optional arg)
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Wrapper around the call to `idlwave-do-context-help1'.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
It collects and prints the diagnostics messages."
|
|
|
|
|
(let ((marker (list (current-buffer) (point)))
|
|
|
|
|
(idlwave-help-diagnostics nil))
|
|
|
|
|
;; Check for frame switching. When the command is invoked twice
|
|
|
|
|
;; at the same position, we try to switch to the help frame
|
|
|
|
|
;; FIXME: Frame switching works only on XEmacs
|
|
|
|
|
(if (and idlwave-experimental
|
|
|
|
|
(equal last-command this-command)
|
|
|
|
|
(equal idlwave-last-context-help-pos marker))
|
|
|
|
|
(idlwave-help-select-help-frame)
|
|
|
|
|
;; Do the real thing.
|
|
|
|
|
(setq idlwave-last-context-help-pos marker)
|
|
|
|
|
(idlwave-do-context-help1 arg)
|
|
|
|
|
(if idlwave-help-diagnostics
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(message "%s" (mapconcat 'identity
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(nreverse idlwave-help-diagnostics)
|
|
|
|
|
"; "))))))
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-do-class-struct-tag nil)
|
2005-07-04 01:51:24 +00:00
|
|
|
|
(defvar idlwave-structtag-struct-location)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(defvar idlwave-help-do-struct-tag nil)
|
2005-07-04 01:51:24 +00:00
|
|
|
|
(defvar idlwave-system-variables-alist)
|
|
|
|
|
(defvar idlwave-executive-commands-alist)
|
|
|
|
|
(defvar idlwave-system-class-info)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(defun idlwave-do-context-help1 (&optional arg)
|
|
|
|
|
"The work-horse version of `idlwave-context-help', which see."
|
|
|
|
|
(save-excursion
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (equal (char-after) ?/)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(forward-char 1)
|
|
|
|
|
(if (equal (char-before) ?=)
|
|
|
|
|
(backward-char 1)))
|
|
|
|
|
(let* ((idlwave-query-class nil)
|
|
|
|
|
(idlwave-force-class-query (equal arg '(4)))
|
|
|
|
|
(chars "a-zA-Z0-9_$.!")
|
|
|
|
|
(beg (save-excursion (skip-chars-backward chars) (point)))
|
|
|
|
|
(end (save-excursion (skip-chars-forward chars) (point)))
|
|
|
|
|
(this-word (buffer-substring-no-properties beg end))
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(st-ass (assoc-string this-word
|
|
|
|
|
idlwave-help-special-topic-words t))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(classtag (and (string-match "self\\." this-word)
|
|
|
|
|
(< beg (- end 4))))
|
|
|
|
|
(structtag (and (fboundp 'idlwave-complete-structure-tag)
|
|
|
|
|
(string-match "\\`\\([^.]+\\)\\." this-word)
|
|
|
|
|
(< beg (- end 4))))
|
|
|
|
|
module keyword cw mod1 mod2 mod3)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (or arg
|
2007-03-08 18:31:13 +00:00
|
|
|
|
(and (not classtag)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(not structtag)
|
|
|
|
|
(not (member (string-to-char this-word) '(?! ?.)))))
|
|
|
|
|
;; Need the module information
|
|
|
|
|
(progn
|
|
|
|
|
;; MODULE is (name type class), for this or any inheriting class
|
|
|
|
|
(setq module (idlwave-what-module-find-class)
|
|
|
|
|
cw (nth 2 (idlwave-where))) ;what would we complete here?
|
|
|
|
|
;; Correct for OBJ_NEW, we may need an INIT method instead.
|
|
|
|
|
(if (equal (idlwave-downcase-safe (car module)) "obj_new")
|
|
|
|
|
(let* ((bos (save-excursion (idlwave-beginning-of-statement)
|
|
|
|
|
(point)))
|
|
|
|
|
(str (buffer-substring bos (point))))
|
|
|
|
|
(if (string-match "OBJ_NEW([ \t]*['\"]\\([a-zA-Z][a-zA-Z0-9$_]+\\)['\"]" str)
|
|
|
|
|
(setq module (list "init" 'fun (match-string 1 str))
|
|
|
|
|
idlwave-current-obj_new-class (match-string 1 str))
|
|
|
|
|
)))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(cond
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(arg (setq mod1 module))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A special topic -- only system help
|
2007-03-08 18:31:13 +00:00
|
|
|
|
((and st-ass (not (memq cw '(function-keyword procedure-keyword))))
|
|
|
|
|
(setq mod1 (list (cdr st-ass))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A system variable -- only system help
|
2008-05-06 07:14:39 +00:00
|
|
|
|
((string-match
|
|
|
|
|
"\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?"
|
2004-11-17 05:58:20 +00:00
|
|
|
|
this-word)
|
|
|
|
|
(let* ((word (match-string-no-properties 1 this-word))
|
|
|
|
|
(entry (assq (idlwave-sintern-sysvar word)
|
|
|
|
|
idlwave-system-variables-alist))
|
|
|
|
|
(tag (match-string-no-properties 3 this-word))
|
|
|
|
|
(tag-target (if tag
|
|
|
|
|
(cdr
|
|
|
|
|
(assq (idlwave-sintern-sysvartag tag)
|
|
|
|
|
(cdr (assq 'tags entry))))))
|
|
|
|
|
(link (nth 1 (assq 'link entry))))
|
|
|
|
|
(if tag-target
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq link (idlwave-substitute-link-target link
|
2004-11-17 05:58:20 +00:00
|
|
|
|
tag-target)))
|
|
|
|
|
(setq mod1 (list link))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; An executive command -- only system help
|
|
|
|
|
((string-match "^\\.\\([A-Z_]+\\)" this-word)
|
|
|
|
|
(let* ((word (match-string 1 this-word))
|
2005-05-06 19:25:57 +00:00
|
|
|
|
(link (cdr (assoc-string
|
2004-11-17 05:58:20 +00:00
|
|
|
|
word
|
2005-07-04 01:51:24 +00:00
|
|
|
|
idlwave-executive-commands-alist t))))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(setq mod1 (list link))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A class -- system OR in-text help (via class__define).
|
|
|
|
|
((and (eq cw 'class)
|
|
|
|
|
(or (idlwave-in-quote) ; e.g. obj_new
|
|
|
|
|
(re-search-backward "\\<inherits[ \t]+[A-Za-z0-9_]*\\="
|
|
|
|
|
(max (point-min) (- (point) 40)) t)))
|
|
|
|
|
;; Class completion inside string delimiters must be
|
|
|
|
|
;; the class inside OBJ_NEW.
|
|
|
|
|
(let* ((entry (assq
|
|
|
|
|
(idlwave-sintern-class this-word)
|
|
|
|
|
idlwave-system-class-info))
|
|
|
|
|
(name (concat (downcase this-word) "__define"))
|
|
|
|
|
(link (nth 1 (assq 'link entry))))
|
|
|
|
|
(setq mod1 (list link name 'pro))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A class structure tag (self.BLAH) -- only in-text help available
|
|
|
|
|
(classtag
|
|
|
|
|
(let ((tag (substring this-word (match-end 0)))
|
|
|
|
|
class-with found-in)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(when (setq class-with
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(idlwave-class-or-superclass-with-tag
|
|
|
|
|
(nth 2 (idlwave-current-routine))
|
|
|
|
|
tag))
|
|
|
|
|
(setq found-in (idlwave-class-found-in class-with))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (assq (idlwave-sintern-class class-with)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
idlwave-system-class-info)
|
|
|
|
|
(error "No help available for system class tags"))
|
|
|
|
|
(setq idlwave-help-do-class-struct-tag t)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq mod1 (list nil
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if found-in
|
|
|
|
|
(cons (concat found-in "__define") class-with)
|
|
|
|
|
(concat class-with "__define"))
|
|
|
|
|
'pro
|
|
|
|
|
nil ; no class.... it's a procedure!
|
|
|
|
|
tag)))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A regular structure tag -- only in text, and if
|
|
|
|
|
;; optional `complete-structtag' loaded.
|
|
|
|
|
(structtag
|
|
|
|
|
(let ((var (match-string 1 this-word))
|
|
|
|
|
(tag (substring this-word (match-end 0))))
|
|
|
|
|
;; Check if we need to update the "current" structure
|
|
|
|
|
(idlwave-prepare-structure-tag-completion var)
|
|
|
|
|
(setq idlwave-help-do-struct-tag
|
|
|
|
|
idlwave-structtag-struct-location
|
|
|
|
|
mod1 (list nil nil nil nil tag))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A routine keyword -- in text or system help
|
|
|
|
|
((and (memq cw '(function-keyword procedure-keyword))
|
|
|
|
|
(stringp this-word)
|
|
|
|
|
(string-match "\\S-" this-word)
|
|
|
|
|
(not (string-match "!" this-word)))
|
|
|
|
|
(cond ((or (= (char-before beg) ?/)
|
|
|
|
|
(save-excursion (goto-char end)
|
|
|
|
|
(looking-at "[ \t]*=")))
|
|
|
|
|
;; Certainly a keyword. Check for abbreviation etc.
|
|
|
|
|
(setq keyword (idlwave-expand-keyword this-word module))
|
|
|
|
|
(cond
|
|
|
|
|
((null keyword)
|
|
|
|
|
(idlwave-help-diagnostics
|
|
|
|
|
(format "%s does not accept `%s' kwd"
|
|
|
|
|
(idlwave-make-full-name (nth 2 module)
|
|
|
|
|
(car module))
|
|
|
|
|
(upcase this-word))
|
|
|
|
|
'ding))
|
|
|
|
|
((consp keyword)
|
|
|
|
|
(idlwave-help-diagnostics
|
|
|
|
|
(format "%d matches for kwd abbrev `%s'"
|
|
|
|
|
(length keyword) this-word)
|
|
|
|
|
'ding)
|
|
|
|
|
;; We continue anyway with the first match...
|
|
|
|
|
(setq keyword (car keyword))))
|
|
|
|
|
;; Keyword, or just module
|
|
|
|
|
(setq mod1 (append (list t) module (list keyword)))
|
|
|
|
|
(setq mod2 (append (list t) module)))
|
|
|
|
|
((equal (char-after end) ?\()
|
|
|
|
|
;; A function - what-module will have caught this
|
|
|
|
|
(setq mod1 (append (list t) module)))
|
|
|
|
|
(t
|
|
|
|
|
;; undecided - try function, keyword, then enclosing mod.
|
|
|
|
|
;; Check for keyword abbreviations, but do not report
|
|
|
|
|
;; errors, because it might be something else.
|
|
|
|
|
;; FIXME: is this a good way to handle this?
|
|
|
|
|
(setq keyword (idlwave-expand-keyword this-word module))
|
|
|
|
|
(if (consp keyword) (setq keyword (car keyword)))
|
|
|
|
|
(setq mod1 (append (list t) module (list keyword))
|
|
|
|
|
mod2 (list t this-word 'fun nil)
|
|
|
|
|
mod3 (append (list t) module)))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Everything else
|
|
|
|
|
(t
|
|
|
|
|
(setq mod1 (append (list t) module))))
|
|
|
|
|
(if mod3
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(apply 'idlwave-online-help mod1)
|
|
|
|
|
(error (condition-case nil
|
|
|
|
|
(apply 'idlwave-online-help mod2)
|
|
|
|
|
(error (apply 'idlwave-online-help mod3)))))
|
|
|
|
|
(if mod2
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(apply 'idlwave-online-help mod1)
|
|
|
|
|
(error (apply 'idlwave-online-help mod2)))
|
|
|
|
|
(if mod1
|
|
|
|
|
(apply 'idlwave-online-help mod1)
|
|
|
|
|
(error "Don't know which item to show help for")))))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-do-mouse-completion-help (ev)
|
|
|
|
|
"Display online help on an item in the *Completions* buffer.
|
|
|
|
|
Needs additional info stored in global `idlwave-completion-help-info'."
|
|
|
|
|
(let* ((cw (selected-window))
|
|
|
|
|
(info idlwave-completion-help-info) ; global passed in
|
|
|
|
|
(what (nth 0 info))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlw-help-name (nth 1 info))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(type (nth 2 info))
|
|
|
|
|
(class (nth 3 info))
|
|
|
|
|
(need-class class)
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlw-help-kwd (nth 4 info))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(sclasses (nth 5 info))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
word idlw-help-link)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(mouse-set-point ev)
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; See if we can also find help somewhere, e.g. for multiple classes
|
|
|
|
|
(setq word (idlwave-this-word))
|
|
|
|
|
(if (string= word "")
|
|
|
|
|
(error "No help item selected"))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(setq idlw-help-link (get-text-property 0 'link word))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(select-window cw)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(cond
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Routine name
|
|
|
|
|
((memq what '(procedure function routine))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(setq idlw-help-name word)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if (or (eq class t)
|
|
|
|
|
(and (stringp class) sclasses))
|
|
|
|
|
(let* ((classes (idlwave-all-method-classes
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlwave-sintern-method idlw-help-name)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
type)))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(setq idlw-help-link t) ; No specific link valid yet
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if sclasses
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq classes (idlwave-members-only
|
2004-11-17 05:58:20 +00:00
|
|
|
|
classes (cons class sclasses))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq class (idlwave-popup-select ev classes
|
2004-11-17 05:58:20 +00:00
|
|
|
|
"Select Class" 'sort))))
|
|
|
|
|
|
|
|
|
|
;; XXX is this necessary, given all-method-classes?
|
|
|
|
|
(if (stringp class)
|
|
|
|
|
(setq class (idlwave-find-inherited-class
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlwave-sintern-routine-or-method idlw-help-name class)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
type (idlwave-sintern-class class)))))
|
|
|
|
|
|
|
|
|
|
;; Keyword
|
|
|
|
|
((eq what 'keyword)
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(setq idlw-help-kwd word)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if (or (eq class t)
|
|
|
|
|
(and (stringp class) sclasses))
|
|
|
|
|
(let ((classes (idlwave-all-method-keyword-classes
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlwave-sintern-method idlw-help-name)
|
|
|
|
|
(idlwave-sintern-keyword idlw-help-kwd)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
type)))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(setq idlw-help-link t) ; Link can't be correct yet
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if sclasses
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq classes (idlwave-members-only
|
2004-11-17 05:58:20 +00:00
|
|
|
|
classes (cons class sclasses))))
|
|
|
|
|
(setq class (idlwave-popup-select ev classes
|
|
|
|
|
"Select Class" 'sort))
|
|
|
|
|
;; XXX is this necessary, given all-method-keyword-classes?
|
|
|
|
|
(if (stringp class)
|
|
|
|
|
(setq class (idlwave-find-inherited-class
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlwave-sintern-routine-or-method
|
|
|
|
|
idlw-help-name class)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
type (idlwave-sintern-class class)))))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(if (string= (downcase idlw-help-name) "obj_new")
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(setq class idlwave-current-obj_new-class
|
2010-11-11 03:53:16 +00:00
|
|
|
|
idlw-help-name "Init"))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Class name
|
|
|
|
|
((eq what 'class)
|
|
|
|
|
(setq class word
|
|
|
|
|
word nil))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; A special named function to call which sets some of our variables
|
2008-05-06 07:14:39 +00:00
|
|
|
|
((and (symbolp what)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(fboundp what))
|
|
|
|
|
(funcall what 'set word))
|
|
|
|
|
|
|
|
|
|
(t (error "Cannot help with this item")))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(if (and need-class (not class)
|
|
|
|
|
(not (and idlw-help-link (not (eq idlw-help-link t)))))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(error "Cannot help with this item"))
|
2010-11-11 03:53:16 +00:00
|
|
|
|
(idlwave-online-help idlw-help-link (or idlw-help-name word)
|
|
|
|
|
type class idlw-help-kwd)))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(defvar idlwave-highlight-help-links-in-completion)
|
|
|
|
|
(defvar idlwave-completion-help-links)
|
|
|
|
|
(defun idlwave-highlight-linked-completions ()
|
|
|
|
|
"Highlight all completions for which help is available and attach link.
|
|
|
|
|
Those words in `idlwave-completion-help-links' have links. The
|
2005-06-14 23:20:55 +00:00
|
|
|
|
`idlwave-help-link' face is used for this."
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if idlwave-highlight-help-links-in-completion
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(with-current-buffer (get-buffer "*Completions*")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let* ((case-fold-search t)
|
2005-06-14 23:20:55 +00:00
|
|
|
|
(props (list 'face 'idlwave-help-link))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(info idlwave-completion-help-info) ; global passed in
|
|
|
|
|
(what (nth 0 info)) ; what was completed, or a func
|
|
|
|
|
(class (nth 3 info)) ; any class
|
|
|
|
|
word beg end doit)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward "possible completions are:" nil t)
|
|
|
|
|
(while (re-search-forward "\\s-\\([A-Za-z0-9_.]+\\)\\(\\s-\\|\\'\\)"
|
|
|
|
|
nil t)
|
|
|
|
|
(setq beg (match-beginning 1) end (match-end 1)
|
|
|
|
|
word (match-string 1) doit nil)
|
|
|
|
|
;; Call special completion function test
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (and (symbolp what)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(fboundp what))
|
|
|
|
|
(setq doit (funcall what 'test word))
|
|
|
|
|
;; Look for special link property passed in help-links
|
|
|
|
|
(if idlwave-completion-help-links
|
2005-05-06 19:25:57 +00:00
|
|
|
|
(setq doit (assoc-string
|
|
|
|
|
word idlwave-completion-help-links t))))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(when doit
|
|
|
|
|
(if (consp doit)
|
|
|
|
|
(setq props (append props `(link ,(cdr doit)))))
|
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
|
(add-text-properties beg end props)))
|
|
|
|
|
(goto-char end)))))))
|
|
|
|
|
|
|
|
|
|
;; Arrange for this function to be called after completion
|
|
|
|
|
(add-hook 'idlwave-completion-setup-hook
|
|
|
|
|
'idlwave-highlight-linked-completions)
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-return-frame nil
|
|
|
|
|
"The frame to return to from the help frame.")
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-quit ()
|
|
|
|
|
"Exit IDLWAVE Help buffer. Kill the dedicated frame if any."
|
|
|
|
|
(interactive)
|
|
|
|
|
(cond ((and idlwave-help-use-dedicated-frame
|
|
|
|
|
(eq (selected-frame) idlwave-help-frame))
|
|
|
|
|
(if (and idlwave-experimental
|
|
|
|
|
(frame-live-p idlwave-help-return-frame))
|
|
|
|
|
;; Try to select the return frame.
|
|
|
|
|
;; This can crash on slow network connections, obviously when
|
|
|
|
|
;; we kill the help frame before the return-frame is selected.
|
2008-05-06 07:14:39 +00:00
|
|
|
|
;; To protect the workings, we wait for up to one second
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; and check if the return-frame *is* now selected.
|
|
|
|
|
;; This is marked "eperimental" since we are not sure when its OK.
|
|
|
|
|
(let ((maxtime 1.0) (time 0.) (step 0.1))
|
|
|
|
|
(select-frame idlwave-help-return-frame)
|
|
|
|
|
(while (and (sit-for step)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(not (eq (selected-frame)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
idlwave-help-return-frame))
|
|
|
|
|
(< (setq time (+ time step)) maxtime)))))
|
|
|
|
|
(delete-frame idlwave-help-frame))
|
|
|
|
|
((window-configuration-p idlwave-help-window-configuration)
|
|
|
|
|
(set-window-configuration idlwave-help-window-configuration)
|
|
|
|
|
(select-window (previous-window)))
|
|
|
|
|
(t (kill-buffer (idlwave-help-get-help-buffer)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar default-toolbar-visible-p)
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-display-help-window (&optional pos-or-func)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
"Display the help window.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
Move window start to POS-OR-FUNC, if passed as a position, or call it
|
|
|
|
|
if passed as a function. See `idlwave-help-use-dedicated-frame'."
|
|
|
|
|
(let ((cw (selected-window))
|
|
|
|
|
(buf (idlwave-help-get-help-buffer)))
|
|
|
|
|
(if (and window-system idlwave-help-use-dedicated-frame)
|
|
|
|
|
(progn
|
|
|
|
|
(idlwave-help-show-help-frame)
|
|
|
|
|
(switch-to-buffer buf))
|
|
|
|
|
;; Do it in this frame and save the window configuration
|
|
|
|
|
(if (not (get-buffer-window buf nil))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq idlwave-help-window-configuration
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(current-window-configuration)))
|
|
|
|
|
(display-buffer buf nil (selected-frame))
|
|
|
|
|
(select-window (get-buffer-window buf)))
|
|
|
|
|
(raise-frame)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if pos-or-func
|
|
|
|
|
(if (functionp pos-or-func)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(funcall pos-or-func)
|
|
|
|
|
(goto-char pos-or-func)
|
|
|
|
|
(recenter 0)))
|
|
|
|
|
(select-window cw)))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-select-help-frame ()
|
|
|
|
|
"Select the help frame."
|
|
|
|
|
(if (and (frame-live-p idlwave-help-frame)
|
|
|
|
|
(not (eq (selected-frame) idlwave-help-frame)))
|
|
|
|
|
(progn
|
|
|
|
|
(setq idlwave-help-return-frame (selected-frame))
|
|
|
|
|
(select-frame idlwave-help-frame))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-return-to-calling-frame ()
|
|
|
|
|
"Select the frame from which the help frame was selected."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (and (frame-live-p idlwave-help-return-frame)
|
|
|
|
|
(not (eq (selected-frame) idlwave-help-return-frame)))
|
|
|
|
|
(select-frame idlwave-help-return-frame)))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-online-help (link &optional name type class keyword)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
"Display HTML or other special help on a certain topic.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
Either loads an HTML link, if LINK is non-nil, or gets special-help on
|
|
|
|
|
the optional arguments, if any special help is defined. If LINK is
|
2010-01-02 01:05:44 +00:00
|
|
|
|
t, first look up the optional arguments in the routine info list to
|
2004-11-17 05:58:20 +00:00
|
|
|
|
see if a link is set for it. Try extra help functions if necessary."
|
|
|
|
|
;; Lookup link
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (eq link t)
|
|
|
|
|
(let ((entry (idlwave-best-rinfo-assoc name type class
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(idlwave-routines) nil t)))
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(if entry
|
|
|
|
|
(cond
|
|
|
|
|
;; Try keyword link
|
2008-05-06 07:14:39 +00:00
|
|
|
|
((and keyword
|
|
|
|
|
(setq link (cdr
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(idlwave-entry-find-keyword entry keyword)))))
|
|
|
|
|
;; Default, regular entry link
|
|
|
|
|
(t (setq link (idlwave-entry-has-help entry))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (and
|
2006-04-06 18:46:56 +00:00
|
|
|
|
class
|
|
|
|
|
;; Check for system class help
|
|
|
|
|
(setq entry (assq (idlwave-sintern-class class)
|
|
|
|
|
idlwave-system-class-info)
|
|
|
|
|
link (nth 1 (assq 'link entry))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(message
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(concat "No routine info for %s"
|
|
|
|
|
", falling back on class help.")
|
|
|
|
|
(idlwave-make-full-name class name))))))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
;; An explicit link
|
2008-05-06 07:14:39 +00:00
|
|
|
|
((stringp link)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(idlwave-help-html-link link))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Any extra help
|
|
|
|
|
(idlwave-extra-help-function
|
|
|
|
|
(idlwave-help-get-special-help name type class keyword))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Nothing worked
|
|
|
|
|
(t (idlwave-help-error name type class keyword))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-get-special-help (name type class keyword)
|
|
|
|
|
"Call the function given by `idlwave-extra-help-function'."
|
|
|
|
|
(let* ((cw (selected-window))
|
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
* textmodes/tex-mode.el (tex-set-buffer-directory):
* textmodes/spell.el (spell-region, spell-string):
* textmodes/reftex.el (reftex-erase-buffer):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
* textmodes/reftex-toc.el (reftex-toc-promote-action):
* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
(reftex-select-item):
* textmodes/reftex-ref.el (reftex-label-info-update)
(reftex-offer-label-menu):
* textmodes/reftex-index.el (reftex-index-change-entry)
(reftex-index-phrases-info):
* textmodes/reftex-global.el (reftex-create-tags-file)
(reftex-save-all-document-buffers, reftex-ensure-write-access):
* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
(reftex-view-crossref-from-bibtex):
* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
(reftex-extract-bib-entries-from-thebibliography)
(reftex-all-used-citation-keys, reftex-create-bibtex-file):
* textmodes/refbib.el (r2b-capitalize-title):
(r2b-convert-buffer, r2b-help):
* textmodes/page-ext.el (pages-directory)
(pages-directory-goto-with-mouse):
* textmodes/bibtex.el (bibtex-validate-globally):
* textmodes/bib-mode.el (bib-capitalize-title):
* textmodes/artist.el (artist-clear-buffer, artist-system):
* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
(local-set-scheme-interaction-buffer, xscheme-process-filter)
(verify-xscheme-buffer, xscheme-enter-interaction-mode)
(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
(xscheme-send-control-g-interrupt, xscheme-start-process)
(xscheme-process-sentinel, xscheme-cd):
* progmodes/verilog-mode.el (verilog-read-always-signals)
(verilog-set-define, verilog-getopt-file)
(verilog-module-inside-filename-p):
* progmodes/sh-script.el:
* progmodes/python.el (python-pdbtrack-get-source-buffer)
(python-pdbtrack-grub-for-buffer, python-execute-file):
* progmodes/octave-inf.el (inferior-octave):
* progmodes/idlwave.el (idlwave-scan-user-lib-files)
(idlwave-shell-compile-helper-routines, idlwave-set-local)
(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
(idlwave-shell-filter, idlwave-shell-examine-highlight)
(idlwave-shell-sentinel, idlwave-shell-filter-directory)
(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
(idlwave-shell-examine-display, idlwave-shell-run-region)
(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
* progmodes/idlw-help.el (idlwave-help-get-special-help)
(idlwave-help-get-help-buffer):
* progmodes/gud.el (gud-basic-call, gud-find-class)
(gud-tooltip-activate-mouse-motions-if-enabled):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
(ebrowse-tags-next-file):
* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
(ebnf-eps-finish-and-write):
* progmodes/cpp.el (cpp-edit-save):
* progmodes/cperl-mode.el (cperl-pod-to-manpage):
* progmodes/cc-defs.el (c-emacs-features):
* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
(antlr-directory-dependencies):
* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
(ada-run-application, ada-find-in-src-path, ada-goto-parent)
(ada-find-any-references, ada-make-filename-from-adaname)
(ada-make-body-gnatstub):
* obsolete/rnews.el (news-list-news-groups):
* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
* obsolete/iso-acc.el (iso-acc-minibuf-setup):
* net/rcirc.el (rcirc-debug):
* net/newst-treeview.el (newsticker--treeview-list-add-item)
(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
(newsticker--treeview-list-update-faces, newsticker-treeview-save)
(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
(newsticker--treeview-list-clear-highlight)
(newsticker--treeview-list-update-highlight)
(newsticker--treeview-list-highlight-start)
(newsticker--treeview-tree-update-highlight)
(newsticker--treeview-get-selected-item)
(newsticker-treeview-mark-list-items-old)
(newsticker--treeview-set-current-node):
* net/newst-plainview.el (newsticker--buffer-set-uptodate):
* net/newst-backend.el (newsticker--get-news-by-funcall)
(newsticker--get-news-by-wget, newsticker--image-get)
(newsticker--image-sentinel):
* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
(eudc-ph-close-session):
* net/eudc.el (eudc-save-options):
* language/thai-word.el (thai-update-word-table):
* language/japan-util.el (japanese-string-conversion):
* international/titdic-cnv.el (tsang-quick-converter)
(ziranma-converter, ctlau-converter):
* international/mule-cmds.el (describe-language-environment):
* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix):
(skkdic-convert-okuri-nasi, skkdic-convert):
* emacs-lisp/re-builder.el (reb-update-overlays):
* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
* emacs-lisp/gulp.el (gulp-send-requests):
* emacs-lisp/find-gc.el (trace-call-tree):
* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
(eieio-describe-generic):
* emacs-lisp/eieio-base.el (eieio-persistent-read):
* emacs-lisp/edebug.el (edebug-outside-excursion):
* emacs-lisp/debug.el (debugger-make-xrefs):
* emacs-lisp/cust-print.el (custom-prin1-to-string):
* emacs-lisp/chart.el (chart-new-buffer):
* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
Use with-current-buffer.
* textmodes/artist.el (artist-system): Don't call
copy-sequence on a fresh string.
* progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
|
|
|
|
(help-pos (with-current-buffer (idlwave-help-get-help-buffer)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(let ((buffer-read-only nil))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(funcall idlwave-extra-help-function
|
2004-11-17 05:58:20 +00:00
|
|
|
|
name type class keyword)))))
|
|
|
|
|
(if help-pos
|
|
|
|
|
(idlwave-help-display-help-window help-pos)
|
|
|
|
|
(idlwave-help-error name type class keyword))
|
|
|
|
|
(select-window cw)))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-html-link (link)
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Get HTML help on a given LINK."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(let ((browse-url-browser-function idlwave-help-browser-function)
|
|
|
|
|
(help-loc (idlwave-html-help-location))
|
|
|
|
|
(browse-url-generic-program idlwave-help-browser-generic-program)
|
|
|
|
|
;(browse-url-generic-args idlwave-help-browser-generic-args)
|
|
|
|
|
full-link)
|
2005-08-30 11:08:18 +00:00
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
;; Just a regular file name (+ anchor name)
|
|
|
|
|
(unless (and (stringp help-loc)
|
|
|
|
|
(file-directory-p help-loc))
|
2009-09-24 01:37:14 +00:00
|
|
|
|
(error "Invalid help location"))
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(setq full-link (browse-url-file-url (expand-file-name link help-loc)))
|
2005-05-06 19:25:57 +00:00
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
;; Select the browser
|
|
|
|
|
(cond
|
|
|
|
|
(idlwave-help-use-assistant
|
|
|
|
|
(idlwave-help-assistant-open-link link))
|
|
|
|
|
|
|
|
|
|
((or idlwave-help-browser-is-local
|
|
|
|
|
(string-match "w3" (symbol-name idlwave-help-browser-function)))
|
|
|
|
|
(idlwave-help-display-help-window '(lambda () (browse-url full-link))))
|
|
|
|
|
|
|
|
|
|
(t (browse-url full-link)))))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
;; A special help routine for source-level syntax help in files.
|
|
|
|
|
(defvar idlwave-help-fontify-source-code)
|
|
|
|
|
(defvar idlwave-help-source-try-header)
|
2005-07-04 01:51:24 +00:00
|
|
|
|
(defvar idlwave-current-tags-buffer)
|
|
|
|
|
(defvar idlwave-current-tags-class)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(defun idlwave-help-with-source (name type class keyword)
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Provide help for routines not documented in the IDL manuals.
|
|
|
|
|
Works by loading the routine source file into the help buffer.
|
|
|
|
|
Depending on the value of `idlwave-help-source-try-header', it
|
|
|
|
|
attempts to show the routine definition or the header description.
|
|
|
|
|
If `idlwave-help-do-class-struct-tag' is non-nil, keyword is a tag
|
|
|
|
|
to show help on from the class definition structure.
|
|
|
|
|
If `idlwave-help-do-struct-tag' is non-nil, show help from the
|
|
|
|
|
matching structure tag definition.
|
2004-11-17 05:58:20 +00:00
|
|
|
|
|
|
|
|
|
This function can be used as `idlwave-extra-help-function'."
|
|
|
|
|
(let* ((class-struct-tag idlwave-help-do-class-struct-tag)
|
|
|
|
|
(struct-tag idlwave-help-do-struct-tag)
|
|
|
|
|
(case-fold-search t)
|
|
|
|
|
(real-class (if (consp name) (cdr name)))
|
|
|
|
|
(name (if (consp name) (car name) name))
|
|
|
|
|
(class-only (and (stringp class) (not (stringp name))))
|
|
|
|
|
file header-pos def-pos in-buf)
|
|
|
|
|
(if class-only ;Help with class? Using "Init" as source.
|
|
|
|
|
(setq name "Init"
|
|
|
|
|
type 'fun))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (not struct-tag)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(setq file
|
|
|
|
|
(idlwave-routine-source-file
|
|
|
|
|
(nth 3 (idlwave-best-rinfo-assoc
|
|
|
|
|
name (or type t) class (idlwave-routines))))))
|
|
|
|
|
(setq idlwave-help-def-pos nil
|
|
|
|
|
idlwave-help-args (list name type class keyword)
|
|
|
|
|
idlwave-help-in-header nil
|
|
|
|
|
idlwave-help-do-struct-tag nil
|
|
|
|
|
idlwave-help-do-class-struct-tag nil)
|
|
|
|
|
(if (or struct-tag (stringp file))
|
|
|
|
|
(progn
|
|
|
|
|
(setq in-buf ; structure-tag completion is always in current buffer
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if struct-tag
|
2004-11-17 05:58:20 +00:00
|
|
|
|
idlwave-current-tags-buffer
|
|
|
|
|
(idlwave-get-buffer-visiting file)))
|
|
|
|
|
;; see if file is in a visited buffer, insert those contents
|
|
|
|
|
(if in-buf
|
|
|
|
|
(progn
|
|
|
|
|
(setq file (buffer-file-name in-buf))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(erase-buffer)
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(insert-buffer-substring in-buf))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if (file-exists-p file) ;; otherwise just load the file
|
|
|
|
|
(progn
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert-file-contents file nil nil nil 'replace))
|
|
|
|
|
(idlwave-help-error name type class keyword)))
|
2006-04-20 19:45:16 +00:00
|
|
|
|
(goto-char (point-min))
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if (and idlwave-help-fontify-source-code (not in-buf))
|
|
|
|
|
(idlwave-help-fontify)))
|
|
|
|
|
(idlwave-help-error name type class keyword))
|
|
|
|
|
(setq idlwave-help-mode-line-indicator file)
|
|
|
|
|
|
|
|
|
|
;; Try to find a good place to display
|
|
|
|
|
(setq def-pos
|
|
|
|
|
;; Find the class structure tag if that's what we're after
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(cond
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Class structure tags: find the class or named structure
|
|
|
|
|
;; definition
|
|
|
|
|
(class-struct-tag
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(save-excursion
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(setq class
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (string-match "[a-zA-Z0-9]\\(__\\)" name)
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(substring name 0 (match-beginning 1))
|
|
|
|
|
idlwave-current-tags-class))
|
|
|
|
|
(and
|
|
|
|
|
(idlwave-find-class-definition class nil real-class)
|
|
|
|
|
(idlwave-find-struct-tag keyword))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Generic structure tags: the structure definition
|
|
|
|
|
;; location within the file has been recorded in
|
|
|
|
|
;; `struct-tag'
|
|
|
|
|
(struct-tag
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and
|
|
|
|
|
(integerp struct-tag)
|
|
|
|
|
(goto-char struct-tag)
|
|
|
|
|
(idlwave-find-struct-tag keyword))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Just find the routine definition
|
|
|
|
|
(t
|
|
|
|
|
(if class-only (point-min)
|
|
|
|
|
(idlwave-help-find-routine-definition name type class keyword))))
|
|
|
|
|
idlwave-help-def-pos def-pos)
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (and idlwave-help-source-try-header
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(not (or struct-tag class-struct-tag)))
|
|
|
|
|
;; Check if we can find the header
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (or def-pos (point-max)))
|
|
|
|
|
(setq header-pos (idlwave-help-find-in-doc-header
|
|
|
|
|
name type class keyword 'exact)
|
|
|
|
|
idlwave-help-in-header header-pos)))
|
|
|
|
|
|
|
|
|
|
(if (or header-pos def-pos)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(progn
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if (boundp 'idlwave-help-min-frame-width)
|
|
|
|
|
(setq idlwave-help-min-frame-width 80))
|
|
|
|
|
(goto-char (or header-pos def-pos)))
|
|
|
|
|
(idlwave-help-error name type class keyword))
|
|
|
|
|
|
|
|
|
|
(point)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-find-routine-definition (name type class keyword)
|
|
|
|
|
"Find the definition of routine CLASS::NAME in current buffer.
|
2010-01-02 01:05:44 +00:00
|
|
|
|
Returns the point of match if successful, nil otherwise.
|
|
|
|
|
KEYWORD is ignored."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if (re-search-backward
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(concat "^[ \t]*"
|
|
|
|
|
(if (eq type 'pro) "pro"
|
|
|
|
|
(if (eq type 'fun) "function"
|
|
|
|
|
"\\(pro\\|function\\)"))
|
|
|
|
|
"[ \t]+"
|
|
|
|
|
(regexp-quote (downcase (idlwave-make-full-name class name)))
|
|
|
|
|
"[, \t\r\n]")
|
|
|
|
|
nil t)
|
|
|
|
|
(match-beginning 0)
|
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-doclib-start)
|
|
|
|
|
(defvar idlwave-doclib-end)
|
|
|
|
|
(defun idlwave-help-find-in-doc-header (name type class keyword
|
|
|
|
|
&optional exact)
|
|
|
|
|
"Find the requested help in the doc-header above point.
|
|
|
|
|
|
|
|
|
|
First checks if there is a doc-lib header which describes the correct
|
|
|
|
|
routine. Then tries to find the KEYWORDS section and the KEYWORD, if
|
|
|
|
|
given. Returns the point which should be window start of the help
|
|
|
|
|
window. If EXACT is non-nil, the full help position must be found -
|
|
|
|
|
down to the keyword requested. This setting is for context help, if
|
|
|
|
|
the exact spot is needed.
|
|
|
|
|
|
|
|
|
|
If EXACT is nil, the position of the header is returned if it
|
|
|
|
|
describes the correct routine - even if the keyword description cannot
|
|
|
|
|
be found. TYPE is ignored.
|
|
|
|
|
|
|
|
|
|
This function expects a more or less standard routine header. In
|
|
|
|
|
particlar it looks for the `NAME:' tag, either with a colon, or alone
|
|
|
|
|
on a line. Then `NAME:' must be followed by the routine name on the
|
|
|
|
|
same or the next line. When KEYWORD is non-nil, looks first for a
|
|
|
|
|
`KEYWORDS' section. It is amazing how inconsisten this is through
|
|
|
|
|
some IDL libraries I have seen. We settle for a line containing an
|
|
|
|
|
upper case \"KEYWORD\" string. If this line is not fould we search
|
|
|
|
|
for the keyword anyway to increase the hit-rate
|
|
|
|
|
|
|
|
|
|
When one of these sections exists we check for a line starting with any of
|
|
|
|
|
|
|
|
|
|
/KEYWORD KEYWORD- KEYWORD= KEYWORD
|
|
|
|
|
|
|
|
|
|
with spaces allowed between the keyword and the following dash or equal sign.
|
|
|
|
|
If there is a match, we assume it is the keyword description."
|
|
|
|
|
(let* ((case-fold-search t)
|
|
|
|
|
(rname (if (stringp class)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(concat
|
2004-11-17 05:58:20 +00:00
|
|
|
|
"\\("
|
|
|
|
|
;; Traditional name or class::name
|
|
|
|
|
"\\("
|
|
|
|
|
"\\(" (regexp-quote (downcase class)) "::\\)?"
|
|
|
|
|
(regexp-quote (downcase name))
|
|
|
|
|
"\\>\\)"
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(concat
|
2004-11-17 05:58:20 +00:00
|
|
|
|
"\\|"
|
|
|
|
|
;; class__define or just class
|
|
|
|
|
(regexp-quote (downcase class)) "\\(__define\\)?")
|
|
|
|
|
"\\)")
|
|
|
|
|
(regexp-quote (downcase name))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; NAME tag plus the routine name. The new version is from JD.
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(name-re (concat
|
2004-11-17 05:58:20 +00:00
|
|
|
|
"\\(^;+\\*?[ \t]*"
|
|
|
|
|
idlwave-help-doclib-name
|
|
|
|
|
"\\([ \t]*:\\|[ \t]*$\\)[ \t]*\\(\n;+[ \t]*\\)*"
|
|
|
|
|
rname
|
|
|
|
|
"\\|"
|
|
|
|
|
"^;+[ \t]*"
|
|
|
|
|
rname
|
|
|
|
|
":[ \t]*$\\)"))
|
|
|
|
|
|
|
|
|
|
;; Header start plus name
|
|
|
|
|
(header-re (concat "\\(" idlwave-doclib-start "\\).*\n"
|
|
|
|
|
"\\(^;+.*\n\\)*"
|
|
|
|
|
"\\(" name-re "\\)"))
|
|
|
|
|
;; A keywords section
|
|
|
|
|
(kwds-re (concat ; forgiving
|
|
|
|
|
"^;+\\*?[ \t]*"
|
|
|
|
|
"\\([-A-Z_ ]*"
|
|
|
|
|
idlwave-help-doclib-keyword
|
|
|
|
|
"[-A-Z_ ]*\\)"
|
|
|
|
|
"\\(:\\|[ \t]*\n\\)"))
|
|
|
|
|
|
|
|
|
|
;; The individual keyword description line.
|
|
|
|
|
(kwd-re (if keyword ; hard (well...)
|
|
|
|
|
(concat
|
|
|
|
|
"^;+[ \t]+"
|
|
|
|
|
"\\(/" (regexp-quote (upcase keyword))
|
|
|
|
|
"\\|" (regexp-quote (upcase keyword)) "[ \t]*[-=:\n]"
|
|
|
|
|
"\\)")))
|
|
|
|
|
(kwd-re2 (if keyword ; forgiving
|
|
|
|
|
(concat
|
|
|
|
|
"^;+[ \t]+"
|
|
|
|
|
(regexp-quote (upcase keyword))
|
|
|
|
|
"\\>")))
|
|
|
|
|
dstart dend name-pos kwds-pos kwd-pos)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(catch 'exit
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (and (setq dstart (re-search-forward idlwave-doclib-start nil t))
|
|
|
|
|
(setq dend (re-search-forward idlwave-doclib-end nil t)))
|
|
|
|
|
;; found a routine header
|
|
|
|
|
(goto-char dstart)
|
|
|
|
|
(if (setq name-pos (re-search-forward name-re dend t))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(progn
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(if keyword
|
|
|
|
|
;; We do need a keyword
|
|
|
|
|
(progn
|
|
|
|
|
;; Try to find a keyword section, but don't force it.
|
|
|
|
|
(goto-char name-pos)
|
|
|
|
|
(if (let ((case-fold-search nil))
|
|
|
|
|
(re-search-forward kwds-re dend t))
|
|
|
|
|
(setq kwds-pos (match-beginning 0)))
|
|
|
|
|
;; Find the keyword description
|
|
|
|
|
(if (or (let ((case-fold-search nil))
|
|
|
|
|
(re-search-forward kwd-re dend t))
|
|
|
|
|
(re-search-forward kwd-re dend t)
|
|
|
|
|
(let ((case-fold-search nil))
|
|
|
|
|
(re-search-forward kwd-re2 dend t))
|
|
|
|
|
(re-search-forward kwd-re2 dend t))
|
|
|
|
|
(setq kwd-pos (match-beginning 0))
|
|
|
|
|
(if exact
|
|
|
|
|
(progn
|
|
|
|
|
(idlwave-help-diagnostics
|
|
|
|
|
(format "Could not find description of kwd %s"
|
|
|
|
|
(upcase keyword)))
|
|
|
|
|
(throw 'exit nil))))))
|
|
|
|
|
;; Return the best position we got
|
|
|
|
|
(throw 'exit (or kwd-pos kwds-pos name-pos dstart)))
|
|
|
|
|
(goto-char dend))))
|
|
|
|
|
(idlwave-help-diagnostics "Could not find doclib header")
|
|
|
|
|
(throw 'exit nil))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-diagnostics (string &optional ding)
|
|
|
|
|
"Add a diagnostics string to the list.
|
|
|
|
|
When DING is non-nil, ring the bell as well."
|
|
|
|
|
(if (boundp 'idlwave-help-diagnostics)
|
|
|
|
|
(progn
|
|
|
|
|
(setq idlwave-help-diagnostics
|
|
|
|
|
(cons string idlwave-help-diagnostics))
|
|
|
|
|
(if ding (ding)))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-toggle-header-top-and-def (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let (pos)
|
|
|
|
|
(if idlwave-help-in-header
|
|
|
|
|
;; Header was the last thing displayed
|
|
|
|
|
(progn
|
|
|
|
|
(setq idlwave-help-in-header nil)
|
|
|
|
|
(setq pos idlwave-help-def-pos))
|
|
|
|
|
;; Try to display header
|
|
|
|
|
(setq pos (idlwave-help-find-in-doc-header
|
|
|
|
|
(nth 0 idlwave-help-args)
|
|
|
|
|
(nth 1 idlwave-help-args)
|
|
|
|
|
(nth 2 idlwave-help-args)
|
|
|
|
|
nil))
|
|
|
|
|
(if pos
|
|
|
|
|
(setq idlwave-help-in-header t)
|
|
|
|
|
(error "Cannot find doclib header for routine %s"
|
|
|
|
|
(idlwave-make-full-name (nth 2 idlwave-help-args)
|
|
|
|
|
(nth 0 idlwave-help-args)))))
|
|
|
|
|
(if pos
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(recenter 0)))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-find-first-header (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let (pos)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (re-search-forward idlwave-doclib-start nil t)
|
|
|
|
|
(setq pos (match-beginning 0))))
|
|
|
|
|
(if pos
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(recenter 0))
|
|
|
|
|
(error "No DocLib Header in current file"))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-find-header (arg)
|
|
|
|
|
"Jump to the DocLib Header."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(if arg
|
|
|
|
|
(idlwave-help-find-first-header nil)
|
|
|
|
|
(setq idlwave-help-in-header nil)
|
|
|
|
|
(idlwave-help-toggle-header-match-and-def arg 'top)))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(defun idlwave-help-toggle-header-match-and-def (arg &optional top)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((args idlwave-help-args)
|
|
|
|
|
pos)
|
|
|
|
|
(if idlwave-help-in-header
|
|
|
|
|
;; Header was the last thing displayed
|
|
|
|
|
(progn
|
|
|
|
|
(setq idlwave-help-in-header nil)
|
|
|
|
|
(setq pos idlwave-help-def-pos))
|
|
|
|
|
;; Try to display header
|
|
|
|
|
(setq pos (apply 'idlwave-help-find-in-doc-header
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if top
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(list (car args) (nth 1 args) (nth 2 args) nil)
|
|
|
|
|
args)))
|
|
|
|
|
(if pos
|
|
|
|
|
(setq idlwave-help-in-header t)
|
|
|
|
|
(error "Cannot find doclib header for routine %s"
|
|
|
|
|
(idlwave-make-full-name (nth 2 idlwave-help-args)
|
|
|
|
|
(nth 0 idlwave-help-args)))))
|
|
|
|
|
(if pos
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(recenter 0)))))
|
|
|
|
|
|
|
|
|
|
(defvar font-lock-verbose)
|
|
|
|
|
(defvar idlwave-mode-syntax-table)
|
|
|
|
|
(defvar idlwave-font-lock-defaults)
|
|
|
|
|
(defun idlwave-help-fontify ()
|
|
|
|
|
"Fontify the Help buffer as source code.
|
|
|
|
|
Useful when source code is displayed as help. See the option
|
|
|
|
|
`idlwave-help-fontify-source-code'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (featurep 'font-lock)
|
|
|
|
|
(let ((major-mode 'idlwave-mode)
|
|
|
|
|
(font-lock-verbose
|
|
|
|
|
(if (interactive-p) font-lock-verbose nil))
|
|
|
|
|
(syntax-table (syntax-table)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(set-syntax-table idlwave-mode-syntax-table)
|
|
|
|
|
(set (make-local-variable 'font-lock-defaults)
|
|
|
|
|
idlwave-font-lock-defaults)
|
|
|
|
|
(font-lock-fontify-buffer))
|
|
|
|
|
(set-syntax-table syntax-table)))))
|
|
|
|
|
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(defun idlwave-help-error (name type class keyword)
|
|
|
|
|
(error "Can't find help on %s%s %s"
|
|
|
|
|
(or (and (or class name) (idlwave-make-full-name class name))
|
|
|
|
|
"<unknown>")
|
|
|
|
|
(if keyword (format ", keyword %s" (upcase keyword)) "")
|
|
|
|
|
(if idlwave-html-help-location
|
|
|
|
|
""
|
|
|
|
|
"(help location unknown)")))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-show-help-frame ()
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"Show the help frame, creating it if necessary."
|
2004-11-17 05:58:20 +00:00
|
|
|
|
;; Use a special frame for this
|
|
|
|
|
(unless (frame-live-p idlwave-help-frame)
|
|
|
|
|
(setq idlwave-help-frame
|
|
|
|
|
(make-frame idlwave-help-frame-parameters))
|
|
|
|
|
;; Strip menubar (?) and toolbar from the Help frame.
|
|
|
|
|
(if (fboundp 'set-specifier)
|
|
|
|
|
(progn
|
|
|
|
|
;; XEmacs
|
|
|
|
|
(let ((sval (cons idlwave-help-frame nil)))
|
|
|
|
|
;; (set-specifier menubar-visible-p sval)
|
|
|
|
|
(set-specifier default-toolbar-visible-p sval)))
|
|
|
|
|
;; Emacs
|
|
|
|
|
(modify-frame-parameters idlwave-help-frame
|
|
|
|
|
'(;;(menu-bar-lines . 0)
|
|
|
|
|
(tool-bar-lines . 0)))))
|
|
|
|
|
(select-frame idlwave-help-frame))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-get-help-buffer ()
|
|
|
|
|
"Return the IDLWAVE Help buffer. Make it first if necessary."
|
|
|
|
|
(let ((buf (get-buffer "*IDLWAVE Help*")))
|
|
|
|
|
(if buf
|
|
|
|
|
nil
|
|
|
|
|
(setq buf (get-buffer-create "*IDLWAVE Help*"))
|
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
* textmodes/tex-mode.el (tex-set-buffer-directory):
* textmodes/spell.el (spell-region, spell-string):
* textmodes/reftex.el (reftex-erase-buffer):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
* textmodes/reftex-toc.el (reftex-toc-promote-action):
* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
(reftex-select-item):
* textmodes/reftex-ref.el (reftex-label-info-update)
(reftex-offer-label-menu):
* textmodes/reftex-index.el (reftex-index-change-entry)
(reftex-index-phrases-info):
* textmodes/reftex-global.el (reftex-create-tags-file)
(reftex-save-all-document-buffers, reftex-ensure-write-access):
* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
(reftex-view-crossref-from-bibtex):
* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
(reftex-extract-bib-entries-from-thebibliography)
(reftex-all-used-citation-keys, reftex-create-bibtex-file):
* textmodes/refbib.el (r2b-capitalize-title):
(r2b-convert-buffer, r2b-help):
* textmodes/page-ext.el (pages-directory)
(pages-directory-goto-with-mouse):
* textmodes/bibtex.el (bibtex-validate-globally):
* textmodes/bib-mode.el (bib-capitalize-title):
* textmodes/artist.el (artist-clear-buffer, artist-system):
* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
(local-set-scheme-interaction-buffer, xscheme-process-filter)
(verify-xscheme-buffer, xscheme-enter-interaction-mode)
(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
(xscheme-send-control-g-interrupt, xscheme-start-process)
(xscheme-process-sentinel, xscheme-cd):
* progmodes/verilog-mode.el (verilog-read-always-signals)
(verilog-set-define, verilog-getopt-file)
(verilog-module-inside-filename-p):
* progmodes/sh-script.el:
* progmodes/python.el (python-pdbtrack-get-source-buffer)
(python-pdbtrack-grub-for-buffer, python-execute-file):
* progmodes/octave-inf.el (inferior-octave):
* progmodes/idlwave.el (idlwave-scan-user-lib-files)
(idlwave-shell-compile-helper-routines, idlwave-set-local)
(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
(idlwave-shell-filter, idlwave-shell-examine-highlight)
(idlwave-shell-sentinel, idlwave-shell-filter-directory)
(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
(idlwave-shell-examine-display, idlwave-shell-run-region)
(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
* progmodes/idlw-help.el (idlwave-help-get-special-help)
(idlwave-help-get-help-buffer):
* progmodes/gud.el (gud-basic-call, gud-find-class)
(gud-tooltip-activate-mouse-motions-if-enabled):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
(ebrowse-tags-next-file):
* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
(ebnf-eps-finish-and-write):
* progmodes/cpp.el (cpp-edit-save):
* progmodes/cperl-mode.el (cperl-pod-to-manpage):
* progmodes/cc-defs.el (c-emacs-features):
* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
(antlr-directory-dependencies):
* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
(ada-run-application, ada-find-in-src-path, ada-goto-parent)
(ada-find-any-references, ada-make-filename-from-adaname)
(ada-make-body-gnatstub):
* obsolete/rnews.el (news-list-news-groups):
* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
* obsolete/iso-acc.el (iso-acc-minibuf-setup):
* net/rcirc.el (rcirc-debug):
* net/newst-treeview.el (newsticker--treeview-list-add-item)
(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
(newsticker--treeview-list-update-faces, newsticker-treeview-save)
(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
(newsticker--treeview-list-clear-highlight)
(newsticker--treeview-list-update-highlight)
(newsticker--treeview-list-highlight-start)
(newsticker--treeview-tree-update-highlight)
(newsticker--treeview-get-selected-item)
(newsticker-treeview-mark-list-items-old)
(newsticker--treeview-set-current-node):
* net/newst-plainview.el (newsticker--buffer-set-uptodate):
* net/newst-backend.el (newsticker--get-news-by-funcall)
(newsticker--get-news-by-wget, newsticker--image-get)
(newsticker--image-sentinel):
* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
(eudc-ph-close-session):
* net/eudc.el (eudc-save-options):
* language/thai-word.el (thai-update-word-table):
* language/japan-util.el (japanese-string-conversion):
* international/titdic-cnv.el (tsang-quick-converter)
(ziranma-converter, ctlau-converter):
* international/mule-cmds.el (describe-language-environment):
* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix):
(skkdic-convert-okuri-nasi, skkdic-convert):
* emacs-lisp/re-builder.el (reb-update-overlays):
* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
* emacs-lisp/gulp.el (gulp-send-requests):
* emacs-lisp/find-gc.el (trace-call-tree):
* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
(eieio-describe-generic):
* emacs-lisp/eieio-base.el (eieio-persistent-read):
* emacs-lisp/edebug.el (edebug-outside-excursion):
* emacs-lisp/debug.el (debugger-make-xrefs):
* emacs-lisp/cust-print.el (custom-prin1-to-string):
* emacs-lisp/chart.el (chart-new-buffer):
* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
Use with-current-buffer.
* textmodes/artist.el (artist-system): Don't call
copy-sequence on a fresh string.
* progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
|
|
|
|
(with-current-buffer buf
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(idlwave-help-mode)))
|
|
|
|
|
buf))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-grep (regexp list)
|
|
|
|
|
(let (rtn)
|
|
|
|
|
(while list
|
|
|
|
|
(if (string-match regexp (car list))
|
|
|
|
|
(setq rtn (cons (car list) rtn)))
|
|
|
|
|
(setq list (cdr list)))
|
|
|
|
|
(nreverse rtn)))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-entry-has-help (entry)
|
|
|
|
|
(and entry (car (nth 5 entry))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-has-help (name type class)
|
|
|
|
|
"Does this have help associated with it?"
|
|
|
|
|
(let ((entry (idlwave-best-rinfo-assoc name type class (idlwave-routines))))
|
|
|
|
|
(idlwave-entry-has-help entry)))
|
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
;;----- Control the IDL Assistant, which shipped with IDL v6.2
|
|
|
|
|
(defvar idlwave-help-assistant-process nil)
|
|
|
|
|
(defvar idlwave-help-assistant-socket nil)
|
|
|
|
|
|
|
|
|
|
;; The Windows version does not have a !DIR/bin/* set of front-end
|
|
|
|
|
;; scripts, but instead only links directly to bin.x86. As a result,
|
|
|
|
|
;; we must pass the -profile argument as well.
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(defvar idlwave-help-assistant-command
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(if (memq system-type '(ms-dos windows-nt))
|
2007-03-08 18:31:13 +00:00
|
|
|
|
"bin/bin.x86/idl_assistant.exe"
|
2006-04-06 18:46:56 +00:00
|
|
|
|
"bin/idl_assistant")
|
2010-01-02 01:05:44 +00:00
|
|
|
|
"The command, rooted at `idlwave-system-directory', which invokes the
|
2006-04-06 18:46:56 +00:00
|
|
|
|
IDL assistant.")
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-assistant-available ()
|
|
|
|
|
(if idlwave-help-assistant-available
|
|
|
|
|
(eq idlwave-help-assistant-available t)
|
|
|
|
|
(setq idlwave-help-assistant-available
|
|
|
|
|
(if (file-executable-p (idlwave-help-assistant-command))
|
|
|
|
|
t
|
|
|
|
|
'not-available))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-assistant-command ()
|
|
|
|
|
(expand-file-name idlwave-help-assistant-command (idlwave-sys-dir)))
|
|
|
|
|
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(defun idlwave-help-assistant-start (&optional full-link)
|
|
|
|
|
"Start the IDL Assistant, loading link FULL-LINK, if passed."
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(when (or (not idlwave-help-assistant-socket)
|
|
|
|
|
(not (eq (process-status idlwave-help-assistant-socket) 'open)))
|
|
|
|
|
(let* ((help-loc (idlwave-html-help-location))
|
|
|
|
|
(command (idlwave-help-assistant-command))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(extra-args
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(nconc
|
|
|
|
|
(if (memq system-type '(ms-dos windows-nt))
|
|
|
|
|
`("-profile" ,(expand-file-name "idl.adp" help-loc)))
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(if full-link `("-file" ,full-link))))
|
2006-04-06 18:46:56 +00:00
|
|
|
|
port)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(if idlwave-help-assistant-socket
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(delete-process idlwave-help-assistant-socket))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
|
|
|
|
(setq idlwave-help-assistant-process
|
|
|
|
|
(apply 'start-process
|
2006-04-06 18:46:56 +00:00
|
|
|
|
"IDL_ASSISTANT_PROC" nil command "-server" extra-args))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(set-process-filter idlwave-help-assistant-process
|
|
|
|
|
(lambda (proc string)
|
|
|
|
|
(setq port (string-to-number string))))
|
|
|
|
|
(unless (accept-process-output idlwave-help-assistant-process 15)
|
|
|
|
|
(error "Failed binding IDL_ASSISTANT socket"))
|
|
|
|
|
(if (not port)
|
2010-01-02 01:05:44 +00:00
|
|
|
|
(error "Unable to open IDL_ASSISTANT")
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(set-process-filter idlwave-help-assistant-process nil)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq idlwave-help-assistant-socket
|
|
|
|
|
(open-network-stream "IDL_ASSISTANT_SOCK"
|
2006-04-06 18:46:56 +00:00
|
|
|
|
nil "localhost" port))
|
|
|
|
|
(if (eq (process-status idlwave-help-assistant-socket) 'open)
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(progn
|
|
|
|
|
(process-send-string idlwave-help-assistant-socket
|
|
|
|
|
(concat "setHelpPath " help-loc "\n"))
|
|
|
|
|
t)
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(idlwave-help-assistant-close)
|
|
|
|
|
(error "Cannot communicate with IDL_ASSISTANT"))))))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-assistant-raise ()
|
|
|
|
|
(idlwave-help-assistant-start)
|
|
|
|
|
(process-send-string idlwave-help-assistant-socket "raise\n"))
|
|
|
|
|
|
|
|
|
|
(defun idlwave-help-assistant-open-link (&optional link)
|
|
|
|
|
;; Open a link (file name with anchor, no leading path) in the assistant.
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(let ((help-loc (idlwave-html-help-location))
|
|
|
|
|
topic anchor file just-started exists full-link)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(if (string-match "\.html" link)
|
|
|
|
|
(setq topic (substring link 0 (match-beginning 0))
|
|
|
|
|
anchor (substring link (match-end 0)))
|
2009-09-24 01:37:14 +00:00
|
|
|
|
(error "Malformed help link"))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(setq file (expand-file-name (concat topic ".html") help-loc))
|
|
|
|
|
(if (file-exists-p file)
|
|
|
|
|
(setq exists t)
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq file (expand-file-name
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(concat (upcase topic) ".html") help-loc))
|
|
|
|
|
(setq exists (file-exists-p file)))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(setq full-link (concat file anchor)
|
|
|
|
|
just-started (idlwave-help-assistant-start (if exists full-link)))
|
|
|
|
|
(if exists
|
|
|
|
|
(progn
|
|
|
|
|
(if (not just-started)
|
|
|
|
|
(process-send-string idlwave-help-assistant-socket
|
|
|
|
|
(concat "openLink " full-link "\n")))
|
|
|
|
|
(process-send-string idlwave-help-assistant-socket
|
|
|
|
|
(concat "searchIndexNoOpen " topic "\n")))
|
|
|
|
|
(process-send-string idlwave-help-assistant-socket
|
|
|
|
|
(concat "searchIndexAndOpen " topic "\n"))))
|
|
|
|
|
(idlwave-help-assistant-raise))
|
|
|
|
|
|
|
|
|
|
(defvar idlwave-help-assistant-help-with-topic-history nil
|
|
|
|
|
"The history of help topics selected with the minibuffer.")
|
|
|
|
|
|
2007-10-26 22:24:14 +00:00
|
|
|
|
(defvar idlwave-system-routines)
|
|
|
|
|
|
2006-11-20 21:41:00 +00:00
|
|
|
|
(defun idlwave-help-assistant-help-with-topic (&optional topic)
|
|
|
|
|
"Prompt for and provide help with TOPIC."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let (list)
|
|
|
|
|
(unless topic
|
|
|
|
|
(idlwave-routines)
|
|
|
|
|
(setq list (append (mapcar (lambda (x)
|
|
|
|
|
(concat (nth 2 x) (car x)))
|
|
|
|
|
idlwave-system-routines)
|
|
|
|
|
(mapcar (lambda (x)
|
|
|
|
|
(concat "." (car x)))
|
|
|
|
|
idlwave-executive-commands-alist)
|
|
|
|
|
idlwave-system-class-info))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
(setq topic
|
|
|
|
|
(idlwave-completing-read
|
2006-11-20 21:41:00 +00:00
|
|
|
|
"Help Topic: " list
|
|
|
|
|
nil nil nil
|
|
|
|
|
'idlwave-help-assistant-help-with-topic-history)))
|
|
|
|
|
(if (and topic (not (string= topic "")))
|
|
|
|
|
(idlwave-help-assistant-open-link (concat topic ".html")))))
|
2008-05-06 07:14:39 +00:00
|
|
|
|
|
2006-04-06 18:46:56 +00:00
|
|
|
|
(defun idlwave-help-assistant-close ()
|
|
|
|
|
(when (and idlwave-help-assistant-process
|
|
|
|
|
(eq (process-status idlwave-help-assistant-process) 'run))
|
|
|
|
|
(when idlwave-help-assistant-socket
|
|
|
|
|
(process-send-string idlwave-help-assistant-socket "quit\n")
|
|
|
|
|
(delete-process idlwave-help-assistant-socket))
|
|
|
|
|
(stop-process idlwave-help-assistant-process)
|
|
|
|
|
(delete-process idlwave-help-assistant-process)
|
|
|
|
|
(setq idlwave-help-assistant-socket nil
|
|
|
|
|
idlwave-help-assistant-process nil)))
|
|
|
|
|
|
|
|
|
|
|
2004-11-17 05:58:20 +00:00
|
|
|
|
(provide 'idlw-help)
|
|
|
|
|
(provide 'idlwave-help)
|
|
|
|
|
|
2004-11-17 11:52:34 +00:00
|
|
|
|
;;; idlw-help.el ends here
|