branch: externals/consult commit f154d6bd800d8d12e88cb9abdc3b24c3c30a455f Author: Augusto Stoffel <ast...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Call compilation-find-file from the correct directory (#423) Fixes #301 --- consult-compile.el | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/consult-compile.el b/consult-compile.el index 5dbc4cb..a53b75b 100644 --- a/consult-compile.el +++ b/consult-compile.el @@ -67,20 +67,21 @@ (defun consult-compile--error-lookup (_ candidates cand) "Lookup marker of CAND by accessing CANDIDATES list." - (when-let (cand (car (member cand candidates))) - (let ((marker (get-text-property 0 'consult-compile--marker cand)) - (loc (get-text-property 0 'consult-compile--loc cand))) - (when (buffer-live-p (marker-buffer marker)) - (consult--position-marker - ;; taken from compile.el - (apply #'compilation-find-file - marker - (caar (compilation--loc->file-struct loc)) - (cadar (compilation--loc->file-struct loc)) - (compilation--file-struct->formats - (compilation--loc->file-struct loc))) - (compilation--loc->line loc) - (compilation--loc->col loc)))))) + (when-let ((cand (car (member cand candidates))) + (marker (get-text-property 0 'consult-compile--marker cand)) + (loc (get-text-property 0 'consult-compile--loc cand)) + (buffer (marker-buffer marker)) + (default-directory (buffer-local-value 'default-directory buffer))) + (consult--position-marker + ;; taken from compile.el + (apply #'compilation-find-file + marker + (caar (compilation--loc->file-struct loc)) + (cadar (compilation--loc->file-struct loc)) + (compilation--file-struct->formats + (compilation--loc->file-struct loc))) + (compilation--loc->line loc) + (compilation--loc->col loc)))) (defun consult-compile--compilation-buffers (file) "Return a list of compilation buffers relevant to FILE."