From 521fb049be4642919d690a01ef8617a9508d3909 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sat, 10 Aug 2013 21:07:51 +0200 Subject: [PATCH 1/3] compilation error regexp specific to rustc. Fix #6887. --- src/etc/emacs/rust-mode.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index ecb223f896c37..efe9f51e6319f 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -225,4 +225,19 @@ The initializer is `DEFAULT-TAB-WIDTH'.") (provide 'rust-mode) +;; Issue #6887: Rather than inheriting the 'gnu compilation error +;; regexp (which is broken on a few edge cases), add our own 'rust +;; compilation error regexp and use it instead. +(defvar rustc-compilation-regexps + (let ((re (concat "^\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\): " + "\\([0-9]+\\):\\([0-9]+\\) " + "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\):"))) + (cons re '(1 (2 . 4) (3 . 5) (6)))) + "Specifications for matching errors in rustc invocations. +See `compilation-error-regexp-alist for help on their format.") + +(add-to-list 'compilation-error-regexp-alist-alist + (cons 'rustc rustc-compilation-regexps)) +(add-to-list 'compilation-error-regexp-alist 'rustc) + ;;; rust-mode.el ends here From fe7092dafb83e7d541aa06095342252dc02c2d5d Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sun, 25 Aug 2013 14:38:12 +0200 Subject: [PATCH 2/3] revisions to emacs compilation regexp, more readable and robust. --- src/etc/emacs/rust-mode.el | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index efe9f51e6319f..af1c28be7bd2f 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -229,15 +229,23 @@ The initializer is `DEFAULT-TAB-WIDTH'.") ;; regexp (which is broken on a few edge cases), add our own 'rust ;; compilation error regexp and use it instead. (defvar rustc-compilation-regexps - (let ((re (concat "^\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\): " - "\\([0-9]+\\):\\([0-9]+\\) " - "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\):"))) - (cons re '(1 (2 . 4) (3 . 5) (6)))) + (let ((file "\\([^ \n]+\\)") + (start-line "\\([0-9]+\\)") + (start-col "\\([0-9]+\\)") + (end-line "\\([0-9]+\\)") + (end-col "\\([0-9]+\\)") + (error-or-warning "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\)")) + (let ((re (concat "^" file ":" start-line ":" start-col + ": " end-line ":" end-col + " \\(?:[Ee]rror\\|\\([Ww]arning\\)\\):"))) + (cons re '(1 (2 . 4) (3 . 5) (6))))) "Specifications for matching errors in rustc invocations. See `compilation-error-regexp-alist for help on their format.") -(add-to-list 'compilation-error-regexp-alist-alist - (cons 'rustc rustc-compilation-regexps)) -(add-to-list 'compilation-error-regexp-alist 'rustc) +(eval-after-load 'compile + '(progn + (add-to-list 'compilation-error-regexp-alist-alist + (cons 'rustc rustc-compilation-regexps)) + (add-to-list 'compilation-error-regexp-alist 'rustc))) ;;; rust-mode.el ends here From 9d8897ba603b044a82a4cbcf97e5aadcb77ef661 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 26 Aug 2013 02:28:27 +0200 Subject: [PATCH 3/3] extend file regexp to match files with embedded spaces. --- src/etc/emacs/rust-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index af1c28be7bd2f..4c257e92e5d35 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -229,7 +229,7 @@ The initializer is `DEFAULT-TAB-WIDTH'.") ;; regexp (which is broken on a few edge cases), add our own 'rust ;; compilation error regexp and use it instead. (defvar rustc-compilation-regexps - (let ((file "\\([^ \n]+\\)") + (let ((file "^\\([^\n]+\\)") (start-line "\\([0-9]+\\)") (start-col "\\([0-9]+\\)") (end-line "\\([0-9]+\\)")