FUEL: Help system now displays vocab help.

db4
Jose A. Ortega Ruiz 2009-01-04 00:01:51 +01:00
parent 1ef58cbd43
commit 992633dd32
3 changed files with 38 additions and 5 deletions

View File

@ -273,6 +273,17 @@ MEMO: fuel-article-title ( name -- title/f )
} cleave
] { } make 3array ;
: (fuel-vocab-help) ( name -- element )
\ article swap dup >vocab-link
[
[ summary [ , ] [ "No summary available" , ] if* ]
[ drop \ $nl , ]
[ vocab-help article [ content>> % ] when* ] tri
] { } make 3array ;
: fuel-vocab-help ( name -- )
(fuel-vocab-help) fuel-eval-set-result ; inline
: (fuel-index) ( seq -- seq )
[ [ >link name>> ] [ article-title ] bi 2array \ $subsection prefix ] map ;

View File

@ -111,10 +111,21 @@
(fuel-help--insert-contents label res)
(message "")))
(defun fuel-help--get-vocab (name)
(message "Retrieving vocabulary help ...")
(let* ((cmd `(:fuel* ((,name fuel-vocab-help)) "fuel" (,name)))
(ret (fuel-eval--send/wait cmd 2000))
(res (fuel-eval--retort-result ret)))
(if (not res)
(message "No help available for vocabulary %s" name)
(fuel-help--insert-contents label res)
(message ""))))
(defun fuel-help--follow-link (label link type)
(let ((fuel-help-always-ask nil))
(cond ((eq type 'word) (fuel-help--word-help nil link))
((eq type 'article) (fuel-help--get-article link label))
((eq type 'vocab) (fuel-help--get-vocab link))
(t (message (format "Links of type %s not yet implemented" type))))))
(defun fuel-help--insert-contents (def art &optional nopush)

View File

@ -102,6 +102,7 @@
($nl . fuel-markup--newline)
($notes . fuel-markup--notes)
($parsing-note . fuel-markup--parsing-note)
($predicate . fuel-markup--predicate)
($prettyprinting-note . fuel-markup--prettyprinting-note)
($quotation . fuel-markup--quotation)
($references . fuel-markup--references)
@ -199,6 +200,12 @@
(fuel-markup--link (cons '$link (cdr e)))
(fuel-markup--maybe-nl))
(defun fuel-markup--vocab-subsection (e)
(fuel-markup--insert-nl-if-nb)
(insert " - ")
(fuel-markup--vocab-link (cons '$vocab-link (cdr e)))
(fuel-markup--maybe-nl))
(defun fuel-markup--newline (e)
(fuel-markup--insert-newline)
(newline))
@ -292,8 +299,8 @@
(insert " ")))
(defun fuel-markup--vocabulary (e)
(fuel-markup--insert-heading "Vocabulary:" t)
(insert " " (cadr e))
(fuel-markup--insert-heading "Vocabulary: " t)
(fuel-markup--vocab-link (cons '$vocab-link (cdr e)))
(newline))
(defun fuel-markup--list (e)
@ -335,6 +342,13 @@
(fuel-markup--print (cdr val))
(newline)))
(defun fuel-markup--predicate (e)
(fuel-markup--values '($values ("object" object) ("?" "a boolean")))
(let ((word (make-symbol (substring (format "%s" (cadr e)) 0 -1))))
(fuel-markup--description
`($description "Tests if the object is an instance of the "
($link ,word) " class."))))
(defun fuel-markup--side-effects (e)
(fuel-markup--insert-heading "Side effects")
(insert "Modifies ")
@ -436,9 +450,6 @@
(defun fuel-markup--quotation (e)
(insert (format " %S " e)))
(defun fuel-markup--vocab-subsection (e)
(insert (format " %S " e)))
(provide 'fuel-markup)
;;; fuel-markup.el ends here