Merge branch 'emacs' of http://git.hacks-galore.org/jao/factor
commit
b9de229b23
|
@ -99,6 +99,8 @@ PRIVATE>
|
|||
|
||||
: fuel-vocab-help ( name -- ) (fuel-vocab-help) fuel-eval-set-result ;
|
||||
|
||||
: fuel-word-synopsis ( word usings -- ) (fuel-word-synopsis) fuel-eval-set-result ;
|
||||
|
||||
: fuel-vocab-summary ( name -- )
|
||||
(fuel-vocab-summary) fuel-eval-set-result ;
|
||||
|
||||
|
|
|
@ -90,6 +90,12 @@ PRIVATE>
|
|||
: (fuel-word-help) ( name -- elem )
|
||||
fuel-find-word [ [ auto-use? on (fuel-word-element) ] with-scope ] [ f ] if* ;
|
||||
|
||||
: (fuel-word-synopsis) ( word usings -- str/f )
|
||||
[
|
||||
[ vocab ] filter interactive-vocabs get append interactive-vocabs set
|
||||
fuel-find-word [ synopsis ] when*
|
||||
] with-scope ;
|
||||
|
||||
: (fuel-word-see) ( word -- elem )
|
||||
[ name>> \ article swap ]
|
||||
[ [ see ] with-string-writer \ $code swap 2array ] bi 3array ; inline
|
||||
|
|
|
@ -111,6 +111,7 @@ beast.
|
|||
| C-cC-ev | edit vocabulary (fuel-edit-vocabulary) |
|
||||
| C-cC-ew | edit word (fuel-edit-word-at-point) |
|
||||
| C-cC-ed | edit word's doc (C-u M-x fuel-edit-word-doc-at-point) |
|
||||
| C-cC-el | load vocabs in USING: form |
|
||||
|-----------------+------------------------------------------------------------|
|
||||
| C-cC-er | eval region |
|
||||
| C-M-r, C-cC-ee | eval region, extending it to definition boundaries |
|
||||
|
|
|
@ -32,6 +32,22 @@
|
|||
:type 'boolean)
|
||||
|
||||
|
||||
(defcustom fuel-autodoc-eval-using-form-p nil
|
||||
"When enabled, automatically load vocabularies in USING: form
|
||||
to display autodoc messages.
|
||||
|
||||
In order to show autodoc messages for words in a Factor buffer,
|
||||
the used vocabularies must be loaded in the Factor image. Setting
|
||||
this variable to `t' will do that automatically for you,
|
||||
asynchronously. That means that you'll be able to move around
|
||||
while the vocabs are being loaded, but no other FUEL
|
||||
functionality will be available until loading finishes (and it
|
||||
may take a while). Thus, this functionality is disabled by
|
||||
default. You can force loading the vocabs in a Factor buffer
|
||||
USING: form with \\[fuel-load-usings]."
|
||||
:group 'fuel-autodoc
|
||||
:type 'boolean)
|
||||
|
||||
|
||||
;;; Eldoc function:
|
||||
|
||||
|
@ -41,9 +57,10 @@
|
|||
(let ((word (or word (fuel-syntax-symbol-at-point)))
|
||||
(fuel-log--inhibit-p t))
|
||||
(when word
|
||||
(let* ((cmd (if (fuel-syntax--in-using)
|
||||
(let* ((usings (if fuel-autodoc-eval-using-form-p :usings t))
|
||||
(cmd (if (fuel-syntax--in-using)
|
||||
`(:fuel* (,word fuel-vocab-summary) :in t)
|
||||
`(:fuel* (((:quote ,word) synopsis :get)) :in)))
|
||||
`(:fuel* ((,word :usings fuel-word-synopsis)) t ,usings)))
|
||||
(ret (fuel-eval--send/wait cmd fuel-autodoc--timeout))
|
||||
(res (fuel-eval--retort-result ret)))
|
||||
(when (and ret (not (fuel-eval--retort-error ret)) (stringp res))
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
(t (error "Invalid 'in' (%s)" in))))
|
||||
|
||||
(defsubst factor--fuel-usings (usings)
|
||||
(cond ((null usings) :usings)
|
||||
(cond ((or (null usings) (eq usings :usings)) :usings)
|
||||
((eq usings t) nil)
|
||||
((listp usings) `(:array ,@usings))
|
||||
(t (error "Invalid 'usings' (%s)" usings))))
|
||||
|
|
|
@ -132,6 +132,18 @@ With prefix argument, ask for the file name."
|
|||
(let ((file (car (fuel-mode--read-file arg))))
|
||||
(when file (fuel-debug--uses-for-file file))))
|
||||
|
||||
(defun fuel-load-usings ()
|
||||
"Loads all vocabularies in the current buffer's USING: from.
|
||||
Useful to activate autodoc help messages in a vocabulary not yet
|
||||
loaded. See documentation for `fuel-autodoc-eval-using-form-p'
|
||||
for details."
|
||||
(interactive)
|
||||
(message "Loading all vocabularies in USING: form ...")
|
||||
(let ((err (fuel-eval--retort-error
|
||||
(fuel-eval--send/wait '(:fuel* (t) t :usings) 120000))))
|
||||
(message (if err "Warning: some vocabularies failed to load"
|
||||
"All vocabularies loaded"))))
|
||||
|
||||
|
||||
;;; Minor mode definition:
|
||||
|
||||
|
@ -191,7 +203,8 @@ interacting with a factor listener is at your disposal.
|
|||
|
||||
(fuel-mode--key ?e ?d 'fuel-edit-word-doc-at-point)
|
||||
(fuel-mode--key ?e ?e 'fuel-eval-extended-region)
|
||||
(fuel-mode--key ?e ?l 'fuel-run-file)
|
||||
(fuel-mode--key ?e ?k 'fuel-run-file)
|
||||
(fuel-mode--key ?e ?l 'fuel-load-usings)
|
||||
(fuel-mode--key ?e ?r 'fuel-eval-region)
|
||||
(fuel-mode--key ?e ?u 'fuel-update-usings)
|
||||
(fuel-mode--key ?e ?v 'fuel-edit-vocabulary)
|
||||
|
|
Loading…
Reference in New Issue