diff options
| author | Sam Steingold | 2008-12-04 23:04:39 +0000 |
|---|---|---|
| committer | Sam Steingold | 2008-12-04 23:04:39 +0000 |
| commit | 430aee8b9142404f8a6052797d0ee2df493534b9 (patch) | |
| tree | dbca2cad53a1b7b96ca90c0c7fc30114baf21f6a | |
| parent | 0143335b9abdb54d0be534f35e4ca4cfd87f7e05 (diff) | |
| download | emacs-430aee8b9142404f8a6052797d0ee2df493534b9.tar.gz emacs-430aee8b9142404f8a6052797d0ee2df493534b9.zip | |
(compilation-read-command): Extracted from compile.
(compile): Use it.
(recompile): Accept an optional argument to enable editing the command line.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 21 |
2 files changed, 22 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 53a9806f613..32393579676 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2008-12-04 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/compile.el (compilation-read-command): Extracted from | ||
| 4 | compile. | ||
| 5 | (compile): Use it. | ||
| 6 | (recompile): Accept an optional argument to enable editing the | ||
| 7 | command line. | ||
| 8 | |||
| 1 | 2008-12-04 Michael Albinus <michael.albinus@gmx.de> | 9 | 2008-12-04 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 10 | ||
| 3 | * net/tramp.el (top): Write a message, when loading Tramp. | 11 | * net/tramp.el (top): Write a message, when loading Tramp. |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 9133f6e0231..0f9800acc06 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1019,6 +1019,12 @@ FMTS is a list of format specs for transforming the file name. | |||
| 1019 | 1019 | ||
| 1020 | compilation-mode-font-lock-keywords))) | 1020 | compilation-mode-font-lock-keywords))) |
| 1021 | 1021 | ||
| 1022 | (defun compilation-read-command (command) | ||
| 1023 | (read-shell-command "Compile command: " command | ||
| 1024 | (if (equal (car compile-history) command) | ||
| 1025 | '(compile-history . 1) | ||
| 1026 | 'compile-history))) | ||
| 1027 | |||
| 1022 | 1028 | ||
| 1023 | ;;;###autoload | 1029 | ;;;###autoload |
| 1024 | (defun compile (command &optional comint) | 1030 | (defun compile (command &optional comint) |
| @@ -1052,10 +1058,7 @@ to a function that generates a unique name." | |||
| 1052 | (list | 1058 | (list |
| 1053 | (let ((command (eval compile-command))) | 1059 | (let ((command (eval compile-command))) |
| 1054 | (if (or compilation-read-command current-prefix-arg) | 1060 | (if (or compilation-read-command current-prefix-arg) |
| 1055 | (read-shell-command "Compile command: " command | 1061 | (compilation-read-command command) |
| 1056 | (if (equal (car compile-history) command) | ||
| 1057 | '(compile-history . 1) | ||
| 1058 | 'compile-history)) | ||
| 1059 | command)) | 1062 | command)) |
| 1060 | (consp current-prefix-arg))) | 1063 | (consp current-prefix-arg))) |
| 1061 | (unless (equal command (eval compile-command)) | 1064 | (unless (equal command (eval compile-command)) |
| @@ -1065,13 +1068,17 @@ to a function that generates a unique name." | |||
| 1065 | (compilation-start command comint)) | 1068 | (compilation-start command comint)) |
| 1066 | 1069 | ||
| 1067 | ;; run compile with the default command line | 1070 | ;; run compile with the default command line |
| 1068 | (defun recompile () | 1071 | (defun recompile (&optional edit-command) |
| 1069 | "Re-compile the program including the current buffer. | 1072 | "Re-compile the program including the current buffer. |
| 1070 | If this is run in a Compilation mode buffer, re-use the arguments from the | 1073 | If this is run in a Compilation mode buffer, re-use the arguments from the |
| 1071 | original use. Otherwise, recompile using `compile-command'." | 1074 | original use. Otherwise, recompile using `compile-command'. |
| 1072 | (interactive) | 1075 | If the optional argument `edit-command' is non-nil, the command can be edited." |
| 1076 | (interactive "P") | ||
| 1073 | (save-some-buffers (not compilation-ask-about-save) nil) | 1077 | (save-some-buffers (not compilation-ask-about-save) nil) |
| 1074 | (let ((default-directory (or compilation-directory default-directory))) | 1078 | (let ((default-directory (or compilation-directory default-directory))) |
| 1079 | (when edit-command | ||
| 1080 | (setcar compilation-arguments | ||
| 1081 | (compilation-read-command (car compilation-arguments)))) | ||
| 1075 | (apply 'compilation-start (or compilation-arguments | 1082 | (apply 'compilation-start (or compilation-arguments |
| 1076 | `(,(eval compile-command)))))) | 1083 | `(,(eval compile-command)))))) |
| 1077 | 1084 | ||