diff --git a/src/top/utop.el b/src/top/utop.el index b473cf6c..4bfdb50e 100644 --- a/src/top/utop.el +++ b/src/top/utop.el @@ -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)))))) + (if-let* ((pos (string-match "[^.]*$" prefix nil t)) + ((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)