autotest for emacs

| | Comments (0)

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."
  (interactive)
  ;; 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)
           ))
    (compilation-shell-minor-mode)
    (comint-send-string buffer "autotest\n")))

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

(provide 'autotest)

Leave a comment

About this Entry

This page contains a single entry by zenspider published on March 6, 2007 11:38 AM.

locate and spotlight was the previous entry in this blog.

autotest bindings is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en