scel: improvements to the scdoc integration

Signed-off-by: Tim Blechmann <tim@klingt.org>
This commit is contained in:
Tim Blechmann 2011-10-01 13:16:04 +02:00
parent a20081f26a
commit fef0729223
2 changed files with 45 additions and 12 deletions

View file

@ -603,28 +603,49 @@ Either visit file internally (.sc) or start external editor (.rtf)."
(sclang-eval-string (sclang-format "Help.gui")) (sclang-eval-string (sclang-format "Help.gui"))
) )
(defvar sclang-scdoc-topics (make-hash-table :size 16385)
"List of all scdoc topics.")
(sclang-set-command-handler
'helpSymbols
(lambda (list-of-symbols)
(mapcar (lambda (arg)
(puthash arg nil sclang-scdoc-topics))
list-of-symbols)
))
(defun sclang-find-help-in-gui (topic) (defun sclang-find-help-in-gui (topic)
"Search for topic in SCDoc Help Browser" "Search for topic in SCDoc Help Browser"
(interactive (interactive
(list (list
(let ((topic (or (and mark-active (buffer-substring-no-properties (region-beginning) (region-end))) (let ((topic (sclang-symbol-at-point)))
(sclang-help-topic-at-point) (completing-read (format "Help topic%s: " (if topic
"Help"))) (format " (default %s)" topic)
(completing-read (format "Help topic%s: " (if (sclang-get-help-file topic) ""))
(format " (default %s)" topic) "")) sclang-scdoc-topics nil nil nil 'sclang-help-topic-history topic)))
sclang-help-topic-alist nil t nil 'sclang-help-topic-history topic)))
) )
(if topic
(sclang-eval-string (sclang-format "HelpBrowser.openHelpFor(%o)" topic)) (sclang-eval-string (sclang-format "HelpBrowser.openHelpFor(%o)" topic))
(sclang-eval-string (sclang-format "Help.gui"))
) )
)
;; ===================================================================== ;; =====================================================================
;; module setup ;; module setup
;; ===================================================================== ;; =====================================================================
(add-hook 'sclang-library-startup-hook (lambda () (add-hook 'sclang-library-startup-hook
(lambda ()
(sclang-perform-command 'helpSymbols)
(condition-case nil (condition-case nil
(sclang-index-help-topics) (sclang-index-help-topics)
(error nil)))) (error nil))))
(add-hook 'sclang-library-shutdown-hook
(lambda ()
(clrhash sclang-scdoc-topics)))
(add-to-list 'auto-mode-alist '("\\.rtf$" . sclang-help-mode)) (add-to-list 'auto-mode-alist '("\\.rtf$" . sclang-help-mode))
;; ========= ADDITION for HTML help files?? ============ ;; ========= ADDITION for HTML help files?? ============
;; (add-to-list 'auto-mode-alist '("\\.html$" . sclang-help-mode)) ;; (add-to-list 'auto-mode-alist '("\\.html$" . sclang-help-mode))

View file

@ -197,6 +197,18 @@ EmacsInterface {
// devpath.postln; // devpath.postln;
Document.open( devpath ).front; Document.open( devpath ).front;
name -> devpath name -> devpath
})
.put( \helpSymbols, {
var result = IdentitySet.newFrom(SCDoc.docMap.keys);
Class.allClasses.do { | class |
if (class.isMetaClass.not) {
result.add(class.name.asString);
};
class.methods.do { | method |
result.add(method.name.asString);
};
};
result.asArray
}); });
} }
} }