Skip to content

Commit 6b506e3

Browse files
committed
strip _build/default when locating files
1 parent 5affe7a commit 6b506e3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

company-coq.el

+11-6
Original file line numberDiff line numberDiff line change
@@ -2180,12 +2180,17 @@ to a non-existent file (for an example of such a case, try
21802180
(file-name-nondirectory (buffer-file-name proof-script-buffer))))))
21812181
proof-script-buffer
21822182
(let* ((lib-name (concat lib-path mod-name))
2183-
(output (company-coq-ask-prover-swallow-errors (format company-coq-locate-lib-cmd lib-name))))
2184-
(or (and output (save-match-data
2185-
(when (and (string-match company-coq-locate-lib-output-format output)
2186-
(string-match-p company-coq-compiled-regexp (match-string-no-properties 3 output)))
2187-
(concat (match-string-no-properties 2 output) ".v"))))
2188-
(and fallback-spec (expand-file-name (concat mod-name ".v") (cdr fallback-spec)))))))
2183+
(output (company-coq-ask-prover-swallow-errors (format company-coq-locate-lib-cmd lib-name)))
2184+
(path (or (and output (save-match-data
2185+
(when (and (string-match company-coq-locate-lib-output-format output)
2186+
(string-match-p company-coq-compiled-regexp (match-string-no-properties 3 output)))
2187+
(concat (match-string-no-properties 2 output) ".v"))))
2188+
(and fallback-spec (expand-file-name (concat mod-name ".v") (cdr fallback-spec)))))
2189+
(stripped (replace-regexp-in-string "_build/default" "" path nil 'literal)))
2190+
(if (file-exists-p stripped)
2191+
stripped
2192+
path
2193+
))))
21892194

21902195
(defun company-coq--locate-name (name functions)
21912196
"Find location of NAME using FUNCTIONS.

0 commit comments

Comments
 (0)