[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 4fce178 251/486: Merge pull request #154 from ni
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 4fce178 251/486: Merge pull request #154 from nikomatsakis/new-errors |
Date: |
Sat, 7 Aug 2021 09:25:30 -0400 (EDT) |
branch: elpa/rust-mode
commit 4fce17848d7df44ea5a722577dbf69cccf39878b
Merge: b23efef 40c33fd
Author: Micah Chalmer <micah@micahchalmer.net>
Commit: Micah Chalmer <micah@micahchalmer.net>
Merge pull request #154 from nikomatsakis/new-errors
add code to handle new-style rustc errors
---
rust-mode.el | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/rust-mode.el b/rust-mode.el
index df7e93c..b0f8379 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1381,6 +1381,16 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
"Specifications for matching errors in rustc invocations.
See `compilation-error-regexp-alist' for help on their format.")
+(defvar rustc-new-compilation-regexps
+ (let ((file "\\([^\n]+\\)")
+ (start-line "\\([0-9]+\\)")
+ (start-col "\\([0-9]+\\)"))
+ (let ((re (concat "^ *--> " file ":" start-line ":" start-col ; --> 1:2:3
+ )))
+ (cons re '(1 2 3))))
+ "Specifications for matching errors in rustc invocations (new style).
+See `compilation-error-regexp-alist' for help on their format.")
+
;; Match test run failures and panics during compilation as
;; compilation warnings
(defvar cargo-compilation-regexps
@@ -1388,9 +1398,33 @@ 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.")
+(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
+ start of the error appears a few lines earlier. This hook runs
+ after `M-x next-error`; it simply scrolls down a few lines in
+ the compilation window until the top of the error is visible."
+ (save-selected-window
+ (when (eq major-mode 'rust-mode)
+ (select-window (get-buffer-window next-error-last-buffer))
+ (when (save-excursion
+ (beginning-of-line)
+ (looking-at " *-->"))
+ (let ((start-of-error
+ (save-excursion
+ (beginning-of-line)
+ (while (not (looking-at "^[a-z]+:"))
+ (forward-line -1))
+ (point))))
+ (set-window-start (selected-window) start-of-error))))))
+
(eval-after-load 'compile
'(progn
(add-to-list 'compilation-error-regexp-alist-alist
+ (cons 'rustc-new rustc-new-compilation-regexps))
+ (add-to-list 'compilation-error-regexp-alist 'rustc-new)
+ (add-hook 'next-error-hook 'rustc-scroll-down-after-next-error)
+ (add-to-list 'compilation-error-regexp-alist-alist
(cons 'rustc rustc-compilation-regexps))
(add-to-list 'compilation-error-regexp-alist 'rustc)
(add-to-list 'compilation-error-regexp-alist-alist
- [nongnu] elpa/rust-mode 6739dd9 226/486: Merge pull request #123 from birkenfeld/fix-unicode-char-escapes, (continued)
- [nongnu] elpa/rust-mode 6739dd9 226/486: Merge pull request #123 from birkenfeld/fix-unicode-char-escapes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f408b06 227/486: Run the after-revert hook after rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bc0df03 235/486: Merge pull request #135 from Stebalien/file-local, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9812232 236/486: Document how to install on Debian, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bfe24d2 237/486: Merge pull request #132 from tomjakubowski/move-module, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1c37249 238/486: Merge pull request #136 from Stebalien/indent-brace, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bd44088 239/486: Merge pull request #138 from kraai/upstream, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 18fad39 242/486: Merge pull request #142 from tromey/remove-emacs-23-support, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode eafb7a0 248/486: Properly fix #151, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b23efef 249/486: Merge pull request #153 from mrBliss/fix-151, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4fce178 251/486: Merge pull request #154 from nikomatsakis/new-errors,
ELPA Syncer <=
- [nongnu] elpa/rust-mode e6eceea 253/486: Add macro_rules names to imenu, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5cfb919 265/486: Merge pull request #165 from nikomatsakis/new-errors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 01ac5d8 272/486: Merge pull request #177 from mrBliss/handle-comments-method-chains, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c091852 283/486: Merge pull request #180 from MicahChalmer/melpa-stable-readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8039d12 286/486: Merge pull request #191 from Wooble/readme_link, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0de149a 287/486: Merge pull request #190 from mrBliss/imenu-extern, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee7043b 289/486: Use syntax-propertize-function, not font-lock-syntactic-keywords, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d7458c2 290/486: set open-paren-in-column-0-is-defun-start to nil, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4d651ab 295/486: Merge pull request #197 from tromey/syntax-propertize, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 85befb9 296/486: Merge pull request #201 from tromey/question-indentation, ELPA Syncer, 2021/08/07