Commit a6d5fd23 authored by Juanma Barranquero's avatar Juanma Barranquero
Browse files

(browse-url-generic-args): Add defvar.

(idlwave-help-with-source): Use `insert-buffer-substring', not `insert-buffer'.
parent fca8b94c
...@@ -36,11 +36,13 @@ ...@@ -36,11 +36,13 @@
;; information, at: ;; information, at:
;; ;;
;; http://idlwave.org ;; http://idlwave.org
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Code: ;;; Code:
(defvar browse-url-generic-args)
(defvar idlwave-help-browse-url-available nil (defvar idlwave-help-browse-url-available nil
"Whether browse-url is available") "Whether browse-url is available")
...@@ -58,10 +60,10 @@ ...@@ -58,10 +60,10 @@
:group 'idlwave-online-help :group 'idlwave-online-help
:type 'boolean) :type 'boolean)
(defvar idlwave-html-link-sep (defvar idlwave-html-link-sep
(if idlwave-html-help-pre-v6 "#" "#wp")) (if idlwave-html-help-pre-v6 "#" "#wp"))
(defcustom idlwave-html-help-location (defcustom idlwave-html-help-location
(if (memq system-type '(ms-dos windows-nt)) (if (memq system-type '(ms-dos windows-nt))
nil nil
"/usr/local/etc/") "/usr/local/etc/")
...@@ -89,7 +91,7 @@ Defaults to `browse-url-browser-function', which see." ...@@ -89,7 +91,7 @@ Defaults to `browse-url-browser-function', which see."
:group 'idlwave-online-help :group 'idlwave-online-help
:type 'string) :type 'string)
(defcustom idlwave-help-browser-generic-args (defcustom idlwave-help-browser-generic-args
(if (boundp 'browse-url-generic-args) (if (boundp 'browse-url-generic-args)
browse-url-generic-args "") browse-url-generic-args "")
"Program args to use if using browse-url-generic-program." "Program args to use if using browse-url-generic-program."
...@@ -196,7 +198,7 @@ support." ...@@ -196,7 +198,7 @@ support."
(defvar idlwave-help-activate-links-aggressively nil (defvar idlwave-help-activate-links-aggressively nil
"Obsolete variable.") "Obsolete variable.")
(defvar idlwave-completion-help-info) (defvar idlwave-completion-help-info)
(defvar idlwave-help-frame nil (defvar idlwave-help-frame nil
...@@ -324,7 +326,7 @@ It collects and prints the diagnostics messages." ...@@ -324,7 +326,7 @@ It collects and prints the diagnostics messages."
(setq idlwave-last-context-help-pos marker) (setq idlwave-last-context-help-pos marker)
(idlwave-do-context-help1 arg) (idlwave-do-context-help1 arg)
(if idlwave-help-diagnostics (if idlwave-help-diagnostics
(message "%s" (mapconcat 'identity (message "%s" (mapconcat 'identity
(nreverse idlwave-help-diagnostics) (nreverse idlwave-help-diagnostics)
"; ")))))) "; "))))))
...@@ -337,7 +339,7 @@ It collects and prints the diagnostics messages." ...@@ -337,7 +339,7 @@ It collects and prints the diagnostics messages."
(defun idlwave-do-context-help1 (&optional arg) (defun idlwave-do-context-help1 (&optional arg)
"The work-horse version of `idlwave-context-help', which see." "The work-horse version of `idlwave-context-help', which see."
(save-excursion (save-excursion
(if (equal (char-after) ?/) (if (equal (char-after) ?/)
(forward-char 1) (forward-char 1)
(if (equal (char-before) ?=) (if (equal (char-before) ?=)
(backward-char 1))) (backward-char 1)))
...@@ -347,7 +349,7 @@ It collects and prints the diagnostics messages." ...@@ -347,7 +349,7 @@ It collects and prints the diagnostics messages."
(beg (save-excursion (skip-chars-backward chars) (point))) (beg (save-excursion (skip-chars-backward chars) (point)))
(end (save-excursion (skip-chars-forward chars) (point))) (end (save-excursion (skip-chars-forward chars) (point)))
(this-word (buffer-substring-no-properties beg end)) (this-word (buffer-substring-no-properties beg end))
(st-ass (assoc (downcase this-word) (st-ass (assoc (downcase this-word)
idlwave-help-special-topic-words)) idlwave-help-special-topic-words))
(classtag (and (string-match "self\\." this-word) (classtag (and (string-match "self\\." this-word)
(< beg (- end 4)))) (< beg (- end 4))))
...@@ -355,7 +357,7 @@ It collects and prints the diagnostics messages." ...@@ -355,7 +357,7 @@ It collects and prints the diagnostics messages."
(string-match "\\`\\([^.]+\\)\\." this-word) (string-match "\\`\\([^.]+\\)\\." this-word)
(< beg (- end 4)))) (< beg (- end 4))))
module keyword cw mod1 mod2 mod3) module keyword cw mod1 mod2 mod3)
(if (or arg (if (or arg
(and (not st-ass) (and (not st-ass)
(not classtag) (not classtag)
(not structtag) (not structtag)
...@@ -374,15 +376,15 @@ It collects and prints the diagnostics messages." ...@@ -374,15 +376,15 @@ It collects and prints the diagnostics messages."
(setq module (list "init" 'fun (match-string 1 str)) (setq module (list "init" 'fun (match-string 1 str))
idlwave-current-obj_new-class (match-string 1 str)) idlwave-current-obj_new-class (match-string 1 str))
))))) )))))
(cond (cond
(arg (setq mod1 module)) (arg (setq mod1 module))
;; A special topic -- only system help ;; A special topic -- only system help
(st-ass (setq mod1 (list (cdr st-ass)))) (st-ass (setq mod1 (list (cdr st-ass))))
;; A system variable -- only system help ;; A system variable -- only system help
((string-match ((string-match
"\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?" "\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?"
this-word) this-word)
(let* ((word (match-string-no-properties 1 this-word)) (let* ((word (match-string-no-properties 1 this-word))
(entry (assq (idlwave-sintern-sysvar word) (entry (assq (idlwave-sintern-sysvar word)
...@@ -394,10 +396,10 @@ It collects and prints the diagnostics messages." ...@@ -394,10 +396,10 @@ It collects and prints the diagnostics messages."
(cdr (assq 'tags entry)))))) (cdr (assq 'tags entry))))))
(link (nth 1 (assq 'link entry)))) (link (nth 1 (assq 'link entry))))
(if tag-target (if tag-target
(setq link (idlwave-substitute-link-target link (setq link (idlwave-substitute-link-target link
tag-target))) tag-target)))
(setq mod1 (list link)))) (setq mod1 (list link))))
;; An executive command -- only system help ;; An executive command -- only system help
((string-match "^\\.\\([A-Z_]+\\)" this-word) ((string-match "^\\.\\([A-Z_]+\\)" this-word)
(let* ((word (match-string 1 this-word)) (let* ((word (match-string 1 this-word))
...@@ -405,7 +407,7 @@ It collects and prints the diagnostics messages." ...@@ -405,7 +407,7 @@ It collects and prints the diagnostics messages."
word word
idlwave-executive-commands-alist t)))) idlwave-executive-commands-alist t))))
(setq mod1 (list link)))) (setq mod1 (list link))))
;; A class -- system OR in-text help (via class__define). ;; A class -- system OR in-text help (via class__define).
((and (eq cw 'class) ((and (eq cw 'class)
(or (idlwave-in-quote) ; e.g. obj_new (or (idlwave-in-quote) ; e.g. obj_new
...@@ -419,28 +421,28 @@ It collects and prints the diagnostics messages." ...@@ -419,28 +421,28 @@ It collects and prints the diagnostics messages."
(name (concat (downcase this-word) "__define")) (name (concat (downcase this-word) "__define"))
(link (nth 1 (assq 'link entry)))) (link (nth 1 (assq 'link entry))))
(setq mod1 (list link name 'pro)))) (setq mod1 (list link name 'pro))))
;; A class structure tag (self.BLAH) -- only in-text help available ;; A class structure tag (self.BLAH) -- only in-text help available
(classtag (classtag
(let ((tag (substring this-word (match-end 0))) (let ((tag (substring this-word (match-end 0)))
class-with found-in) class-with found-in)
(when (setq class-with (when (setq class-with
(idlwave-class-or-superclass-with-tag (idlwave-class-or-superclass-with-tag
(nth 2 (idlwave-current-routine)) (nth 2 (idlwave-current-routine))
tag)) tag))
(setq found-in (idlwave-class-found-in class-with)) (setq found-in (idlwave-class-found-in class-with))
(if (assq (idlwave-sintern-class class-with) (if (assq (idlwave-sintern-class class-with)
idlwave-system-class-info) idlwave-system-class-info)
(error "No help available for system class tags")) (error "No help available for system class tags"))
(setq idlwave-help-do-class-struct-tag t) (setq idlwave-help-do-class-struct-tag t)
(setq mod1 (list nil (setq mod1 (list nil
(if found-in (if found-in
(cons (concat found-in "__define") class-with) (cons (concat found-in "__define") class-with)
(concat class-with "__define")) (concat class-with "__define"))
'pro 'pro
nil ; no class.... it's a procedure! nil ; no class.... it's a procedure!
tag))))) tag)))))
;; A regular structure tag -- only in text, and if ;; A regular structure tag -- only in text, and if
;; optional `complete-structtag' loaded. ;; optional `complete-structtag' loaded.
(structtag (structtag
...@@ -451,7 +453,7 @@ It collects and prints the diagnostics messages." ...@@ -451,7 +453,7 @@ It collects and prints the diagnostics messages."
(setq idlwave-help-do-struct-tag (setq idlwave-help-do-struct-tag
idlwave-structtag-struct-location idlwave-structtag-struct-location
mod1 (list nil nil nil nil tag)))) mod1 (list nil nil nil nil tag))))
;; A routine keyword -- in text or system help ;; A routine keyword -- in text or system help
((and (memq cw '(function-keyword procedure-keyword)) ((and (memq cw '(function-keyword procedure-keyword))
(stringp this-word) (stringp this-word)
...@@ -493,7 +495,7 @@ It collects and prints the diagnostics messages." ...@@ -493,7 +495,7 @@ It collects and prints the diagnostics messages."
(setq mod1 (append (list t) module (list keyword)) (setq mod1 (append (list t) module (list keyword))
mod2 (list t this-word 'fun nil) mod2 (list t this-word 'fun nil)
mod3 (append (list t) module))))) mod3 (append (list t) module)))))
;; Everything else ;; Everything else
(t (t
(setq mod1 (append (list t) module)))) (setq mod1 (append (list t) module))))
...@@ -526,14 +528,14 @@ Needs additional info stored in global `idlwave-completion-help-info'." ...@@ -526,14 +528,14 @@ Needs additional info stored in global `idlwave-completion-help-info'."
word link) word link)
(mouse-set-point ev) (mouse-set-point ev)
;; See if we can also find help somewhere, e.g. for multiple classes ;; See if we can also find help somewhere, e.g. for multiple classes
(setq word (idlwave-this-word)) (setq word (idlwave-this-word))
(if (string= word "") (if (string= word "")
(error "No help item selected")) (error "No help item selected"))
(setq link (get-text-property 0 'link word)) (setq link (get-text-property 0 'link word))
(select-window cw) (select-window cw)
(cond (cond
;; Routine name ;; Routine name
((memq what '(procedure function routine)) ((memq what '(procedure function routine))
(setq name word) (setq name word)
...@@ -544,9 +546,9 @@ Needs additional info stored in global `idlwave-completion-help-info'." ...@@ -544,9 +546,9 @@ Needs additional info stored in global `idlwave-completion-help-info'."
type))) type)))
(setq link t) ; No specific link valid yet (setq link t) ; No specific link valid yet
(if sclasses (if sclasses
(setq classes (idlwave-members-only (setq classes (idlwave-members-only
classes (cons class sclasses)))) classes (cons class sclasses))))
(setq class (idlwave-popup-select ev classes (setq class (idlwave-popup-select ev classes
"Select Class" 'sort)))) "Select Class" 'sort))))
;; XXX is this necessary, given all-method-classes? ;; XXX is this necessary, given all-method-classes?
...@@ -566,7 +568,7 @@ Needs additional info stored in global `idlwave-completion-help-info'." ...@@ -566,7 +568,7 @@ Needs additional info stored in global `idlwave-completion-help-info'."
type))) type)))
(setq link t) ; Link can't be correct yet (setq link t) ; Link can't be correct yet
(if sclasses (if sclasses
(setq classes (idlwave-members-only (setq classes (idlwave-members-only
classes (cons class sclasses)))) classes (cons class sclasses))))
(setq class (idlwave-popup-select ev classes (setq class (idlwave-popup-select ev classes
"Select Class" 'sort)) "Select Class" 'sort))
...@@ -578,14 +580,14 @@ Needs additional info stored in global `idlwave-completion-help-info'." ...@@ -578,14 +580,14 @@ Needs additional info stored in global `idlwave-completion-help-info'."
(if (string= (downcase name) "obj_new") (if (string= (downcase name) "obj_new")
(setq class idlwave-current-obj_new-class (setq class idlwave-current-obj_new-class
name "Init")))) name "Init"))))
;; Class name ;; Class name
((eq what 'class) ((eq what 'class)
(setq class word (setq class word
word nil)) word nil))
;; A special named function to call which sets some of our variables ;; A special named function to call which sets some of our variables
((and (symbolp what) ((and (symbolp what)
(fboundp what)) (fboundp what))
(funcall what 'set word)) (funcall what 'set word))
...@@ -600,7 +602,7 @@ Needs additional info stored in global `idlwave-completion-help-info'." ...@@ -600,7 +602,7 @@ Needs additional info stored in global `idlwave-completion-help-info'."
"Highlight all completions for which help is available and attach link. "Highlight all completions for which help is available and attach link.
Those words in `idlwave-completion-help-links' have links. The Those words in `idlwave-completion-help-links' have links. The
`idlwave-help-link' face is used for this." `idlwave-help-link' face is used for this."
(if idlwave-highlight-help-links-in-completion (if idlwave-highlight-help-links-in-completion
(with-current-buffer (get-buffer "*Completions*") (with-current-buffer (get-buffer "*Completions*")
(save-excursion (save-excursion
(let* ((case-fold-search t) (let* ((case-fold-search t)
...@@ -616,7 +618,7 @@ Those words in `idlwave-completion-help-links' have links. The ...@@ -616,7 +618,7 @@ Those words in `idlwave-completion-help-links' have links. The
(setq beg (match-beginning 1) end (match-end 1) (setq beg (match-beginning 1) end (match-end 1)
word (match-string 1) doit nil) word (match-string 1) doit nil)
;; Call special completion function test ;; Call special completion function test
(if (and (symbolp what) (if (and (symbolp what)
(fboundp what)) (fboundp what))
(setq doit (funcall what 'test word)) (setq doit (funcall what 'test word))
;; Look for special link property passed in help-links ;; Look for special link property passed in help-links
...@@ -647,13 +649,13 @@ Those words in `idlwave-completion-help-links' have links. The ...@@ -647,13 +649,13 @@ Those words in `idlwave-completion-help-links' have links. The
;; Try to select the return frame. ;; Try to select the return frame.
;; This can crash on slow network connections, obviously when ;; This can crash on slow network connections, obviously when
;; we kill the help frame before the return-frame is selected. ;; we kill the help frame before the return-frame is selected.
;; To protect the workings, we wait for up to one second ;; To protect the workings, we wait for up to one second
;; and check if the return-frame *is* now selected. ;; and check if the return-frame *is* now selected.
;; This is marked "eperimental" since we are not sure when its OK. ;; This is marked "eperimental" since we are not sure when its OK.
(let ((maxtime 1.0) (time 0.) (step 0.1)) (let ((maxtime 1.0) (time 0.) (step 0.1))
(select-frame idlwave-help-return-frame) (select-frame idlwave-help-return-frame)
(while (and (sit-for step) (while (and (sit-for step)
(not (eq (selected-frame) (not (eq (selected-frame)
idlwave-help-return-frame)) idlwave-help-return-frame))
(< (setq time (+ time step)) maxtime))))) (< (setq time (+ time step)) maxtime)))))
(delete-frame idlwave-help-frame)) (delete-frame idlwave-help-frame))
...@@ -666,7 +668,7 @@ Those words in `idlwave-completion-help-links' have links. The ...@@ -666,7 +668,7 @@ Those words in `idlwave-completion-help-links' have links. The
(defvar default-toolbar-visible-p) (defvar default-toolbar-visible-p)
(defun idlwave-help-display-help-window (&optional pos-or-func) (defun idlwave-help-display-help-window (&optional pos-or-func)
"Display the help window. "Display the help window.
Move window start to POS-OR-FUNC, if passed as a position, or call it 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'." if passed as a function. See `idlwave-help-use-dedicated-frame'."
(let ((cw (selected-window)) (let ((cw (selected-window))
...@@ -677,13 +679,13 @@ if passed as a function. See `idlwave-help-use-dedicated-frame'." ...@@ -677,13 +679,13 @@ if passed as a function. See `idlwave-help-use-dedicated-frame'."
(switch-to-buffer buf)) (switch-to-buffer buf))
;; Do it in this frame and save the window configuration ;; Do it in this frame and save the window configuration
(if (not (get-buffer-window buf nil)) (if (not (get-buffer-window buf nil))
(setq idlwave-help-window-configuration (setq idlwave-help-window-configuration
(current-window-configuration))) (current-window-configuration)))
(display-buffer buf nil (selected-frame)) (display-buffer buf nil (selected-frame))
(select-window (get-buffer-window buf))) (select-window (get-buffer-window buf)))
(raise-frame) (raise-frame)
(if pos-or-func (if pos-or-func
(if (functionp pos-or-func) (if (functionp pos-or-func)
(funcall pos-or-func) (funcall pos-or-func)
(goto-char pos-or-func) (goto-char pos-or-func)
(recenter 0))) (recenter 0)))
...@@ -705,31 +707,31 @@ if passed as a function. See `idlwave-help-use-dedicated-frame'." ...@@ -705,31 +707,31 @@ if passed as a function. See `idlwave-help-use-dedicated-frame'."
(select-frame idlwave-help-return-frame))) (select-frame idlwave-help-return-frame)))
(defun idlwave-online-help (link &optional name type class keyword) (defun idlwave-online-help (link &optional name type class keyword)
"Display HTML or other special help on a certain topic. "Display HTML or other special help on a certain topic.
Either loads an HTML link, if LINK is non-nil, or gets special-help on 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 the optional arguments, if any special help is defined. If LINK is
`t', first look up the optional arguments in the routine info list to `t', first look up the optional arguments in the routine info list to
see if a link is set for it. Try extra help functions if necessary." see if a link is set for it. Try extra help functions if necessary."
;; Lookup link ;; Lookup link
(if (eq link t) (if (eq link t)
(let ((entry (idlwave-best-rinfo-assoc name type class (let ((entry (idlwave-best-rinfo-assoc name type class
(idlwave-routines) nil t))) (idlwave-routines) nil t)))
(cond (cond
;; Try keyword link ;; Try keyword link
((and keyword ((and keyword
(setq link (cdr (idlwave-entry-find-keyword entry keyword))))) (setq link (cdr (idlwave-entry-find-keyword entry keyword)))))
;; Default, regular entry link ;; Default, regular entry link
(t (setq link (idlwave-entry-has-help entry)))))) (t (setq link (idlwave-entry-has-help entry))))))
(cond (cond
;; An explicit link ;; An explicit link
((stringp link) ((stringp link)
(idlwave-help-html-link link)) (idlwave-help-html-link link))
;; Any extra help ;; Any extra help
(idlwave-extra-help-function (idlwave-extra-help-function
(idlwave-help-get-special-help name type class keyword)) (idlwave-help-get-special-help name type class keyword))
;; Nothing worked ;; Nothing worked
(t (idlwave-help-error name type class keyword)))) (t (idlwave-help-error name type class keyword))))
...@@ -740,7 +742,7 @@ see if a link is set for it. Try extra help functions if necessary." ...@@ -740,7 +742,7 @@ see if a link is set for it. Try extra help functions if necessary."
(help-pos (save-excursion (help-pos (save-excursion
(set-buffer (idlwave-help-get-help-buffer)) (set-buffer (idlwave-help-get-help-buffer))
(let ((buffer-read-only nil)) (let ((buffer-read-only nil))
(funcall idlwave-extra-help-function (funcall idlwave-extra-help-function
name type class keyword))))) name type class keyword)))))
(if help-pos (if help-pos
(idlwave-help-display-help-window help-pos) (idlwave-help-display-help-window help-pos)
...@@ -754,7 +756,7 @@ see if a link is set for it. Try extra help functions if necessary." ...@@ -754,7 +756,7 @@ see if a link is set for it. Try extra help functions if necessary."
(browse-url-generic-program idlwave-help-browser-generic-program) (browse-url-generic-program idlwave-help-browser-generic-program)
;(browse-url-generic-args idlwave-help-browser-generic-args) ;(browse-url-generic-args idlwave-help-browser-generic-args)
full-link) full-link)
(unless idlwave-help-browse-url-available (unless idlwave-help-browse-url-available
(error "browse-url is not available -- install it to use HTML help.")) (error "browse-url is not available -- install it to use HTML help."))
...@@ -772,12 +774,12 @@ see if a link is set for it. Try extra help functions if necessary." ...@@ -772,12 +774,12 @@ see if a link is set for it. Try extra help functions if necessary."
;; Just a regular file name (+ anchor name) ;; Just a regular file name (+ anchor name)
(unless (and (stringp help-loc) (unless (and (stringp help-loc)
(file-directory-p help-loc)) (file-directory-p help-loc))
(error (error
"Invalid help location; customize `idlwave-html-help-location'.")) "Invalid help location; customize `idlwave-html-help-location'."))
(setq full-link (concat (setq full-link (concat
"file://" "file://"
(expand-file-name (expand-file-name
link link
(expand-file-name "idl_html_help" help-loc))))) (expand-file-name "idl_html_help" help-loc)))))
;; Check for a local browser ;; Check for a local browser
...@@ -812,7 +814,7 @@ This function can be used as `idlwave-extra-help-function'." ...@@ -812,7 +814,7 @@ This function can be used as `idlwave-extra-help-function'."
(if class-only ;Help with class? Using "Init" as source. (if class-only ;Help with class? Using "Init" as source.
(setq name "Init" (setq name "Init"
type 'fun)) type 'fun))
(if (not struct-tag) (if (not struct-tag)
(setq file (setq file
(idlwave-routine-source-file (idlwave-routine-source-file
(nth 3 (idlwave-best-rinfo-assoc (nth 3 (idlwave-best-rinfo-assoc
...@@ -825,7 +827,7 @@ This function can be used as `idlwave-extra-help-function'." ...@@ -825,7 +827,7 @@ This function can be used as `idlwave-extra-help-function'."
(if (or struct-tag (stringp file)) (if (or struct-tag (stringp file))
(progn (progn
(setq in-buf ; structure-tag completion is always in current buffer (setq in-buf ; structure-tag completion is always in current buffer
(if struct-tag (if struct-tag
idlwave-current-tags-buffer idlwave-current-tags-buffer
(idlwave-get-buffer-visiting file))) (idlwave-get-buffer-visiting file)))
;; see if file is in a visited buffer, insert those contents ;; see if file is in a visited buffer, insert those contents
...@@ -833,7 +835,8 @@ This function can be used as `idlwave-extra-help-function'." ...@@ -833,7 +835,8 @@ This function can be used as `idlwave-extra-help-function'."
(progn (progn
(setq file (buffer-file-name in-buf)) (setq file (buffer-file-name in-buf))
(erase-buffer) (erase-buffer)
(insert-buffer in-buf)) (insert-buffer-substring in-buf)
(goto-char (point-min)))
(if (file-exists-p file) ;; otherwise just load the file (if (file-exists-p file) ;; otherwise just load the file
(progn (progn
(erase-buffer) (erase-buffer)
...@@ -847,19 +850,19 @@ This function can be used as `idlwave-extra-help-function'." ...@@ -847,19 +850,19 @@ This function can be used as `idlwave-extra-help-function'."
;; Try to find a good place to display ;; Try to find a good place to display
(setq def-pos (setq def-pos
;; Find the class structure tag if that's what we're after ;; Find the class structure tag if that's what we're after
(cond (cond
;; Class structure tags: find the class or named structure ;; Class structure tags: find the class or named structure
;; definition ;; definition
(class-struct-tag (class-struct-tag
(save-excursion (save-excursion
(setq class (setq class
(if (string-match "[a-zA-Z0-9]\\(__\\)" name) (if (string-match "[a-zA-Z0-9]\\(__\\)" name)
(substring name 0 (match-beginning 1)) (substring name 0 (match-beginning 1))
idlwave-current-tags-class)) idlwave-current-tags-class))
(and (and
(idlwave-find-class-definition class nil real-class) (idlwave-find-class-definition class nil real-class)
(idlwave-find-struct-tag keyword)))) (idlwave-find-struct-tag keyword))))
;; Generic structure tags: the structure definition ;; Generic structure tags: the structure definition
;; location within the file has been recorded in ;; location within the file has been recorded in
;; `struct-tag' ;; `struct-tag'
...@@ -869,14 +872,14 @@ This function can be used as `idlwave-extra-help-function'." ...@@ -869,14 +872,14 @@ This function can be used as `idlwave-extra-help-function'."
(integerp struct-tag) (integerp struct-tag)
(goto-char struct-tag) (goto-char struct-tag)
(idlwave-find-struct-tag keyword)))) (idlwave-find-struct-tag keyword))))
;; Just find the routine definition ;; Just find the routine definition
(t (t
(if class-only (point-min) (if class-only (point-min)
(idlwave-help-find-routine-definition name type class keyword)))) (idlwave-help-find-routine-definition name type class keyword))))