-
Notifications
You must be signed in to change notification settings - Fork 190
Open
Description
It is an unfortunate reality that other tools that invoke cargo or rustc will add prefix text to its diagnostics, which breaks compilation-mode. Consider removing the beginning of line anchor from these regexps. See also #576.
I'm currently doing this to work around it,
(defun dwa/dioxus-rust-compilation-error-patch ()
"Update the rust error message formats to account for https://github.com/DioxusLabs/dioxus/issues/4547."
;; Look for all potential rust errors
(dolist (key '(rustc-panics cargo rustc-colon rustc rustc-refs) nil)
(let* ((e (cdr (assoc key compilation-error-regexp-alist-alist)))
(pattern (car e))
(prefix "^\\(?: +[0-9]+[.] ?[0-9]*s +INFO +\\)?"))
(when
(and pattern
;; Anything not anchored at the beginning of the line
;; should match without changes.
(string-prefix-p "^" pattern)
;; Attempt to make this modification idempotent
(not (string-prefix-p prefix pattern)))
;; Shadow the existing alist entry; no need to modify it.
(add-to-list
'compilation-error-regexp-alist-alist
;; Inject the prefix after the "^"
`(,key . ,(cons (concat prefix (substring pattern 1)) (cdr e))))))))
But I also need to redefine rustc-scroll-down-after-next-error
because it also embeds an anchor in a literal string.
Metadata
Metadata
Assignees
Labels
No labels