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