feat(emacs/lean-company): add company-lean--need-autocomplete
This one partially addresses #150.
This commit is contained in:
parent
3310eb3dfc
commit
ba35ca5300
1 changed files with 13 additions and 3 deletions
|
@ -19,13 +19,23 @@
|
|||
(setq-local company-begin-commands '(self-insert-command)) ; start autocompletion only after typing
|
||||
(company-mode t))
|
||||
|
||||
(defun company-lean--need-autocomplete ()
|
||||
(not (looking-back
|
||||
(rx (or "theorem" "definition" "lemma" "axiom" "parameter"
|
||||
"abbreviation" "variable" "hypothesis" "conjecture"
|
||||
"corollary")
|
||||
(+ white)
|
||||
(* (not white))))))
|
||||
|
||||
(defun company-lean--prefix ()
|
||||
"Returns the symbol to complete. Also, if point is on a dot,
|
||||
triggers a completion immediately."
|
||||
(let ((prefix (company-grab-symbol)))
|
||||
(when (or
|
||||
(> (length prefix) 3)
|
||||
(string-match "[_.]" prefix))
|
||||
(when (and
|
||||
(company-lean--need-autocomplete)
|
||||
(or
|
||||
(> (length prefix) 3)
|
||||
(string-match "[_.]" prefix)))
|
||||
prefix)))
|
||||
|
||||
(defun company-lean--make-candidate (arg)
|
||||
|
|
Loading…
Reference in a new issue