diff --git a/src/top/utop.el b/src/top/utop.el index 4b3d706d..b473cf6c 100644 --- a/src/top/utop.el +++ b/src/top/utop.el @@ -721,9 +721,8 @@ If ADD-TO-HISTORY is t then the input will be added to history." (utop-send-string (concat "data:" line "\n"))) (utop-send-string "end:\n"))) -(defun utop-complete () - "Complete current input." - (interactive) +(defun utop-complete-start () + "Conditionally begins to request completion candidates from utop." ;; Complete only if the cursor is after the prompt (when (and (eq utop-state 'edit) (>= (point) utop-prompt-max)) ;; Use this buffer @@ -735,7 +734,7 @@ If ADD-TO-HISTORY is t then the input will be added to history." (defun utop-completion-at-point () "Complete thing at point." (setq utop-capf-completion-candidates nil) - (utop-complete) + (utop-complete-start) (let ((elapsed-time 0)) (while (and (eq utop-state 'comp) @@ -749,6 +748,13 @@ If ADD-TO-HISTORY is t then the input will be added to history." (point) utop-capf-completion-candidates))) +(defun utop-complete () + "Complete current input." + (interactive) + (if (utop--supports-company) + (utop-complete-start) + (completion-at-point))) + ;; +-----------------------------------------------------------------+ ;; | Eval | ;; +-----------------------------------------------------------------+