]> git.eshelyaron.com Git - emacs.git/commitdiff
(recompile): Use compilation-arguments if set, so as to be able to M-x
authorRichard M. Stallman <rms@gnu.org>
Wed, 14 Nov 2001 04:23:45 +0000 (04:23 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 14 Nov 2001 04:23:45 +0000 (04:23 +0000)
recompile the exact command which created a compilation-mode buffer.

lisp/progmodes/compile.el

index 2ab31cb764e4cf80f4e89abc3e277780c57d30b7..7e046c3ee033be4ba466f42307003adb5769af33 100644 (file)
@@ -580,10 +580,13 @@ to a function that generates a unique name."
 
 ;; run compile with the default command line
 (defun recompile ()
-  "Re-compile the program including the current buffer."
+  "Re-compile the program including the current buffer.
+If this is run in a compilation-mode buffer, re-use the arguments from the
+original use.  Otherwise, it recompiles using `compile-command'."
   (interactive)
   (save-some-buffers (not compilation-ask-about-save) nil)
-  (compile-internal (eval compile-command) "No more errors"))
+  (apply 'compile-internal (or compilation-arguments
+                             `(,(eval compile-command) "No more errors"))))
 
 (defun grep-process-setup ()
   "Set up `compilation-exit-message-function' for `grep'."