[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 7e2533f 415/486: Fix rustc-compilation-regexps:
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 7e2533f 415/486: Fix rustc-compilation-regexps: match error messages with dashes. (#331) |
Date: |
Sat, 7 Aug 2021 09:26:05 -0400 (EDT) |
branch: elpa/rust-mode
commit 7e2533f00e7b8e2f0b1f81a124263fdfb58cdc84
Author: Nathan Moreau <nathan.moreau@m4x.org>
Commit: GitHub <noreply@github.com>
Fix rustc-compilation-regexps: match error messages with dashes. (#331)
---
rust-mode-tests.el | 34 ++++++++++++++++++++++++++++++++++
rust-mode.el | 4 ++--
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index a22e43a..ac81d03 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -3137,6 +3137,40 @@ impl Two<'a> {
(let ((default-directory test-dir))
(should (equal (expand-file-name (rust-buffer-project))
manifest-file))))))
+(ert-deftest compilation-regexp-dashes ()
+ (with-temp-buffer
+ ;; should match
+ (insert "error found a -> b\n --> file1.rs:12:34\n\n")
+ (insert "error[E1234]: found a -> b\n --> file2.rs:12:34\n\n")
+ (insert "warning found a -> b\n --> file3.rs:12:34\n\n")
+ ;; should not match
+ (insert "werror found a -> b\n --> file4.rs:12:34\n\n")
+
+ (goto-char (point-min))
+ (let ((matches nil))
+ (while (re-search-forward (car rustc-compilation-regexps) nil t)
+ (push
+ (mapcar (lambda (r)
+ (let ((match-pos
+ (nth (cdr r) rustc-compilation-regexps)))
+ (if (eq :is-warning (car r))
+ (compilation-face match-pos)
+ (match-string match-pos))))
+ ;; see compilation-error-regexp-alist
+ '((:file . 1)
+ (:line . 2)
+ (:column . 3)
+ (:is-warning . 4)
+ (:mouse-highlight . 5)))
+ matches))
+ (setq matches (reverse matches))
+
+ (should (equal
+ '(("file1.rs" "12" "34" compilation-error "file1.rs:12:34")
+ ("file2.rs" "12" "34" compilation-error "file2.rs:12:34")
+ ("file3.rs" "12" "34" compilation-warning "file3.rs:12:34"))
+ matches)))))
+
;; If electric-pair-mode is available, load it and run the tests that use it.
If not,
;; no error--the tests will be skipped.
(require 'elec-pair nil t)
diff --git a/rust-mode.el b/rust-mode.el
index 71e9458..7b14d04 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1640,8 +1640,8 @@ Return the created process."
(defvar rustc-compilation-regexps
(let ((file "\\([^\n]+\\)")
(start-line "\\([0-9]+\\)")
- (start-col "\\([0-9]+\\)"))
- (let ((re (concat "^\\(?:error\\|\\(warning\\)\\)[^-]+--> \\(" file ":"
start-line ":" start-col "\\)")))
+ (start-col "\\([0-9]+\\)"))
+ (let ((re (concat "^\\(?:error\\|\\(warning\\)\\)[^\0]+?--> \\(" file ":"
start-line ":" start-col "\\)")))
(cons re '(3 4 5 (1) 2))))
"Specifications for matching errors in rustc invocations.
See `compilation-error-regexp-alist' for help on their format.")
- [nongnu] elpa/rust-mode 09b4320 476/486: test: Suppress some noisy messages, (continued)
- [nongnu] elpa/rust-mode 09b4320 476/486: test: Suppress some noisy messages, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode afeddec 325/486: Merge pull request #224 from tromey/beginning-of-defun, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7fd78f0 444/486: rust-goto-format-problem: make sure to always just to a buffer that exists., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9e03890 478/486: Create rust-compile.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 41642f0 481/486: rust-end-of-string: Move definition, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d548425 483/486: Create rust-playpen.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode eb5270b 437/486: rust-before-save-hook: log errors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 2df6cf7 439/486: Don't fail on re-search-forward. (#359), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ca415e9 470/486: Add rust-check function, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e327658 274/486: Merge pull request #178 from ryuslash/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7e2533f 415/486: Fix rustc-compilation-regexps: match error messages with dashes. (#331),
ELPA Syncer <=
- [nongnu] elpa/rust-mode 9107989 424/486: review, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d0f3f45 431/486: imenu: fn items: match async/const and all pub variants. (#346), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7afad7b 464/486: rearrange II: Regexp variables and functions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bbb3792 473/486: Remove "-face" suffix from names of faces, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3eb6d2f 485/486: Create rust-utils.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b81c723 467/486: Various cosmetic changes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1f8a763 446/486: Fix typos, ELPA Syncer, 2021/08/07