[Pkg-emacsen-addons] Bug#918373: elpa-rust-mode: goto-error goes to wrong line, scrolling message off screen
Ian Jackson
ijackson at chiark.greenend.org.uk
Sat Jan 5 16:10:28 GMT 2019
Package: elpa-rust-mode
Version: 0.3.0-1.1
Severity: normal
Tags: patch upstream
To reproduce:
* Start emacs in a directory containing a rust project
* M-x load-lib RET rust-mode RET
* Visit some rust source file
* M-x compile RET
* Change the compile command to `cargo build'; and say RET
* M-x next-error
* Look at what is displayed in the *compilation* window
Observed results:
* Top line is the line with the ` -->'.
Expected results:
* Top line is the line with `error: expected item, found $'
or whatever
I have forward-ported my patch to the upstream project and filed a
pull request:
https://github.com/rust-lang/rust-mode/pull/294
but this bug is quite irritating and it would IMO be worthwhile
considering updating it in Debian for buster.
Thanks,
Ian.
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.16.0-0.bpo.2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
Versions of packages elpa-rust-mode depends on:
ii emacsen-common 3.0.4
Versions of packages elpa-rust-mode recommends:
ii emacs 1:25.2+1-11
ii emacs-gtk [emacs] 1:25.2+1-11
elpa-rust-mode suggests no packages.
-- no debconf information
-------------- next part --------------
>From e265960c856f7c3c4ecadeb3350aa2fb5655f252 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijackson at chiark.greenend.org.uk>
Date: Fri, 28 Dec 2018 12:13:10 +0000
Subject: [PATCH] compilation regexps: Match line before, too.
"New format" (since 2016) Rust error messages look like this:
error[E0308]: mismatched types
--> src/bin/e19b.rs:672:47
|
672 | ExprRef::new(0, Nt(NT{ args : others, ..x_nt })),
| ^^^^^^ expected struct `ExprRef`, found enum `ExprCore`
|
= note: expected type `std::vec::Vec<ExprRef>`
found type `std::vec::Vec<ExprCore>`
The regexp matches the line with the `-->'. But of course next-error
scrolls the window so the start of the regexp is at the top of the
buffer. So we must match the line before, too. Rust won't ever start
its messages with a `-->' so we can unconditionally include the
previous line in the match.
Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
debian/changelog | 6 ++++++
rust-mode.el | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 8edc0b0..1339426 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+elpa-rust-mode (0.3.0-1.1~iwj) unstable; urgency=medium
+
+ * compilation regexps: Match line before, too.
+
+ -- Ian Jackson <ijackson at chiark.greenend.org.uk> Fri, 28 Dec 2018 12:13:01 +0000
+
elpa-rust-mode (0.3.0-1.1) unstable; urgency=medium
* Non-maintainer upload.
diff --git a/rust-mode.el b/rust-mode.el
index 60a81f1..8abea3b 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1417,7 +1417,7 @@ See `compilation-error-regexp-alist' for help on their format.")
(let ((file "\\([^\n]+\\)")
(start-line "\\([0-9]+\\)")
(start-col "\\([0-9]+\\)"))
- (let ((re (concat "^ *--> " file ":" start-line ":" start-col ; --> 1:2:3
+ (let ((re (concat "^.*\n *--> " file ":" start-line ":" start-col ; --> 1:2:3
)))
(cons re '(1 2 3))))
"Specifications for matching errors in rustc invocations (new style).
--
2.11.0
More information about the Pkg-emacsen-addons
mailing list