FUEL: M-. completes vocab names when in USING: stanza.
parent
de37d91304
commit
2cc6810ea6
|
@ -160,6 +160,8 @@ M: source-file fuel-pprint path>> fuel-pprint ;
|
|||
|
||||
: fuel-end-eval ( -- ) [ ] (fuel-end-eval) ; inline
|
||||
|
||||
! Edit locations
|
||||
|
||||
: fuel-get-edit-location ( defspec -- )
|
||||
where [
|
||||
first2 [ (normalize-path) ] dip 2array fuel-eval-set-result
|
||||
|
@ -193,7 +195,7 @@ MEMO: (fuel-vocab-words) ( name -- seq )
|
|||
|
||||
: (fuel-get-words) ( prefix names/f -- seq )
|
||||
[ fuel-vocabs-words ] [ fuel-current-words ] if* natural-sort
|
||||
swap fuel-filter-prefix ;
|
||||
swap fuel-filter-prefix ;
|
||||
|
||||
: fuel-get-words ( prefix names -- )
|
||||
(fuel-get-words) fuel-eval-set-result ; inline
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
(fuel-eval--send/wait '(:fuel* (fuel-get-vocabs) "fuel" (:array)))))))
|
||||
fuel-completion--vocabs)
|
||||
|
||||
(defsubst fuel-completion--vocab-list (prefix)
|
||||
(fuel-eval--retort-result
|
||||
(fuel-eval--send/wait `(:fuel* (,prefix fuel-get-vocabs/prefix) t t))))
|
||||
|
||||
(defun fuel-completion--words (prefix vocabs)
|
||||
(let ((vs (if vocabs (cons :array vocabs) 'f))
|
||||
(us (or vocabs 't)))
|
||||
|
@ -152,8 +156,10 @@ terminates a current completion."
|
|||
(defvar fuel-completion--all-words-list-func
|
||||
(completion-table-dynamic 'fuel-completion--all-words-list))
|
||||
|
||||
(defun fuel-completion--complete (prefix)
|
||||
(let* ((words (fuel-completion--word-list prefix))
|
||||
(defun fuel-completion--complete (prefix vocabs)
|
||||
(let* ((words (if vocabs
|
||||
(fuel-completion--vocabs)
|
||||
(fuel-completion--word-list prefix)))
|
||||
(completions (all-completions prefix words))
|
||||
(partial (try-completion prefix words))
|
||||
(partial (if (eq partial t) prefix partial)))
|
||||
|
@ -174,7 +180,7 @@ Perform completion similar to Emacs' complete-symbol."
|
|||
(let* ((end (point))
|
||||
(beg (fuel-syntax--symbol-start))
|
||||
(prefix (buffer-substring-no-properties beg end))
|
||||
(result (fuel-completion--complete prefix))
|
||||
(result (fuel-completion--complete prefix (fuel-syntax--in-using)))
|
||||
(completions (car result))
|
||||
(partial (cdr result)))
|
||||
(cond ((null completions)
|
||||
|
|
|
@ -46,8 +46,7 @@
|
|||
(cons :id (random))
|
||||
(cons :string str)
|
||||
(cons :continuation cont)
|
||||
(cons :buffer (or sender-buffer (current-buffer)))
|
||||
(cons :output "")))
|
||||
(cons :buffer (or sender-buffer (current-buffer)))))
|
||||
|
||||
(defsubst fuel-con--request-p (req)
|
||||
(and (listp req) (eq (car req) :fuel-connection-request)))
|
||||
|
@ -64,11 +63,6 @@
|
|||
(defsubst fuel-con--request-buffer (req)
|
||||
(cdr (assoc :buffer req)))
|
||||
|
||||
(defun fuel-con--request-output (req &optional suffix)
|
||||
(let ((cell (assoc :output req)))
|
||||
(when suffix (setcdr cell (concat (cdr cell) suffix)))
|
||||
(cdr cell)))
|
||||
|
||||
(defsubst fuel-con--request-deactivate (req)
|
||||
(setcdr (assoc :continuation req) nil))
|
||||
|
||||
|
|
|
@ -232,6 +232,13 @@
|
|||
(defsubst fuel-syntax--at-using ()
|
||||
(looking-at fuel-syntax--using-lines-regex))
|
||||
|
||||
(defun fuel-syntax--in-using ()
|
||||
(let ((p (point)))
|
||||
(save-excursion
|
||||
(and (re-search-backward "^USING: " nil t)
|
||||
(re-search-forward " ;" nil t)
|
||||
(< p (match-end 0))))))
|
||||
|
||||
(defsubst fuel-syntax--beginning-of-defun (&optional times)
|
||||
(re-search-backward fuel-syntax--begin-of-def-regex nil t times))
|
||||
|
||||
|
|
Loading…
Reference in New Issue