scel: initial support for SCDoc help browser

this patch introduces two new key bindings:
C-c C-y: open help browser via Help.gui
C-c h:   open help browser for a specific topic

the old help browser is still available via C-c C-h and can be used to
display pre-rendered help files.

Signed-off-by: Tim Blechmann <tim@klingt.org>
This commit is contained in:
Tim Blechmann 2011-09-30 11:45:52 +02:00
parent 7c8c5fe535
commit a20081f26a
2 changed files with 97 additions and 73 deletions

View file

@ -596,6 +596,27 @@ Either visit file internally (.sc) or start external editor (.rtf)."
(sclang-message "Help file not found") nil) (sclang-message "Help file not found") nil)
(sclang-message "No help for \"%s\"" topic) nil))) (sclang-message "No help for \"%s\"" topic) nil)))
(defun sclang-open-help-gui ()
"Open SCDoc Help Browser"
(interactive)
(sclang-eval-string (sclang-format "Help.gui"))
)
(defun sclang-find-help-in-gui (topic)
"Search for topic in SCDoc Help Browser"
(interactive
(list
(let ((topic (or (and mark-active (buffer-substring-no-properties (region-beginning) (region-end)))
(sclang-help-topic-at-point)
"Help")))
(completing-read (format "Help topic%s: " (if (sclang-get-help-file topic)
(format " (default %s)" topic) ""))
sclang-help-topic-alist nil t nil 'sclang-help-topic-history topic)))
)
(sclang-eval-string (sclang-format "HelpBrowser.openHelpFor(%o)" topic))
)
;; ===================================================================== ;; =====================================================================
;; module setup ;; module setup
;; ===================================================================== ;; =====================================================================

View file

@ -101,6 +101,7 @@
["Index Help Topics" sclang-index-help-topics] ["Index Help Topics" sclang-index-help-topics]
["Find Help ..." sclang-find-help] ["Find Help ..." sclang-find-help]
["Switch to Help Browser" sclang-goto-help-browser] ["Switch to Help Browser" sclang-goto-help-browser]
["Open Help GUI" sclang-open-help-gui]
"-" "-"
["Run Main" sclang-main-run] ["Run Main" sclang-main-run]
["Stop Main" sclang-main-stop] ["Stop Main" sclang-main-stop]
@ -134,6 +135,8 @@
;; documentation access ;; documentation access
(define-key map "\C-c\C-h" 'sclang-find-help) (define-key map "\C-c\C-h" 'sclang-find-help)
(define-key map "\C-\M-h" 'sclang-goto-help-browser) (define-key map "\C-\M-h" 'sclang-goto-help-browser)
(define-key map "\C-c\C-y" 'sclang-open-help-gui)
(define-key map "\C-ch" 'sclang-find-help-in-gui)
;; language control ;; language control
(define-key map "\C-c\C-r" 'sclang-main-run) (define-key map "\C-c\C-r" 'sclang-main-run)
(define-key map "\C-c\C-s" 'sclang-main-stop) (define-key map "\C-c\C-s" 'sclang-main-stop)