36 |
;; information, at: |
;; information, at: |
37 |
;; |
;; |
38 |
;; http://idlwave.org |
;; http://idlwave.org |
39 |
;; |
;; |
40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
41 |
|
|
42 |
|
|
52 |
:group 'idlwave-online-help |
:group 'idlwave-online-help |
53 |
:type 'boolean) |
:type 'boolean) |
54 |
|
|
55 |
(defvar idlwave-html-link-sep |
(defvar idlwave-html-link-sep |
56 |
(if idlwave-html-help-pre-v6 "#" "#wp")) |
(if idlwave-html-help-pre-v6 "#" "#wp")) |
57 |
|
|
58 |
(defcustom idlwave-html-help-location |
(defcustom idlwave-html-help-location |
59 |
(if (memq system-type '(ms-dos windows-nt)) |
(if (memq system-type '(ms-dos windows-nt)) |
60 |
nil |
nil |
61 |
"/usr/local/etc/") |
"/usr/local/etc/") |
83 |
:group 'idlwave-online-help |
:group 'idlwave-online-help |
84 |
:type 'string) |
:type 'string) |
85 |
|
|
86 |
(defcustom idlwave-help-browser-generic-args |
(defcustom idlwave-help-browser-generic-args |
87 |
(if (boundp 'browse-url-generic-args) |
(if (boundp 'browse-url-generic-args) |
88 |
browse-url-generic-args "") |
browse-url-generic-args "") |
89 |
"Program args to use if using browse-url-generic-program." |
"Program args to use if using browse-url-generic-program." |
191 |
|
|
192 |
(defvar idlwave-help-activate-links-aggressively nil |
(defvar idlwave-help-activate-links-aggressively nil |
193 |
"Obsolete variable.") |
"Obsolete variable.") |
194 |
|
|
195 |
(defvar idlwave-completion-help-info) |
(defvar idlwave-completion-help-info) |
196 |
|
|
197 |
(defvar idlwave-help-frame nil |
(defvar idlwave-help-frame nil |
314 |
(setq idlwave-last-context-help-pos marker) |
(setq idlwave-last-context-help-pos marker) |
315 |
(idlwave-do-context-help1 arg) |
(idlwave-do-context-help1 arg) |
316 |
(if idlwave-help-diagnostics |
(if idlwave-help-diagnostics |
317 |
(message "%s" (mapconcat 'identity |
(message "%s" (mapconcat 'identity |
318 |
(nreverse idlwave-help-diagnostics) |
(nreverse idlwave-help-diagnostics) |
319 |
"; ")))))) |
"; ")))))) |
320 |
|
|
323 |
(defun idlwave-do-context-help1 (&optional arg) |
(defun idlwave-do-context-help1 (&optional arg) |
324 |
"The work-horse version of `idlwave-context-help', which see." |
"The work-horse version of `idlwave-context-help', which see." |
325 |
(save-excursion |
(save-excursion |
326 |
(if (equal (char-after) ?/) |
(if (equal (char-after) ?/) |
327 |
(forward-char 1) |
(forward-char 1) |
328 |
(if (equal (char-before) ?=) |
(if (equal (char-before) ?=) |
329 |
(backward-char 1))) |
(backward-char 1))) |
333 |
(beg (save-excursion (skip-chars-backward chars) (point))) |
(beg (save-excursion (skip-chars-backward chars) (point))) |
334 |
(end (save-excursion (skip-chars-forward chars) (point))) |
(end (save-excursion (skip-chars-forward chars) (point))) |
335 |
(this-word (buffer-substring-no-properties beg end)) |
(this-word (buffer-substring-no-properties beg end)) |
336 |
(st-ass (assoc (downcase this-word) |
(st-ass (assoc (downcase this-word) |
337 |
idlwave-help-special-topic-words)) |
idlwave-help-special-topic-words)) |
338 |
(classtag (and (string-match "self\\." this-word) |
(classtag (and (string-match "self\\." this-word) |
339 |
(< beg (- end 4)))) |
(< beg (- end 4)))) |
341 |
(string-match "\\`\\([^.]+\\)\\." this-word) |
(string-match "\\`\\([^.]+\\)\\." this-word) |
342 |
(< beg (- end 4)))) |
(< beg (- end 4)))) |
343 |
module keyword cw mod1 mod2 mod3) |
module keyword cw mod1 mod2 mod3) |
344 |
(if (or arg |
(if (or arg |
345 |
(and (not st-ass) |
(and (not st-ass) |
346 |
(not classtag) |
(not classtag) |
347 |
(not structtag) |
(not structtag) |
360 |
(setq module (list "init" 'fun (match-string 1 str)) |
(setq module (list "init" 'fun (match-string 1 str)) |
361 |
idlwave-current-obj_new-class (match-string 1 str)) |
idlwave-current-obj_new-class (match-string 1 str)) |
362 |
))))) |
))))) |
363 |
(cond |
(cond |
364 |
(arg (setq mod1 module)) |
(arg (setq mod1 module)) |
365 |
|
|
366 |
;; A special topic -- only system help |
;; A special topic -- only system help |
367 |
(st-ass (setq mod1 (list (cdr st-ass)))) |
(st-ass (setq mod1 (list (cdr st-ass)))) |
368 |
|
|
369 |
;; A system variable -- only system help |
;; A system variable -- only system help |
370 |
((string-match |
((string-match |
371 |
"\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?" |
"\\`!\\([a-zA-Z0-9_]+\\)\\(\.\\([A-Za-z0-9_]+\\)\\)?" |
372 |
this-word) |
this-word) |
373 |
(let* ((word (match-string-no-properties 1 this-word)) |
(let* ((word (match-string-no-properties 1 this-word)) |
374 |
(entry (assq (idlwave-sintern-sysvar word) |
(entry (assq (idlwave-sintern-sysvar word) |
380 |
(cdr (assq 'tags entry)))))) |
(cdr (assq 'tags entry)))))) |
381 |
(link (nth 1 (assq 'link entry)))) |
(link (nth 1 (assq 'link entry)))) |
382 |
(if tag-target |
(if tag-target |
383 |
(setq link (idlwave-substitute-link-target link |
(setq link (idlwave-substitute-link-target link |
384 |
tag-target))) |
tag-target))) |
385 |
(setq mod1 (list link)))) |
(setq mod1 (list link)))) |
386 |
|
|
387 |
;; An executive command -- only system help |
;; An executive command -- only system help |
388 |
((string-match "^\\.\\([A-Z_]+\\)" this-word) |
((string-match "^\\.\\([A-Z_]+\\)" this-word) |
389 |
(let* ((word (match-string 1 this-word)) |
(let* ((word (match-string 1 this-word)) |
390 |
(link (cdr (assoc-ignore-case |
(link (cdr (assoc-string |
391 |
word |
word |
392 |
idlwave-executive-commands-alist)))) |
idlwave-executive-commands-alist |
393 |
|
t)))) |
394 |
(setq mod1 (list link)))) |
(setq mod1 (list link)))) |
395 |
|
|
396 |
;; A class -- system OR in-text help (via class__define). |
;; A class -- system OR in-text help (via class__define). |
397 |
((and (eq cw 'class) |
((and (eq cw 'class) |
398 |
(or (idlwave-in-quote) ; e.g. obj_new |
(or (idlwave-in-quote) ; e.g. obj_new |
406 |
(name (concat (downcase this-word) "__define")) |
(name (concat (downcase this-word) "__define")) |
407 |
(link (nth 1 (assq 'link entry)))) |
(link (nth 1 (assq 'link entry)))) |
408 |
(setq mod1 (list link name 'pro)))) |
(setq mod1 (list link name 'pro)))) |
409 |
|
|
410 |
;; A class structure tag (self.BLAH) -- only in-text help available |
;; A class structure tag (self.BLAH) -- only in-text help available |
411 |
(classtag |
(classtag |
412 |
(let ((tag (substring this-word (match-end 0))) |
(let ((tag (substring this-word (match-end 0))) |
413 |
class-with found-in) |
class-with found-in) |
414 |
(when (setq class-with |
(when (setq class-with |
415 |
(idlwave-class-or-superclass-with-tag |
(idlwave-class-or-superclass-with-tag |
416 |
(nth 2 (idlwave-current-routine)) |
(nth 2 (idlwave-current-routine)) |
417 |
tag)) |
tag)) |
418 |
(setq found-in (idlwave-class-found-in class-with)) |
(setq found-in (idlwave-class-found-in class-with)) |
419 |
(if (assq (idlwave-sintern-class class-with) |
(if (assq (idlwave-sintern-class class-with) |
420 |
idlwave-system-class-info) |
idlwave-system-class-info) |
421 |
(error "No help available for system class tags")) |
(error "No help available for system class tags")) |
422 |
(setq idlwave-help-do-class-struct-tag t) |
(setq idlwave-help-do-class-struct-tag t) |
423 |
(setq mod1 (list nil |
(setq mod1 (list nil |
424 |
(if found-in |
(if found-in |
425 |
(cons (concat found-in "__define") class-with) |
(cons (concat found-in "__define") class-with) |
426 |
(concat class-with "__define")) |
(concat class-with "__define")) |
427 |
'pro |
'pro |
428 |
nil ; no class.... it's a procedure! |
nil ; no class.... it's a procedure! |
429 |
tag))))) |
tag))))) |
430 |
|
|
431 |
;; A regular structure tag -- only in text, and if |
;; A regular structure tag -- only in text, and if |
432 |
;; optional `complete-structtag' loaded. |
;; optional `complete-structtag' loaded. |
433 |
(structtag |
(structtag |
438 |
(setq idlwave-help-do-struct-tag |
(setq idlwave-help-do-struct-tag |
439 |
idlwave-structtag-struct-location |
idlwave-structtag-struct-location |
440 |
mod1 (list nil nil nil nil tag)))) |
mod1 (list nil nil nil nil tag)))) |
441 |
|
|
442 |
;; A routine keyword -- in text or system help |
;; A routine keyword -- in text or system help |
443 |
((and (memq cw '(function-keyword procedure-keyword)) |
((and (memq cw '(function-keyword procedure-keyword)) |
444 |
(stringp this-word) |
(stringp this-word) |
480 |
(setq mod1 (append (list t) module (list keyword)) |
(setq mod1 (append (list t) module (list keyword)) |
481 |
mod2 (list t this-word 'fun nil) |
mod2 (list t this-word 'fun nil) |
482 |
mod3 (append (list t) module))))) |
mod3 (append (list t) module))))) |
483 |
|
|
484 |
;; Everything else |
;; Everything else |
485 |
(t |
(t |
486 |
(setq mod1 (append (list t) module)))) |
(setq mod1 (append (list t) module)))) |
513 |
word link) |
word link) |
514 |
(mouse-set-point ev) |
(mouse-set-point ev) |
515 |
|
|
516 |
|
|
517 |
;; 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 |
518 |
(setq word (idlwave-this-word)) |
(setq word (idlwave-this-word)) |
519 |
(if (string= word "") |
(if (string= word "") |
520 |
(error "No help item selected")) |
(error "No help item selected")) |
521 |
(setq link (get-text-property 0 'link word)) |
(setq link (get-text-property 0 'link word)) |
522 |
(select-window cw) |
(select-window cw) |
523 |
(cond |
(cond |
524 |
;; Routine name |
;; Routine name |
525 |
((memq what '(procedure function routine)) |
((memq what '(procedure function routine)) |
526 |
(setq name word) |
(setq name word) |
531 |
type))) |
type))) |
532 |
(setq link t) ; No specific link valid yet |
(setq link t) ; No specific link valid yet |
533 |
(if sclasses |
(if sclasses |
534 |
(setq classes (idlwave-members-only |
(setq classes (idlwave-members-only |
535 |
classes (cons class sclasses)))) |
classes (cons class sclasses)))) |
536 |
(setq class (idlwave-popup-select ev classes |
(setq class (idlwave-popup-select ev classes |
537 |
"Select Class" 'sort)))) |
"Select Class" 'sort)))) |
538 |
|
|
539 |
;; XXX is this necessary, given all-method-classes? |
;; XXX is this necessary, given all-method-classes? |
553 |
type))) |
type))) |
554 |
(setq link t) ; Link can't be correct yet |
(setq link t) ; Link can't be correct yet |
555 |
(if sclasses |
(if sclasses |
556 |
(setq classes (idlwave-members-only |
(setq classes (idlwave-members-only |
557 |
classes (cons class sclasses)))) |
classes (cons class sclasses)))) |
558 |
(setq class (idlwave-popup-select ev classes |
(setq class (idlwave-popup-select ev classes |
559 |
"Select Class" 'sort)) |
"Select Class" 'sort)) |
565 |
(if (string= (downcase name) "obj_new") |
(if (string= (downcase name) "obj_new") |
566 |
(setq class idlwave-current-obj_new-class |
(setq class idlwave-current-obj_new-class |
567 |
name "Init")))) |
name "Init")))) |
568 |
|
|
569 |
;; Class name |
;; Class name |
570 |
((eq what 'class) |
((eq what 'class) |
571 |
(setq class word |
(setq class word |
572 |
word nil)) |
word nil)) |
573 |
|
|
574 |
;; A special named function to call which sets some of our variables |
;; A special named function to call which sets some of our variables |
575 |
((and (symbolp what) |
((and (symbolp what) |
576 |
(fboundp what)) |
(fboundp what)) |
577 |
(funcall what 'set word)) |
(funcall what 'set word)) |
578 |
|
|
587 |
"Highlight all completions for which help is available and attach link. |
"Highlight all completions for which help is available and attach link. |
588 |
Those words in `idlwave-completion-help-links' have links. The |
Those words in `idlwave-completion-help-links' have links. The |
589 |
`idlwave-help-link-face' face is used for this." |
`idlwave-help-link-face' face is used for this." |
590 |
(if idlwave-highlight-help-links-in-completion |
(if idlwave-highlight-help-links-in-completion |
591 |
(with-current-buffer (get-buffer "*Completions*") |
(with-current-buffer (get-buffer "*Completions*") |
592 |
(save-excursion |
(save-excursion |
593 |
(let* ((case-fold-search t) |
(let* ((case-fold-search t) |
603 |
(setq beg (match-beginning 1) end (match-end 1) |
(setq beg (match-beginning 1) end (match-end 1) |
604 |
word (match-string 1) doit nil) |
word (match-string 1) doit nil) |
605 |
;; Call special completion function test |
;; Call special completion function test |
606 |
(if (and (symbolp what) |
(if (and (symbolp what) |
607 |
(fboundp what)) |
(fboundp what)) |
608 |
(setq doit (funcall what 'test word)) |
(setq doit (funcall what 'test word)) |
609 |
;; Look for special link property passed in help-links |
;; Look for special link property passed in help-links |
610 |
(if idlwave-completion-help-links |
(if idlwave-completion-help-links |
611 |
(setq doit (assoc-ignore-case |
(setq doit (assoc-string |
612 |
word idlwave-completion-help-links)))) |
word idlwave-completion-help-links t)))) |
613 |
(when doit |
(when doit |
614 |
(if (consp doit) |
(if (consp doit) |
615 |
(setq props (append props `(link ,(cdr doit))))) |
(setq props (append props `(link ,(cdr doit))))) |
634 |
;; Try to select the return frame. |
;; Try to select the return frame. |
635 |
;; This can crash on slow network connections, obviously when |
;; This can crash on slow network connections, obviously when |
636 |
;; we kill the help frame before the return-frame is selected. |
;; we kill the help frame before the return-frame is selected. |
637 |
;; To protect the workings, we wait for up to one second |
;; To protect the workings, we wait for up to one second |
638 |
;; and check if the return-frame *is* now selected. |
;; and check if the return-frame *is* now selected. |
639 |
;; This is marked "eperimental" since we are not sure when its OK. |
;; This is marked "eperimental" since we are not sure when its OK. |
640 |
(let ((maxtime 1.0) (time 0.) (step 0.1)) |
(let ((maxtime 1.0) (time 0.) (step 0.1)) |
641 |
(select-frame idlwave-help-return-frame) |
(select-frame idlwave-help-return-frame) |
642 |
(while (and (sit-for step) |
(while (and (sit-for step) |
643 |
(not (eq (selected-frame) |
(not (eq (selected-frame) |
644 |
idlwave-help-return-frame)) |
idlwave-help-return-frame)) |
645 |
(< (setq time (+ time step)) maxtime))))) |
(< (setq time (+ time step)) maxtime))))) |
646 |
(delete-frame idlwave-help-frame)) |
(delete-frame idlwave-help-frame)) |
653 |
(defvar default-toolbar-visible-p) |
(defvar default-toolbar-visible-p) |
654 |
|
|
655 |
(defun idlwave-help-display-help-window (&optional pos-or-func) |
(defun idlwave-help-display-help-window (&optional pos-or-func) |
656 |
"Display the help window. |
"Display the help window. |
657 |
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 |
658 |
if passed as a function. See `idlwave-help-use-dedicated-frame'." |
if passed as a function. See `idlwave-help-use-dedicated-frame'." |
659 |
(let ((cw (selected-window)) |
(let ((cw (selected-window)) |
664 |
(switch-to-buffer buf)) |
(switch-to-buffer buf)) |
665 |
;; Do it in this frame and save the window configuration |
;; Do it in this frame and save the window configuration |
666 |
(if (not (get-buffer-window buf nil)) |
(if (not (get-buffer-window buf nil)) |
667 |
(setq idlwave-help-window-configuration |
(setq idlwave-help-window-configuration |
668 |
(current-window-configuration))) |
(current-window-configuration))) |
669 |
(display-buffer buf nil (selected-frame)) |
(display-buffer buf nil (selected-frame)) |
670 |
(select-window (get-buffer-window buf))) |
(select-window (get-buffer-window buf))) |
671 |
(raise-frame) |
(raise-frame) |
672 |
(if pos-or-func |
(if pos-or-func |
673 |
(if (functionp pos-or-func) |
(if (functionp pos-or-func) |
674 |
(funcall pos-or-func) |
(funcall pos-or-func) |
675 |
(goto-char pos-or-func) |
(goto-char pos-or-func) |
676 |
(recenter 0))) |
(recenter 0))) |
692 |
(select-frame idlwave-help-return-frame))) |
(select-frame idlwave-help-return-frame))) |
693 |
|
|
694 |
(defun idlwave-online-help (link &optional name type class keyword) |
(defun idlwave-online-help (link &optional name type class keyword) |
695 |
"Display HTML or other special help on a certain topic. |
"Display HTML or other special help on a certain topic. |
696 |
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 |
697 |
the optional arguments, if any special help is defined. If LINK is |
the optional arguments, if any special help is defined. If LINK is |
698 |
`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 |
699 |
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." |
700 |
;; Lookup link |
;; Lookup link |
701 |
(if (eq link t) |
(if (eq link t) |
702 |
(let ((entry (idlwave-best-rinfo-assoc name type class |
(let ((entry (idlwave-best-rinfo-assoc name type class |
703 |
(idlwave-routines) nil t))) |
(idlwave-routines) nil t))) |
704 |
(cond |
(cond |
705 |
;; Try keyword link |
;; Try keyword link |
706 |
((and keyword |
((and keyword |
707 |
(setq link (cdr (idlwave-entry-find-keyword entry keyword))))) |
(setq link (cdr (idlwave-entry-find-keyword entry keyword))))) |
708 |
;; Default, regular entry link |
;; Default, regular entry link |
709 |
(t (setq link (idlwave-entry-has-help entry)))))) |
(t (setq link (idlwave-entry-has-help entry)))))) |
710 |
|
|
711 |
(cond |
(cond |
712 |
;; An explicit link |
;; An explicit link |
713 |
((stringp link) |
((stringp link) |
714 |
(idlwave-help-html-link link)) |
(idlwave-help-html-link link)) |
715 |
|
|
716 |
;; Any extra help |
;; Any extra help |
717 |
(idlwave-extra-help-function |
(idlwave-extra-help-function |
718 |
(idlwave-help-get-special-help name type class keyword)) |
(idlwave-help-get-special-help name type class keyword)) |
719 |
|
|
720 |
;; Nothing worked |
;; Nothing worked |
721 |
(t (idlwave-help-error name type class keyword)))) |
(t (idlwave-help-error name type class keyword)))) |
722 |
|
|
727 |
(help-pos (save-excursion |
(help-pos (save-excursion |
728 |
(set-buffer (idlwave-help-get-help-buffer)) |
(set-buffer (idlwave-help-get-help-buffer)) |
729 |
(let ((buffer-read-only nil)) |
(let ((buffer-read-only nil)) |
730 |
(funcall idlwave-extra-help-function |
(funcall idlwave-extra-help-function |
731 |
name type class keyword))))) |
name type class keyword))))) |
732 |
(if help-pos |
(if help-pos |
733 |
(idlwave-help-display-help-window help-pos) |
(idlwave-help-display-help-window help-pos) |
741 |
(browse-url-generic-program idlwave-help-browser-generic-program) |
(browse-url-generic-program idlwave-help-browser-generic-program) |
742 |
;(browse-url-generic-args idlwave-help-browser-generic-args) |
;(browse-url-generic-args idlwave-help-browser-generic-args) |
743 |
full-link) |
full-link) |
744 |
|
|
745 |
(if (and (memq system-type '(ms-dos windows-nt)) |
(if (and (memq system-type '(ms-dos windows-nt)) |
746 |
idlwave-help-use-hh) |
idlwave-help-use-hh) |
747 |
(progn |
(progn |
756 |
;; Just a regular file name (+ anchor name) |
;; Just a regular file name (+ anchor name) |
757 |
(unless (and (stringp help-loc) |
(unless (and (stringp help-loc) |
758 |
(file-directory-p help-loc)) |
(file-directory-p help-loc)) |
759 |
(error |
(error |
760 |
"Invalid help location; customize `idlwave-html-help-location'.")) |
"Invalid help location; customize `idlwave-html-help-location'.")) |
761 |
(setq full-link (concat |
(setq full-link (concat |
762 |
"file://" |
"file://" |
763 |
(expand-file-name |
(expand-file-name |
764 |
link |
link |
765 |
(expand-file-name "idl_html_help" help-loc))))) |
(expand-file-name "idl_html_help" help-loc))))) |
766 |
|
|
767 |
;; Check for a local browser |
;; Check for a local browser |
797 |
(if class-only ;Help with class? Using "Init" as source. |
(if class-only ;Help with class? Using "Init" as source. |
798 |
(setq name "Init" |
(setq name "Init" |
799 |
type 'fun)) |
type 'fun)) |
800 |
(if (not struct-tag) |
(if (not struct-tag) |
801 |
(setq file |
(setq file |
802 |
(idlwave-routine-source-file |
(idlwave-routine-source-file |
803 |
(nth 3 (idlwave-best-rinfo-assoc |
(nth 3 (idlwave-best-rinfo-assoc |
810 |
(if (or struct-tag (stringp file)) |
(if (or struct-tag (stringp file)) |
811 |
(progn |
(progn |
812 |
(setq in-buf ; structure-tag completion is always in current buffer |
(setq in-buf ; structure-tag completion is always in current buffer |
813 |
(if struct-tag |
(if struct-tag |
814 |
idlwave-current-tags-buffer |
idlwave-current-tags-buffer |
815 |
(idlwave-get-buffer-visiting file))) |
(idlwave-get-buffer-visiting file))) |
816 |
;; see if file is in a visited buffer, insert those contents |
;; see if file is in a visited buffer, insert those contents |
832 |
;; Try to find a good place to display |
;; Try to find a good place to display |
833 |
(setq def-pos |
(setq def-pos |
834 |
;; Find the class structure tag if that's what we're after |
;; Find the class structure tag if that's what we're after |
835 |
(cond |
(cond |
836 |
;; Class structure tags: find the class or named structure |
;; Class structure tags: find the class or named structure |
837 |
;; definition |
;; definition |
838 |
(class-struct-tag |
(class-struct-tag |
839 |
(save-excursion |
(save-excursion |
840 |
(setq class |
(setq class |
841 |
(if (string-match "[a-zA-Z0-9]\\(__\\)" name) |
(if (string-match "[a-zA-Z0-9]\\(__\\)" name) |
842 |
(substring name 0 (match-beginning 1)) |
(substring name 0 (match-beginning 1)) |
843 |
idlwave-current-tags-class)) |
idlwave-current-tags-class)) |
844 |
(and |
(and |
845 |
(idlwave-find-class-definition class nil real-class) |
(idlwave-find-class-definition class nil real-class) |
846 |
(idlwave-find-struct-tag keyword)))) |
(idlwave-find-struct-tag keyword)))) |
847 |
|
|
848 |
;; Generic structure tags: the structure definition |
;; Generic structure tags: the structure definition |
849 |
;; location within the file has been recorded in |
;; location within the file has been recorded in |
850 |
;; `struct-tag' |
;; `struct-tag' |
854 |
(integerp struct-tag) |
(integerp struct-tag) |
855 |
(goto-char struct-tag) |
(goto-char struct-tag) |
856 |
(idlwave-find-struct-tag keyword)))) |
(idlwave-find-struct-tag keyword)))) |
857 |
|
|
858 |
;; Just find the routine definition |
;; Just find the routine definition |
859 |
(t |
(t |
860 |
(if class-only (point-min) |
(if class-only (point-min) |
861 |
(idlwave-help-find-routine-definition name type class keyword)))) |
(idlwave-help-find-routine-definition name type class keyword)))) |
862 |
idlwave-help-def-pos def-pos) |
idlwave-help-def-pos def-pos) |
863 |
|
|
864 |
(if (and idlwave-help-source-try-header |
(if (and idlwave-help-source-try-header |
865 |
(not (or struct-tag class-struct-tag))) |
(not (or struct-tag class-struct-tag))) |
866 |
;; Check if we can find the header |
;; Check if we can find the header |
867 |
(save-excursion |
(save-excursion |
871 |
idlwave-help-in-header header-pos))) |
idlwave-help-in-header header-pos))) |
872 |
|
|
873 |
(if (or header-pos def-pos) |
(if (or header-pos def-pos) |
874 |
(progn |
(progn |
875 |
(if (boundp 'idlwave-help-min-frame-width) |
(if (boundp 'idlwave-help-min-frame-width) |
876 |
(setq idlwave-help-min-frame-width 80)) |
(setq idlwave-help-min-frame-width 80)) |
877 |
(goto-char (or header-pos def-pos))) |
(goto-char (or header-pos def-pos))) |
885 |
KEYWORD is ignored. Returns the point of match if successful, nil otherwise." |
KEYWORD is ignored. Returns the point of match if successful, nil otherwise." |
886 |
(save-excursion |
(save-excursion |
887 |
(goto-char (point-max)) |
(goto-char (point-max)) |
888 |
(if (re-search-backward |
(if (re-search-backward |
889 |
(concat "^[ \t]*" |
(concat "^[ \t]*" |
890 |
(if (eq type 'pro) "pro" |
(if (eq type 'pro) "pro" |
891 |
(if (eq type 'fun) "function" |
(if (eq type 'fun) "function" |
931 |
If there is a match, we assume it is the keyword description." |
If there is a match, we assume it is the keyword description." |
932 |
(let* ((case-fold-search t) |
(let* ((case-fold-search t) |
933 |
(rname (if (stringp class) |
(rname (if (stringp class) |
934 |
(concat |
(concat |
935 |
"\\(" |
"\\(" |
936 |
;; Traditional name or class::name |
;; Traditional name or class::name |
937 |
"\\(" |
"\\(" |
938 |
"\\(" (regexp-quote (downcase class)) "::\\)?" |
"\\(" (regexp-quote (downcase class)) "::\\)?" |
939 |
(regexp-quote (downcase name)) |
(regexp-quote (downcase name)) |
940 |
"\\>\\)" |
"\\>\\)" |
941 |
(concat |
(concat |
942 |
"\\|" |
"\\|" |
943 |
;; class__define or just class |
;; class__define or just class |
944 |
(regexp-quote (downcase class)) "\\(__define\\)?") |
(regexp-quote (downcase class)) "\\(__define\\)?") |
945 |
"\\)") |
"\\)") |
946 |
(regexp-quote (downcase name)))) |
(regexp-quote (downcase name)))) |
947 |
|
|
948 |
;; NAME tag plus the routine name. The new version is from JD. |
;; NAME tag plus the routine name. The new version is from JD. |
949 |
(name-re (concat |
(name-re (concat |
950 |
"\\(^;+\\*?[ \t]*" |
"\\(^;+\\*?[ \t]*" |
951 |
idlwave-help-doclib-name |
idlwave-help-doclib-name |
952 |
"\\([ \t]*:\\|[ \t]*$\\)[ \t]*\\(\n;+[ \t]*\\)*" |
"\\([ \t]*:\\|[ \t]*$\\)[ \t]*\\(\n;+[ \t]*\\)*" |
981 |
(regexp-quote (upcase keyword)) |
(regexp-quote (upcase keyword)) |
982 |
"\\>"))) |
"\\>"))) |
983 |
dstart dend name-pos kwds-pos kwd-pos) |
dstart dend name-pos kwds-pos kwd-pos) |
984 |
(catch 'exit |
(catch 'exit |
985 |
(save-excursion |
(save-excursion |
986 |
(goto-char (point-min)) |
(goto-char (point-min)) |
987 |
(while (and (setq dstart (re-search-forward idlwave-doclib-start nil t)) |
(while (and (setq dstart (re-search-forward idlwave-doclib-start nil t)) |
989 |
;; found a routine header |
;; found a routine header |
990 |
(goto-char dstart) |
(goto-char dstart) |
991 |
(if (setq name-pos (re-search-forward name-re dend t)) |
(if (setq name-pos (re-search-forward name-re dend t)) |
992 |
(progn |
(progn |
993 |
(if keyword |
(if keyword |
994 |
;; We do need a keyword |
;; We do need a keyword |
995 |
(progn |
(progn |
1071 |
(idlwave-help-find-first-header nil) |
(idlwave-help-find-first-header nil) |
1072 |
(setq idlwave-help-in-header nil) |
(setq idlwave-help-in-header nil) |
1073 |
(idlwave-help-toggle-header-match-and-def arg 'top))) |
(idlwave-help-toggle-header-match-and-def arg 'top))) |
1074 |
|
|
1075 |
(defun idlwave-help-toggle-header-match-and-def (arg &optional top) |
(defun idlwave-help-toggle-header-match-and-def (arg &optional top) |
1076 |
(interactive "P") |
(interactive "P") |
1077 |
(let ((args idlwave-help-args) |
(let ((args idlwave-help-args) |
1083 |
(setq pos idlwave-help-def-pos)) |
(setq pos idlwave-help-def-pos)) |
1084 |
;; Try to display header |
;; Try to display header |
1085 |
(setq pos (apply 'idlwave-help-find-in-doc-header |
(setq pos (apply 'idlwave-help-find-in-doc-header |
1086 |
(if top |
(if top |
1087 |
(list (car args) (nth 1 args) (nth 2 args) nil) |
(list (car args) (nth 1 args) (nth 2 args) nil) |
1088 |
args))) |
args))) |
1089 |
(if pos |
(if pos |
1117 |
(font-lock-fontify-buffer)) |
(font-lock-fontify-buffer)) |
1118 |
(set-syntax-table syntax-table))))) |
(set-syntax-table syntax-table))))) |
1119 |
|
|
1120 |
|
|
1121 |
(defun idlwave-help-error (name type class keyword) |
(defun idlwave-help-error (name type class keyword) |
1122 |
(error "Can't find help on %s%s %s" |
(error "Can't find help on %s%s %s" |
1123 |
(or (and (or class name) (idlwave-make-full-name class name)) |
(or (and (or class name) (idlwave-make-full-name class name)) |