--- tex-buf.el.~1.285.~	2010-04-17 14:00:59.000000000 +0200
+++ tex-buf.el	2010-12-11 12:57:56.190875001 +0100
@@ -86,13 +86,18 @@
 		   TeX-file-extensions))
 
 (defun TeX-command-master (&optional override-confirm)
-  "Run command on the current document.
+  "Run command on the current document if
+ `TeX-master-compilation' is non-nil, on the current buffer
+ otherwise.
 
 If a prefix argument OVERRIDE-CONFIRM is given, confirmation will
 depend on it being positive instead of the entry in `TeX-command-list'."
   (interactive "P")
-  (TeX-command (TeX-command-query (TeX-master-file)) 'TeX-master-file
-	       override-confirm))
+  (if TeX-master-compilation
+      (TeX-command (TeX-command-query (TeX-master-file)) 'TeX-master-file
+		   override-confirm)
+    (TeX-command-buffer override-confirm)))
+    
 
 (defvar TeX-command-region-begin nil)
 (defvar TeX-command-region-end nil)
