about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2013-08-25 14:38:12 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2013-08-25 14:38:12 +0200
commitfe7092dafb83e7d541aa06095342252dc02c2d5d (patch)
tree869bbd6c45e1abeb1747edb87c11aeb286287342
parent521fb049be4642919d690a01ef8617a9508d3909 (diff)
downloadrust-fe7092dafb83e7d541aa06095342252dc02c2d5d.tar.gz
rust-fe7092dafb83e7d541aa06095342252dc02c2d5d.zip
revisions to emacs compilation regexp, more readable and robust.
-rw-r--r--src/etc/emacs/rust-mode.el22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el
index efe9f51e631..af1c28be7bd 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