🕷 zenspider.com

by ryan davis

Looking for the Ruby Quickref?

autotest for emacs

Published 2007-03-06 @ 11:38

Tagged emacs, zentest

I’ve been using this for a while now. It works pretty well for me, but I’m sure stuff could be ironed out and made a bit smoother/cleaner. Please provide any and all suggestions/patches as you see fit. This will be incorporated and eventually released with ZenTest once it feels good.

autotest.el behind the cut. ;; autotest.el - by Ryan Davis - ryan-ruby@zenspider.com ;; ;; Sets up an autotest buffer and provides conveniencte methods. ;; ;; History: ;; 1.0 beta 1 - 2007-03-06 - initial release

(require 'shell)

(defun autotest ()
  "Fire up an instance of autotest in its own buffer with shell bindings and compile-mode highlighting and linking."
  ;; TODO: (if (not (comint-check-proc "*autotest*"))

  (let ((buffer (shell "*autotest*")))

    (define-key shell-mode-map "\C-c\C-a" 'autotest-switch)

    (set (make-local-variable 'comint-output-filter-functions)
         '(comint-truncate-buffer comint-postoutput-scroll-to-bottom))
    (set (make-local-variable 'comint-buffer-maximum-size) 5000)
    (set (make-local-variable 'comint-scroll-show-maximum-output) t)
    (set (make-local-variable 'comint-scroll-to-bottom-on-output) t)

    (set (make-local-variable 'compilation-error-regexp-alist)
           ("^ +\\([^:]+\\):\\([0-9]+\\)" 1 2)
           ("\\[\\(.*\\):\\([0-9]+\\)\\]:$" 1 2)
           ; ("^ *\\[?\\([^:\\n\\r]+\\):\\([0-9]+\\):in" 1 2)
    (comint-send-string buffer "autotest\n")))

(defun autotest-switch ()
  "Switch back and forth between autotest and the previous buffer"
  (if (equal "*autotest*" (buffer-name))
      (switch-to-buffer nil)
    (switch-to-buffer "*autotest*")))

(provide 'autotest)