From 684f67938c7f7e8c0f3cee638f03f2603e0e1e3f Mon Sep 17 00:00:00 2001 From: Aleksei Gusev Date: Sun, 8 Jun 2025 23:49:40 +0300 Subject: Add compilation regexp to match ‘dbg!’ output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While debugging tests it’s annoying when ‘compilation-mode’ matches ‘dbg!’ output incorrectly. Currently, rust-mode’s regexps assign it as an error and incorrectly include ‘[’. The proposed change adds a regexp to match such things and assign them info level. --- rust-compile.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rust-compile.el') diff --git a/rust-compile.el b/rust-compile.el index 04ac6b6..abeb753 100644 --- a/rust-compile.el +++ b/rust-compile.el @@ -48,6 +48,12 @@ See `compilation-error-regexp-alist' for help on their format.") "Specifications for matching panics in cargo test invocations. See `compilation-error-regexp-alist' for help on their format.") +(defvar rustc-dbg!-compilation-regexps + (let ((re (concat "\\[" rustc-compilation-location "\\]"))) + (cons re '(2 3 4 0 1))) + "Specifications for matching dbg! output. +See `compilation-error-regexp-alist' for help on their format.") + (defun rustc-scroll-down-after-next-error () "In the new style error messages, the regular expression matches on the file name (which appears after `-->`), but the @@ -85,6 +91,9 @@ the compilation window until the top of the error is visible." (cons 'rustc-panics rustc-panics-compilation-regexps)) (add-to-list 'compilation-error-regexp-alist 'rustc-panics) (add-to-list 'compilation-error-regexp-alist 'cargo) + (add-to-list 'compilation-error-regexp-alist-alist + (cons 'rust-dbg! rustc-dbg!-compilation-regexps)) + (add-to-list 'compilation-error-regexp-alist 'rust-dbg!) (add-hook 'next-error-hook #'rustc-scroll-down-after-next-error))) ;;; _ -- cgit v1.2.3