Permalink
Browse files

ruby-compilation and cucumber-compilation support reusing comint buff…

…ers for multiple focussed tests within the same file.

default behavior is to reuse buffers. old behavior can be turned back on by setting ruby-compilation-reuse-buffers to nil.
  • Loading branch information...
1 parent 1722a55 commit b036e2f511298e5503945ba1a4e8c1c6497bb5ae @flavorjones flavorjones committed with Feb 10, 2009
Showing with 26 additions and 6 deletions.
  1. +13 −3 util/cucumber-mode-compilation.el
  2. +13 −3 util/ruby-compilation.el
@@ -64,6 +64,9 @@
(defvar cucumber-compilation-clear-between t
"Whether to clear the compilation output between runs.")
+(defvar cucumber-compilation-reuse-buffers t
+ "Whether to re-use the same comint buffer for focussed tests.")
+
(defadvice cucumber-compilation-do (around cucumber-compilation-do activate)
"Set default directory to the root of the rails application
before running cucumber processes."
@@ -84,14 +87,21 @@
(let ((scenario-name (cucumber-compilation-this-scenario-name))
(profile-name (cucumber-compilation-profile-name)))
(pop-to-buffer (cucumber-compilation-do
- (format "cucumber: %s - %s"
- (file-name-nondirectory (buffer-file-name))
- scenario-name)
+ (cucumber-compilation-this-test-buffer-name scenario-name)
(list cucumber-compilation-executable
(buffer-file-name)
"-p" profile-name
"-s" scenario-name)))))
+(defun cucumber-compilation-this-test-buffer-name (scenario-name)
+ "The name of the buffer in which test-at-point will run."
+ (interactive)
+ (if cucumber-compilation-reuse-buffers
+ (file-name-nondirectory (buffer-file-name))
+ (format "cucumber: %s - %s"
+ (file-name-nondirectory (buffer-file-name))
+ scenario-name)))
+
;;;###autoload
(defun cucumber-compilation-run (cmd)
"Run a cucumber process, dumping output to a compilation buffer."
View
@@ -72,6 +72,9 @@
(defvar ruby-compilation-clear-between t
"Whether to clear the compilation output between runs.")
+(defvar ruby-compilation-reuse-buffers t
+ "Whether to re-use the same comint buffer for focussed tests.")
+
;;;###autoload
(defun ruby-compilation-run (cmd)
"Run a ruby process dumping output to a ruby compilation buffer."
@@ -151,13 +154,20 @@
(interactive)
(let ((test-name (ruby-compilation-this-test-name)))
(pop-to-buffer (ruby-compilation-do
- (format "ruby: %s - %s"
- (file-name-nondirectory (buffer-file-name))
- test-name)
+ (ruby-compilation-this-test-buffer-name test-name)
(list ruby-compilation-executable
(buffer-file-name)
ruby-compilation-test-name-flag test-name)))))
+(defun ruby-compilation-this-test-buffer-name (test-name)
+ "The name of the buffer in which test-at-point will run."
+ (interactive)
+ (if ruby-compilation-reuse-buffers
+ (file-name-nondirectory (buffer-file-name))
+ (format "ruby: %s - %s"
+ (file-name-nondirectory (buffer-file-name))
+ test-name)))
+
(defun ruby-compilation-this-test-name ()
"Which test are we currently in?"
(let ((this-test (which-function)))

0 comments on commit b036e2f

Please sign in to comment.