Skip to content

Commit

Permalink
Emacs completion: Include module prefix in completion candidates
Browse files Browse the repository at this point in the history
Fixes a mismatch of the completion START position in the Emacs buffer
and the candidatates that didn't include the expected module-prefix.

Fixes #455
  • Loading branch information
juergenhoetzel committed Jan 23, 2025
1 parent 3322ada commit b684685
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/top/utop.el
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,10 @@ it is started."
(dolist (prefix utop-completion-prefixes)
;; We need to handle specially prefixes like "List.m" as
;; the responses from utop don't include the module prefix.
(let ((prefix (if (string-match-p "\\." prefix)
(cadr (split-string prefix "\\."))
prefix)))
(when (string-prefix-p prefix argument)
(push argument utop-completion)
(throw 'done t))))))
(when-let* ((pos (string-match "[^.]*$" prefix))
((string-prefix-p (substring prefix pos) argument)))
(push (concat (substring prefix 0 pos) argument) utop-completion)
(throw 'done t)))))
;; End of completion
("completion-stop"
(utop-set-state 'edit)
Expand Down

0 comments on commit b684685

Please sign in to comment.