Skip to content

Commit 5da1bb6

Browse files
authored
Merge pull request #497 from juergenhoetzel/capf-module-completion
Emacs completion: Include module prefix in completion candidates
2 parents 0cbe54e + 1b0d11a commit 5da1bb6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/top/utop.el

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,10 @@ it is started."
604604
(dolist (prefix utop-completion-prefixes)
605605
;; We need to handle specially prefixes like "List.m" as
606606
;; the responses from utop don't include the module prefix.
607-
(let ((prefix (if (string-match-p "\\." prefix)
608-
(cadr (split-string prefix "\\."))
609-
prefix)))
610-
(when (string-prefix-p prefix argument)
611-
(push argument utop-completion)
607+
(let* ((pos (string-match "[^.]*$" prefix))
608+
(module-prefix (substring prefix 0 pos)))
609+
(when (string-prefix-p (substring prefix pos) argument)
610+
(push (concat module-prefix argument) utop-completion)
612611
(throw 'done t))))))
613612
;; End of completion
614613
("completion-stop"

0 commit comments

Comments
 (0)