Permalink
Browse files

rails-scripts.el (rails-script:setup-output-buffer): fixed compilatio…

…n warning

git-svn-id: svn+ssh://rubyforge.org/var/svn/emacs-rails/trunk@209 cc5033d0-740f-0410-afc7-949910e492f2
  • Loading branch information...
1 parent a3114d5 commit bfc5b8fa6c964cf8a82a99ab86caaee1e41fb6be dimaexe committed Aug 16, 2007
Showing with 29 additions and 16 deletions.
  1. +2 −0 ChangeLog
  2. +1 −0 History
  3. +2 −1 rails-ruby.el
  4. +24 −15 rails-test.el
View
@@ -1,5 +1,7 @@
2007-08-15 Dmitry Galinsky <dima.exe@gmail.com>
+ * rails-scripts.el (rails-script:setup-output-buffer): fixed compilation warning
+
* rails-ruby.el (ruby-hs-minor-mode): created, support ruby in hs-minor-mode
2007-08-11 Dmitry Galinsky <dima.exe@gmail.com>
View
@@ -1,4 +1,5 @@
SVN
+* Updated highlight of compilation output
* Added ruby-mode support in hs-minor-mode (aka folding).
* Added migrations and configuration files to speedbar.
* More shortcuts for tests.
View
@@ -59,8 +59,9 @@ See the variable `align-rules-list' for more details.")
(defun display-code-line-counts (ov)
(when (eq 'code (overlay-get ov 'hs))
(overlay-put ov 'face 'font-lock-comment-face)
+; (overlay-put ov 'help-echo (buffer-substring-no-properties (overlay-start ov) (overlay-end ov)))
(overlay-put ov 'display
- (format " »»» %d lines"
+ (format " ··· %d lines"
(count-lines (overlay-start ov)
(overlay-end ov))))))
View
@@ -32,28 +32,34 @@
"\\([0-9]+ tests, [0-9]+ assertions, \\([0-9]+\\) failures, \\([0-9]+\\) errors\\)")
(defconst rails-test:progress-regexp
- "^[\\.EF]+$")
-
-(defun rails-test:file-ext-regexp ()
- (let ((rails-templates-list (append rails-templates-list (list "rb"))))
- (substring (rails-core:regex-for-match-view) 0 -1)))
+ "^[.EF]+$")
+
+(defvar rails-test:font-lock-keywords
+ '(("\\([0-9]+ tests, [0-9]+ assertions, 0 failures, 0 errors\\)"
+ 1 compilation-info-face)
+ ("\\([0-9]+ tests, [0-9]+ assertions, [0-9]+ failures, [0-9]+ errors\\)"
+ 1 compilation-line-face)
+ ("`\\([a-z0-9_]+\\)'"
+ 1 font-lock-function-name-face t)
+ ("^\s+\\([0-9]+)\s+\\(Error\\|Failure\\):\\)"
+ 1 compilation-line-face)
+ ("^\\(test_[a-z0-9_]+\\)(\\([a-zA-Z0-9:]+\\)):?$"
+ (1 font-lock-function-name-face)
+ (2 font-lock-type-face))
+ ("^[.EF]+$" . compilation-info-face)))
(defun rails-test:line-regexp (&optional append prepend)
(concat
append
- (format
- "\\(#{RAILS_ROOT}\/\\)?\\(\\(\\.\\|[A-Za-z]:\\)?\\([a-z/_.-]+%s\\)\\):\\([0-9]+\\)"
- (rails-test:file-ext-regexp))
+ "^\\(?:\s+\\)\\[?\\([^ \f\n\r\t\v]*?\\):\\([0-9]+\\)\\(?::in\s*`\\(.*?\\)'\\)?"
prepend))
(defun rails-test:error-regexp-alist ()
(list
(list 'rails-test-trace
- (rails-test:line-regexp) 2 6 nil 0)
- (list 'rails-test-failure
- (rails-test:line-regexp "\\[" "\\]") 2 6 nil 2)
+ (rails-test:line-regexp) 1 2 nil 1)
(list 'rails-test-error
- (rails-test:line-regexp nil ".*\n$") 2 6 nil 2)))
+ (rails-test:line-regexp nil "\\(?:\]:\\|\n$\\)") 1 2 nil 2))) ; ending of "]:" or next line is blank
(defun rails-test:print-result ()
(with-current-buffer (get-buffer rails-script:buffer-name)
@@ -63,8 +69,8 @@
(save-excursion
(goto-char (point-min))
(while (re-search-forward rails-test:result-regexp (point-max) t)
- (setq failures (+ failures (string-to-number (match-string-no-properties 2))))
- (setq errors (+ errors (string-to-number (match-string-no-properties 3))))
+ (setq failures (+ failures (string-to-number (match-string 2))))
+ (setq errors (+ errors (string-to-number (match-string 3))))
(add-to-list 'msg (match-string-no-properties 1))))
(unless (zerop (length msg))
(message (strings-join " || " (reverse msg))))
@@ -91,11 +97,14 @@
(define-derived-mode rails-test:compilation-mode compilation-mode "RTest"
"Major mode for RoR tests."
(rails-script:setup-output-buffer)
+ ; replace compilation font-lock-keywords
+ (set (make-local-variable 'compilation-mode-font-lock-keywords) rails-test:font-lock-keywords)
+ ; skip anythins less that error
+ (set (make-local-variable 'compilation-skip-threshold) 2)
(set (make-local-variable 'compilation-error-regexp-alist-alist)
(rails-test:error-regexp-alist))
(set (make-local-variable 'compilation-error-regexp-alist)
'(rails-test-error
- rails-test-failure
rails-test-trace))
(add-hook 'after-change-functions 'rails-test:print-progress nil t)
(add-hook 'rails-script:run-after-stop-hook 'rails-test:print-result nil t)

0 comments on commit bfc5b8f

Please sign in to comment.