FUEL: fix factor-find-usings and use it in fuel-help--word-help so that fuel can eval code with the right vocabs imported
parent
35fd1ad8cb
commit
c0ff39d129
|
@ -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"))))
|
(string= (match-string-no-properties 0) "<PRIVATE"))))
|
||||||
|
|
||||||
(defun factor-find-vocab-name ()
|
(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" "")))
|
(concat (factor-find-in) (if (factor-in-private?) ".private" "")))
|
||||||
|
|
||||||
|
|
||||||
(defvar-local factor-usings-function 'factor-find-usings)
|
(defvar-local factor-usings-function 'factor-find-usings)
|
||||||
|
|
||||||
(defsubst factor-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))))
|
(re-search-forward "\\_<PRIVATE>\\_>" nil t))))
|
||||||
|
|
||||||
(defun factor-find-usings (&optional no-private)
|
(defun factor-find-usings (&optional no-private)
|
||||||
|
"Lists all vocabs used by the vocab."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((usings))
|
(let ((usings))
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(while (re-search-backward factor-using-lines-regex nil t)
|
(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)))
|
(push u usings)))
|
||||||
(when (and (not no-private) (factor-file-has-private))
|
(when (and (not no-private) (factor-file-has-private))
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
|
|
|
@ -129,8 +129,10 @@
|
||||||
(defun fuel-help--word-help (&optional see word display-only print-message)
|
(defun fuel-help--word-help (&optional see word display-only print-message)
|
||||||
(let ((def (or word (fuel-help--read-word see))))
|
(let ((def (or word (fuel-help--read-word see))))
|
||||||
(when def
|
(when def
|
||||||
(let ((cmd `(:fuel* (,def ,(if see 'fuel-word-see 'fuel-word-help))
|
(let ((cmd `(:fuel* (,def
|
||||||
,(factor-current-vocab) t)))
|
,(if see 'fuel-word-see 'fuel-word-help))
|
||||||
|
,(factor-current-vocab)
|
||||||
|
,(factor-usings))))
|
||||||
(when print-message
|
(when print-message
|
||||||
(message "Looking up '%s' ..." def))
|
(message "Looking up '%s' ..." def))
|
||||||
(let* ((ret (fuel-eval--send/wait cmd))
|
(let* ((ret (fuel-eval--send/wait cmd))
|
||||||
|
|
Loading…
Reference in New Issue