FUEL: fix factor-find-usings and use it in fuel-help--word-help so that fuel can eval code with the right vocabs imported

db4
Björn Lindqvist 2014-04-14 14:49:34 +02:00 committed by John Benediktsson
parent 35fd1ad8cb
commit c0ff39d129
2 changed files with 8 additions and 4 deletions

View File

@ -679,9 +679,10 @@ source/docs/tests file. When set to false, you'll be asked only once."
(string= (match-string-no-properties 0) "<PRIVATE"))))
(defun factor-find-vocab-name ()
"name of the vocab with possible .private suffix"
"Name of the vocab with possible .private suffix"
(concat (factor-find-in) (if (factor-in-private?) ".private" "")))
(defvar-local factor-usings-function 'factor-find-usings)
(defsubst factor-usings ()
@ -694,11 +695,12 @@ source/docs/tests file. When set to false, you'll be asked only once."
(re-search-forward "\\_<PRIVATE>\\_>" nil t))))
(defun factor-find-usings (&optional no-private)
"Lists all vocabs used by the vocab."
(save-excursion
(let ((usings))
(goto-char (point-max))
(while (re-search-backward factor-using-lines-regex nil t)
(dolist (u (split-string (match-string-no-properties 1) nil t))
(dolist (u (split-string (match-string-no-properties 2) nil t))
(push u usings)))
(when (and (not no-private) (factor-file-has-private))
(goto-char (point-max))

View File

@ -129,8 +129,10 @@
(defun fuel-help--word-help (&optional see word display-only print-message)
(let ((def (or word (fuel-help--read-word see))))
(when def
(let ((cmd `(:fuel* (,def ,(if see 'fuel-word-see 'fuel-word-help))
,(factor-current-vocab) t)))
(let ((cmd `(:fuel* (,def
,(if see 'fuel-word-see 'fuel-word-help))
,(factor-current-vocab)
,(factor-usings))))
(when print-message
(message "Looking up '%s' ..." def))
(let* ((ret (fuel-eval--send/wait cmd))