]> gitweb.factorcode.org Git - factor.git/blob - misc/fuel/fuel-markup.el
FUEL: fix markup of stack effects of quotations nested in stack effects
[factor.git] / misc / fuel / fuel-markup.el
1 ;;; fuel-markup.el -- printing factor help markup
2
3 ;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
4 ;; See http://factorcode.org/license.txt for BSD license.
5
6 ;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
7 ;; Keywords: languages, fuel, factor
8 ;; Start date: Thu Jan 01, 2009 21:43
9
10 ;;; Comentary:
11
12 ;; Utilities for printing Factor's help markup.
13
14 ;;; Code:
15
16 (require 'fuel-eval)
17 (require 'fuel-base)
18 (require 'fuel-table)
19
20 (require 'button)
21
22 \f
23 ;;; Customization:
24
25 (defface fuel-font-lock-markup-title '((t (:inherit bold)))
26   "article titles in help buffers"
27   :group 'fuel-help
28   :group 'fuel-faces
29   :group 'faces)
30
31 (defface fuel-font-lock-markup-heading '((t (:inherit bold)))
32   "headlines in help buffers"
33   :group 'fuel-help
34   :group 'fuel-faces
35   :group 'faces)
36
37 (defface fuel-font-lock-markup-link '((t (:inherit link)))
38   "links to topics in help buffers"
39   :group 'fuel-help
40   :group 'fuel-faces
41   :group 'faces)
42
43 (defface fuel-font-lock-markup-emphasis '((t (:inherit italic)))
44   "emphasized words in help buffers"
45   :group 'fuel-help
46   :group 'fuel-faces
47   :group 'faces)
48
49 (defface fuel-font-lock-markup-strong '((t (:inherit link)))
50   "bold words in help buffers"
51   :group 'fuel-help
52   :group 'fuel-faces
53   :group 'faces)
54
55 \f
56 ;;; Links:
57
58 (defvar-local fuel-markup--follow-link-function 'fuel-markup--echo-link)
59
60 (define-button-type 'fuel-markup--button
61   'action 'fuel-markup--follow-link
62   'face 'fuel-font-lock-markup-link
63   'follow-link t)
64
65 (defun fuel-markup--follow-link (button)
66   (when fuel-markup--follow-link-function
67     (funcall fuel-markup--follow-link-function
68              (button-get button 'markup-link)
69              (button-get button 'markup-label)
70              (button-get button 'markup-link-type))))
71
72 (defun fuel-markup--echo-link (link label type)
73   (message "Link %s pointing to %s named %s" label type link))
74
75 (defun fuel-markup--insert-button (label link type)
76   (let ((label (format "%s" label))
77         (link (if (listp link) link (format "%s" link))))
78     (insert-text-button label
79                         :type 'fuel-markup--button
80                         'markup-link link
81                         'markup-label label
82                         'markup-link-type type
83                         'help-echo (format "%s (%s)" label type))))
84
85 (defun fuel-markup--article-title (name)
86   (let ((name (if (listp name) (cons :seq name) name)))
87     (fuel-eval--retort-result
88      (fuel-eval--send/wait `(:fuel* ((,name fuel-get-article-title)) "fuel")))))
89
90 (defun fuel-markup--link-at-point ()
91   (let ((button (condition-case nil (forward-button 0) (error nil))))
92     (when button
93       (list (button-get button 'markup-link)
94             (button-get button 'markup-label)
95             (button-get button 'markup-link-type)))))
96
97 \f
98 ;;; Markup printers:
99
100 (defconst fuel-markup--printers
101   '(($all-tags . fuel-markup--all-tags)
102     ($all-authors . fuel-markup--all-authors)
103     ($author . fuel-markup--author)
104     ($authors . fuel-markup--authors)
105     ($class-description . fuel-markup--class-description)
106     ($code . fuel-markup--code)
107     ($command . fuel-markup--command)
108     ($command-map . fuel-markup--null)
109     ($contract . fuel-markup--contract)
110     ($curious . fuel-markup--curious)
111     ($definition . fuel-markup--definition)
112     ($describe-vocab . fuel-markup--describe-vocab)
113     ($description . fuel-markup--description)
114     ($doc-path . fuel-markup--doc-path)
115     ($emphasis . fuel-markup--emphasis)
116     ($error-description . fuel-markup--error-description)
117     ($errors . fuel-markup--errors)
118     ($example . fuel-markup--example)
119     ($examples . fuel-markup--examples)
120     ($heading . fuel-markup--heading)
121     ($index . fuel-markup--index)
122     ($instance . fuel-markup--instance)
123     ($io-error . fuel-markup--io-error)
124     ($link . fuel-markup--link)
125     ($links . fuel-markup--links)
126     ($list . fuel-markup--list)
127     ($low-level-note . fuel-markup--low-level-note)
128     ($markup-example . fuel-markup--markup-example)
129     ($maybe . fuel-markup--maybe)
130     ($methods . fuel-markup--methods)
131     ($nl . fuel-markup--newline)
132     ($notes . fuel-markup--notes)
133     ($operation . fuel-markup--link)
134     ($or . fuel-markup--or)
135     ($parsing-note . fuel-markup--parsing-note)
136     ($predicate . fuel-markup--predicate)
137     ($prettyprinting-note . fuel-markup--prettyprinting-note)
138     ($quotation . fuel-markup--quotation)
139     ($references . fuel-markup--references)
140     ($related . fuel-markup--related)
141     ($see . fuel-markup--see)
142     ($see-also . fuel-markup--see-also)
143     ($shuffle . fuel-markup--shuffle)
144     ($side-effects . fuel-markup--side-effects)
145     ($slot . fuel-markup--snippet)
146     ($snippet . fuel-markup--snippet)
147     ($strong . fuel-markup--strong)
148     ($subheading . fuel-markup--subheading)
149     ($subsection . fuel-markup--subsection)
150     ($subsections . fuel-markup--subsections)
151     ($synopsis . fuel-markup--synopsis)
152     ($syntax . fuel-markup--syntax)
153     ($table . fuel-markup--table)
154     ($tag . fuel-markup--tag)
155     ($tags . fuel-markup--tags)
156     ($unchecked-example . fuel-markup--example)
157     ($value . fuel-markup--value)
158     ($values . fuel-markup--values)
159     ($values-x/y . fuel-markup--values-x/y)
160     ($var-description . fuel-markup--var-description)
161     ($vocab-link . fuel-markup--vocab-link)
162     ($vocab-links . fuel-markup--vocab-links)
163     ($vocab-subsection . fuel-markup--vocab-subsection)
164     ($vocabulary . fuel-markup--vocabulary)
165     ($warning . fuel-markup--warning)
166     (article . fuel-markup--article)
167     (describe-words . fuel-markup--describe-words)
168     (vocab-list . fuel-markup--vocab-list)))
169
170 (defvar-local fuel-markup--maybe-nl nil)
171
172 (defun fuel-markup--print (e)
173   (cond ((null e) (insert "f"))
174         ((stringp e) (fuel-markup--insert-string e))
175         ((and (listp e) (symbolp (car e))
176               (assoc (car e) fuel-markup--printers))
177          (funcall (cdr (assoc (car e) fuel-markup--printers)) e))
178         ((and (symbolp e)
179               (assoc e fuel-markup--printers))
180          (funcall (cdr (assoc e fuel-markup--printers)) e))
181         ((listp e) (mapc 'fuel-markup--print e))
182         ((symbolp e) (fuel-markup--print (list '$link e)))
183         (t (insert (format "\n%S\n" e)))))
184
185 (defun fuel-markup--print-str (e)
186   (with-temp-buffer
187     (fuel-markup--print e)
188     (buffer-string)))
189
190 (defun fuel-markup--maybe-nl ()
191   (setq fuel-markup--maybe-nl (point)))
192
193 (defun fuel-markup--insert-newline (&optional justification nosqueeze)
194   (fill-region (save-excursion (beginning-of-line) (point))
195                (point)
196                (or justification 'left)
197                nosqueeze)
198   (newline))
199
200 (defsubst fuel-markup--insert-nl-if-nb (&optional no-fill)
201   (unless (eq (save-excursion (beginning-of-line) (point)) (point))
202     (if no-fill (newline) (fuel-markup--insert-newline))))
203
204 (defsubst fuel-markup--put-face (txt face)
205   (put-text-property 0 (length txt) 'font-lock-face face txt)
206   txt)
207
208 (defun fuel-markup--insert-heading (txt &optional no-nl)
209   (fuel-markup--insert-nl-if-nb)
210   (delete-blank-lines)
211   (unless (bobp) (newline))
212   (fuel-markup--put-face txt 'fuel-font-lock-markup-heading)
213   (fuel-markup--insert-string txt)
214   (unless no-nl (newline)))
215
216 (defun fuel-markup--insert-string (str)
217   (when fuel-markup--maybe-nl
218     (newline 2)
219     (setq fuel-markup--maybe-nl nil))
220   (insert str))
221
222 (defun fuel-markup--article (e)
223   (setq fuel-markup--maybe-nl nil)
224   (insert (fuel-markup--put-face (cadr e) 'fuel-font-lock-markup-title))
225   (newline 2)
226   (fuel-markup--print (car (cddr e))))
227
228 (defun fuel-markup--heading (e)
229   (fuel-markup--insert-heading (cadr e)))
230
231 (defun fuel-markup--subheading (e)
232   (fuel-markup--insert-heading (cadr e)))
233
234 (defun fuel-markup--subsection (e)
235   (fuel-markup--insert-nl-if-nb)
236   (insert "  - ")
237   (fuel-markup--link (cons '$link (cdr e)))
238   (fuel-markup--maybe-nl))
239
240 (defun fuel-markup--subsections (e)
241   (dolist (link (cdr e))
242     (fuel-markup--insert-nl-if-nb)
243     (insert "  - ")
244     (fuel-markup--link (list '$link link))
245     (fuel-markup--maybe-nl)))
246
247 (defun fuel-markup--vocab-subsection (e)
248   (fuel-markup--insert-nl-if-nb)
249   (insert "  - ")
250   (fuel-markup--vocab-link (cons '$vocab-link (cdr e)))
251   (fuel-markup--maybe-nl))
252
253 (defun fuel-markup--newline (e)
254   (fuel-markup--insert-newline)
255   (newline))
256
257 (defun fuel-markup--doc-path (e)
258   (fuel-markup--insert-heading "Related topics")
259   (insert "  ")
260   (dolist (art (cdr e))
261     (fuel-markup--insert-button (car art) (cadr art) 'article)
262     (insert ", "))
263   (delete-char -2)
264   (fuel-markup--insert-newline 'left))
265
266 (defun fuel-markup--emphasis (e)
267   (when (stringp (cadr e))
268     (fuel-markup--put-face (cadr e) 'fuel-font-lock-markup-emphasis)
269     (insert (cadr e))))
270
271 (defun fuel-markup--strong (e)
272   (when (stringp (cadr e))
273     (fuel-markup--put-face (cadr e) 'fuel-font-lock-markup-strong)
274     (insert (cadr e))))
275
276 (defun fuel-markup--snippet (e)
277   (insert (mapconcat #'(lambda (s)
278                         (if (stringp s)
279                             (factor-font-lock-string s)
280                           (fuel-markup--print-str s)))
281                      (cdr e)
282                      " ")))
283
284 (defun fuel-markup--code (e)
285   (fuel-markup--insert-nl-if-nb)
286   (newline)
287   (dolist (snip (cdr e))
288     (if (stringp snip)
289         (insert (factor-font-lock-string snip))
290       (fuel-markup--print snip))
291     (newline))
292   (newline))
293
294 (defun fuel-markup--command (e)
295   (fuel-markup--snippet (list '$snippet (nth 3 e))))
296
297 (defun fuel-markup--syntax (e)
298   (fuel-markup--insert-heading "Syntax")
299   (fuel-markup--print (cons '$code (cdr e)))
300   (newline))
301
302 (defun fuel-markup--example (e)
303   (fuel-markup--insert-newline)
304   (dolist (s (cdr e))
305     (fuel-markup--snippet (list '$snippet s))
306     (newline))
307   (newline))
308
309 (defun fuel-markup--markup-example (e)
310   (fuel-markup--insert-newline)
311   (fuel-markup--snippet (cons '$snippet (cdr e))))
312
313 (defun fuel-markup--link (e)
314   (let* ((link (or (nth 1 e) 'f))
315          (type (or (nth 3 e) (if (symbolp link) 'word 'article)))
316          (label (or (nth 2 e)
317                     (and (eq type 'article)
318                          (fuel-markup--article-title link))
319                     link)))
320     (fuel-markup--insert-button label link type)))
321
322 (defun fuel-markup--links (e)
323   (dolist (link (cdr e))
324     (fuel-markup--link (list '$link link))
325     (insert ", "))
326   (delete-char -2))
327
328 (defun fuel-markup--index-quotation (q)
329   (cond ((null q) nil)
330         ((listp q) (vconcat (mapcar 'fuel-markup--index-quotation q)))
331         (t q)))
332
333 (defun fuel-markup--index (e)
334   (let* ((q (fuel-markup--index-quotation (cadr e)))
335          (cmd `(:fuel* ((,q fuel-index)) "fuel"
336                        ("builtins" "help" "help.topics" "classes"
337                         "classes.builtin" "classes.tuple"
338                         "classes.singleton" "classes.union"
339                         "classes.intersection" "classes.predicate")))
340          (subs (fuel-eval--retort-result (fuel-eval--send/wait cmd 200))))
341     (when subs
342       (let ((start (point))
343             (sort-fold-case nil))
344         (fuel-markup--print subs)
345         (sort-lines nil start (point))))))
346
347 (defun fuel-markup--vocab-link (e)
348   (fuel-markup--insert-button (cadr e) (or (car (cddr e)) (cadr e)) 'vocab))
349
350 (defun fuel-markup--vocab-links (e)
351   (dolist (link (cdr e))
352     (insert " ")
353     (fuel-markup--vocab-link (list '$vocab-link link))
354     (insert " ")))
355
356 (defun fuel-markup--vocab-list (e)
357   (let ((rows (mapcar #'(lambda (elem)
358                          (list (list '$vocab-link (car elem))
359                                (cadr elem)))
360                       (cdr e))))
361     (fuel-markup--table (cons '$table rows))))
362
363 (defun fuel-markup--describe-vocab (e)
364   (fuel-markup--insert-nl-if-nb)
365   (let* ((cmd `(:fuel* ((,(cadr e) fuel-vocab-help)) "fuel" t))
366          (res (fuel-eval--retort-result (fuel-eval--send/wait cmd))))
367     (when res (fuel-markup--print res))))
368
369 (defun fuel-markup--vocabulary (e)
370   (fuel-markup--insert-heading "Vocabulary: " t)
371   (fuel-markup--vocab-link (cons '$vocab-link (cdr e)))
372   (newline))
373
374 (defun fuel-markup--parse-classes ()
375   (let ((elems))
376     (while (looking-at ".+ classes$")
377       (let ((heading `($heading ,(match-string-no-properties 0)))
378             (rows))
379         (forward-line)
380         (when (looking-at "Class *.+$")
381           (push (split-string (match-string-no-properties 0) nil t) rows)
382           (forward-line))
383         (while (not (looking-at "$"))
384           (let* ((objs (split-string (thing-at-point 'line) nil t))
385                  (class (list '$link (car objs) (car objs) 'word))
386                  (super (and (cadr objs)
387                              (list (list '$link (cadr objs) (cadr objs) 'word))))
388                  (slots (when (cddr objs)
389                           (list (mapcar #'(lambda (s) (list s " ")) (cddr objs))))))
390             (push `(,class ,@super ,@slots) rows))
391           (forward-line))
392         (push `(,heading ($table ,@(reverse rows))) elems))
393       (forward-line))
394     (reverse elems)))
395
396 (defun fuel-markup--parse-words ()
397   (let ((elems))
398     (while (looking-at ".+ words\\|Primitives$")
399       (let ((heading `($heading ,(match-string-no-properties 0)))
400             (rows))
401         (forward-line)
402         (when (looking-at "Word *\\(Stack effect\\|Syntax\\)$")
403           (push (list "Word" (match-string-no-properties 1)) rows)
404           (forward-line))
405         (while (looking-at " ?\\(.+?\\)\\( +\\(.+\\)\\)?$")
406           (let ((word `($link ,(match-string-no-properties 1)
407                               ,(match-string-no-properties 1)
408                               word))
409                 (se (and (match-string-no-properties 3)
410                          `(($snippet ,(match-string-no-properties 3))))))
411             (push `(,word ,@se) rows))
412           (forward-line))
413         (push `(,heading ($table ,@(reverse rows))) elems))
414       (forward-line))
415     (reverse elems)))
416
417 (defun fuel-markup--parse-words-desc (desc)
418   (with-temp-buffer
419     (insert desc)
420     (goto-char (point-min))
421     (when (re-search-forward "^Words$" nil t)
422       (forward-line 2)
423       (let ((elems '(($heading "Words"))))
424         (push (fuel-markup--parse-classes) elems)
425         (push (fuel-markup--parse-words) elems)
426         (reverse (remove nil elems))))))
427
428 (defun fuel-markup--describe-words (e)
429   (when (cadr e)
430     (fuel-markup--print (fuel-markup--parse-words-desc (cadr e)))))
431
432 (defun fuel-markup--tag (e)
433   (fuel-markup--link (list '$link (cadr e) (cadr e) 'tag)))
434
435 (defun fuel-markup--tags (e)
436   (when (cdr e)
437     (fuel-markup--insert-heading "Tags: " t)
438     (dolist (tag (cdr e))
439       (fuel-markup--tag (list '$tag tag))
440       (insert ", "))
441     (delete-char -2)
442     (fuel-markup--insert-newline)))
443
444 (defun fuel-markup--all-tags (e)
445   (let* ((cmd `(:fuel* (all-tags :get) "fuel" t))
446          (tags (fuel-eval--retort-result (fuel-eval--send/wait cmd))))
447     (fuel-markup--list
448      (cons '$list (mapcar (lambda (tag) (list '$link tag tag 'tag)) tags)))))
449
450 (defun fuel-markup--author (e)
451   (fuel-markup--link (list '$link (cadr e) (cadr e) 'author)))
452
453 (defun fuel-markup--authors (e)
454   (when (cdr e)
455     (fuel-markup--insert-heading "Authors: " t)
456     (dolist (a (cdr e))
457       (fuel-markup--author (list '$author a))
458       (insert ", "))
459     (delete-char -2)
460     (fuel-markup--insert-newline)))
461
462 (defun fuel-markup--all-authors (e)
463   (let* ((cmd `(:fuel* (all-authors :get) "fuel" t))
464          (authors (fuel-eval--retort-result (fuel-eval--send/wait cmd))))
465     (fuel-markup--list
466      (cons '$list (mapcar (lambda (a) (list '$link a a 'author)) authors)))))
467
468 (defun fuel-markup--list (e)
469   (fuel-markup--insert-nl-if-nb)
470   (dolist (elt (cdr e))
471     (insert " - ")
472     (fuel-markup--print elt)
473     (fuel-markup--insert-newline)))
474
475 (defun fuel-markup--table (e)
476   (fuel-markup--insert-newline)
477   (delete-blank-lines)
478   (newline)
479   (fuel-table--insert
480    (mapcar #'(lambda (row) (mapcar 'fuel-markup--print-str row)) (cdr e)))
481   (newline))
482
483 (defun fuel-markup--instance (e)
484   (insert " an instance of ")
485   (fuel-markup--print (cadr e)))
486
487 (defun fuel-markup--maybe (e)
488   (fuel-markup--instance (cons '$instance (cdr e)))
489   (insert " or f "))
490
491 (defun fuel-markup--or (e)
492   (let ((fst (car (cdr e)))
493         (mid (butlast (cddr e)))
494         (lst (car (last (cdr e)))))
495     (insert (format "%s" fst))
496     (dolist (m mid) (insert (format ", %s" m)))
497     (insert (format " or %s" lst))))
498
499 (defun fuel-markup--values (e)
500   (fuel-markup--insert-heading "Inputs and outputs")
501   (dolist (val (cdr e))
502     (insert " " (car val) " - ")
503     (fuel-markup--print (cdr val))
504     (newline)))
505
506 (defun fuel-markup--predicate (e)
507   (fuel-markup--values '($values ("object" object) ("?" "a boolean")))
508   (let ((word (make-symbol (substring (format "%s" (cadr e)) 0 -1))))
509   (fuel-markup--description
510    `($description "Tests if the object is an instance of the "
511                   ($link ,word) " class."))))
512
513 (defun fuel-markup--side-effects (e)
514   (fuel-markup--insert-heading "Side effects")
515   (insert "Modifies ")
516   (fuel-markup--print (cdr e))
517   (fuel-markup--insert-newline))
518
519 (defun fuel-markup--definition (e)
520   (fuel-markup--insert-heading "Definition")
521   (fuel-markup--code (cons '$code (cdr e))))
522
523 (defun fuel-markup--methods (e)
524   (fuel-markup--insert-heading "Methods")
525   (fuel-markup--code (cons '$code (cdr e))))
526
527 (defun fuel-markup--value (e)
528   (fuel-markup--insert-heading "Variable value")
529   (insert "Current value in global namespace: ")
530   (fuel-markup--snippet (cons '$snippet (cdr e)))
531   (newline))
532
533 (defun fuel-markup--values-x/y (e)
534   (fuel-markup--values '($values ("x" "number") ("y" "number"))))
535
536 (defun fuel-markup--curious (e)
537   (fuel-markup--insert-heading "For the curious...")
538   (fuel-markup--print (cdr e)))
539
540 (defun fuel-markup--references (e)
541   (fuel-markup--insert-heading "References")
542   (dolist (ref (cdr e))
543     (if (listp ref)
544         (fuel-markup--print ref)
545       (fuel-markup--subsection (list '$subsection ref)))))
546
547 (defun fuel-markup--see-also (e)
548   (fuel-markup--insert-heading "See also")
549   (fuel-markup--links (cons '$links (cdr e))))
550
551 (defun fuel-markup--related (e)
552   (fuel-markup--insert-heading "See also")
553   (fuel-markup--links (cons '$links (cadr e))))
554
555 (defun fuel-markup--shuffle (e)
556   (insert "\nShuffle word. Re-arranges the stack "
557           "according to the stack effect pattern.")
558   (fuel-markup--insert-newline))
559
560 (defun fuel-markup--low-level-note (e)
561   (fuel-markup--print '($notes "Calling this word directly is not necessary "
562                                "in most cases. "
563                                "Higher-level words call it automatically.")))
564
565 (defun fuel-markup--parsing-note (e)
566   (fuel-markup--insert-nl-if-nb)
567   (insert "This word should only be called from parsing words.")
568   (fuel-markup--insert-newline))
569
570 (defun fuel-markup--io-error (e)
571   (fuel-markup--errors '($errors "Throws an error if the I/O operation fails.")))
572
573 (defun fuel-markup--prettyprinting-note (e)
574   (fuel-markup--print '($notes ("This word should only be called within the "
575                                 ($link with-pprint) " combinator."))))
576
577 (defun fuel-markup--elem-with-heading (elem heading)
578   (fuel-markup--insert-heading heading)
579   (fuel-markup--print (cdr elem))
580   (fuel-markup--insert-newline))
581
582 (defun fuel-markup--stack-effect (e)
583   (let* ((in (mapconcat 'identity (nth 1 e) " "))
584          (out (mapconcat 'identity (nth 2 e) " "))
585          (str (format "( %s -- %s )" in out)))
586     (fuel-markup--snippet (list '$snippet str))))
587
588 (defun fuel-markup--quotation (e)
589   (insert "a ")
590   (fuel-markup--link (list '$link 'quotation 'quotation 'word))
591   (insert " with stack effect ")
592   (fuel-markup--stack-effect (nth 1 e)))
593
594 (defun fuel-markup--warning (e)
595   (fuel-markup--elem-with-heading e "Warning"))
596
597 (defun fuel-markup--description (e)
598   (fuel-markup--elem-with-heading e "Word description"))
599
600 (defun fuel-markup--class-description (e)
601   (fuel-markup--elem-with-heading e "Class description"))
602
603 (defun fuel-markup--error-description (e)
604   (fuel-markup--elem-with-heading e "Error description"))
605
606 (defun fuel-markup--var-description (e)
607   (fuel-markup--elem-with-heading e "Variable description"))
608
609 (defun fuel-markup--contract (e)
610   (fuel-markup--elem-with-heading e "Generic word contract"))
611
612 (defun fuel-markup--errors (e)
613   (fuel-markup--elem-with-heading e "Errors"))
614
615 (defun fuel-markup--examples (e)
616   (fuel-markup--elem-with-heading e "Examples"))
617
618 (defun fuel-markup--notes (e)
619   (fuel-markup--elem-with-heading e "Notes"))
620
621 (defun fuel-markup--word-info (e s)
622   (let* ((word (nth 1 e))
623          (cmd (and word `(:fuel* ((:quote ,(format "%s" word)) ,s) "fuel")))
624          (ret (and cmd (fuel-eval--send/wait cmd)))
625          (res (and (not (fuel-eval--retort-error ret))
626                    (fuel-eval--retort-output ret))))
627     (if res
628         (fuel-markup--code (list '$code res))
629       (fuel-markup--snippet (list '$snippet " " word)))))
630
631 (defun fuel-markup--see (e)
632   (fuel-markup--word-info e 'see))
633
634 (defun fuel-markup--synopsis (e)
635   (fuel-markup--word-info e 'synopsis))
636
637 (defun fuel-markup--null (e))
638
639 \f
640 (provide 'fuel-markup)
641
642 ;;; fuel-markup.el ends here