# HG changeset patch # User Sam Steingold # Date 1228431879 0 # Node ID 82d19f721db4fca9d896a1c3d659aabfb33b70f1 # Parent cff49a74123174b68d225d9dae8e999785b96528 (compilation-read-command): Extracted from compile. (compile): Use it. (recompile): Accept an optional argument to enable editing the command line. diff -r cff49a741231 -r 82d19f721db4 lisp/ChangeLog --- a/lisp/ChangeLog Thu Dec 04 22:54:48 2008 +0000 +++ b/lisp/ChangeLog Thu Dec 04 23:04:39 2008 +0000 @@ -1,3 +1,11 @@ +2008-12-04 Sam Steingold + + * progmodes/compile.el (compilation-read-command): Extracted from + compile. + (compile): Use it. + (recompile): Accept an optional argument to enable editing the + command line. + 2008-12-04 Michael Albinus * net/tramp.el (top): Write a message, when loading Tramp. diff -r cff49a741231 -r 82d19f721db4 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Thu Dec 04 22:54:48 2008 +0000 +++ b/lisp/progmodes/compile.el Thu Dec 04 23:04:39 2008 +0000 @@ -1019,6 +1019,12 @@ compilation-mode-font-lock-keywords))) +(defun compilation-read-command (command) + (read-shell-command "Compile command: " command + (if (equal (car compile-history) command) + '(compile-history . 1) + 'compile-history))) + ;;;###autoload (defun compile (command &optional comint) @@ -1052,10 +1058,7 @@ (list (let ((command (eval compile-command))) (if (or compilation-read-command current-prefix-arg) - (read-shell-command "Compile command: " command - (if (equal (car compile-history) command) - '(compile-history . 1) - 'compile-history)) + (compilation-read-command command) command)) (consp current-prefix-arg))) (unless (equal command (eval compile-command)) @@ -1065,13 +1068,17 @@ (compilation-start command comint)) ;; run compile with the default command line -(defun recompile () +(defun recompile (&optional edit-command) "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, recompile using `compile-command'." - (interactive) +original use. Otherwise, recompile using `compile-command'. +If the optional argument `edit-command' is non-nil, the command can be edited." + (interactive "P") (save-some-buffers (not compilation-ask-about-save) nil) (let ((default-directory (or compilation-directory default-directory))) + (when edit-command + (setcar compilation-arguments + (compilation-read-command (car compilation-arguments)))) (apply 'compilation-start (or compilation-arguments `(,(eval compile-command))))))