FUEL: Use font-locks data to figure out if the token point is on is a vocab
If point is on "myvocab" in IN: myvocab fuel-help will now understand that it is on a vocabulary token.db4
parent
385a8a0798
commit
a80dc21337
|
@ -628,12 +628,10 @@ source/docs/tests file. When set to false, you'll be asked only once."
|
|||
(beginning-of-line)
|
||||
(re-search-forward factor-constructor-regex (line-end-position) t)))
|
||||
|
||||
(defun factor-in-using ()
|
||||
(let ((p (point)))
|
||||
(save-excursion
|
||||
(and (re-search-backward "^USING:[ \n]" nil t)
|
||||
(re-search-forward " ;" nil t)
|
||||
(< p (match-end 0))))))
|
||||
(defun factor-on-vocab ()
|
||||
"t if point is on a vocab name. We just piggyback on
|
||||
font-lock's pretty accurate information."
|
||||
(eq (get-char-property (point) 'face) 'factor-font-lock-vocabulary-name))
|
||||
|
||||
(defsubst factor-end-of-defun-pos ()
|
||||
(save-excursion
|
||||
|
|
|
@ -58,7 +58,7 @@ USING: form with \\[fuel-load-usings]."
|
|||
(fuel-log--inhibit-p t))
|
||||
(when word
|
||||
(let* ((usings (if fuel-autodoc-eval-using-form-p :usings t))
|
||||
(cmd (if (factor-in-using)
|
||||
(cmd (if (factor-on-vocab)
|
||||
`(:fuel* (,word fuel-vocab-summary) :in t)
|
||||
`(:fuel* ((,word :usings fuel-word-synopsis)) t ,usings)))
|
||||
(ret (fuel-eval--send/wait cmd fuel-autodoc--timeout))
|
||||
|
|
|
@ -196,7 +196,7 @@ Perform completion similar to Emacs' complete-symbol."
|
|||
(let* ((end (point))
|
||||
(beg (save-excursion (factor-beginning-of-symbol) (point)))
|
||||
(prefix (buffer-substring-no-properties beg end))
|
||||
(result (fuel-completion--complete prefix (factor-in-using)))
|
||||
(result (fuel-completion--complete prefix (factor-on-vocab)))
|
||||
(completions (car result))
|
||||
(partial (cdr result)))
|
||||
(cond ((null completions)
|
||||
|
|
|
@ -252,7 +252,7 @@
|
|||
"Show extended help about the word or vocabulary at point, using a
|
||||
help buffer."
|
||||
(interactive "p")
|
||||
(if (factor-in-using)
|
||||
(if (factor-on-vocab)
|
||||
(fuel-help-vocab (factor-symbol-at-point))
|
||||
(fuel-help--word-help nil nil print-message)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue