Commit 430aee8b authored by Sam Steingold's avatar Sam Steingold
Browse files

(compilation-read-command): Extracted from compile.

(compile): Use it.
(recompile): Accept an optional argument to enable editing the command line.
parent 0143335b
2008-12-04 Sam Steingold <sds@gnu.org>
* 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 <michael.albinus@gmx.de> 2008-12-04 Michael Albinus <michael.albinus@gmx.de>
   
* net/tramp.el (top): Write a message, when loading Tramp. * net/tramp.el (top): Write a message, when loading Tramp.
......
...@@ -1019,6 +1019,12 @@ FMTS is a list of format specs for transforming the file name. ...@@ -1019,6 +1019,12 @@ FMTS is a list of format specs for transforming the file name.
compilation-mode-font-lock-keywords))) 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 ;;;###autoload
(defun compile (command &optional comint) (defun compile (command &optional comint)
...@@ -1052,10 +1058,7 @@ to a function that generates a unique name." ...@@ -1052,10 +1058,7 @@ to a function that generates a unique name."
(list (list
(let ((command (eval compile-command))) (let ((command (eval compile-command)))
(if (or compilation-read-command current-prefix-arg) (if (or compilation-read-command current-prefix-arg)
(read-shell-command "Compile command: " command (compilation-read-command command)
(if (equal (car compile-history) command)
'(compile-history . 1)
'compile-history))
command)) command))
(consp current-prefix-arg))) (consp current-prefix-arg)))
(unless (equal command (eval compile-command)) (unless (equal command (eval compile-command))
...@@ -1065,13 +1068,17 @@ to a function that generates a unique name." ...@@ -1065,13 +1068,17 @@ to a function that generates a unique name."
(compilation-start command comint)) (compilation-start command comint))
;; run compile with the default command line ;; run compile with the default command line
(defun recompile () (defun recompile (&optional edit-command)
"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 If this is run in a Compilation mode buffer, re-use the arguments from the
original use. Otherwise, recompile using `compile-command'." original use. Otherwise, recompile using `compile-command'.
(interactive) 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) (save-some-buffers (not compilation-ask-about-save) nil)
(let ((default-directory (or compilation-directory default-directory))) (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 (apply 'compilation-start (or compilation-arguments
`(,(eval compile-command)))))) `(,(eval compile-command))))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment