diff options
| author | Sam Steingold | 2010-04-07 12:20:35 -0400 |
|---|---|---|
| committer | Sam Steingold | 2010-04-07 12:20:35 -0400 |
| commit | 9e86ab0bc776f59ca97bd1487af0b38364d5ec5b (patch) | |
| tree | 7198654f447ca6eb7e88a62109c6c4e12b5797b1 | |
| parent | 42d3cab7add8b7f86254ddc8135495e1afc8e967 (diff) | |
| download | emacs-9e86ab0bc776f59ca97bd1487af0b38364d5ec5b.tar.gz emacs-9e86ab0bc776f59ca97bd1487af0b38364d5ec5b.zip | |
(compilation-save-buffers-predicate): New custom variable.
(compile, recompile): Pass it to `save-some-buffers'.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 21 |
2 files changed, 25 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ad2f6cf56ee..6cdaaf2255b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-04-07 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/compile.el (compilation-save-buffers-predicate): New | ||
| 4 | custom variable. | ||
| 5 | (compile, recompile): Pass it to `save-some-buffers'. | ||
| 6 | |||
| 1 | 2010-04-07 Jan Djärv <jan.h.d@swipnet.se> | 7 | 2010-04-07 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 8 | ||
| 3 | * wid-edit.el (widget-choose): Move cursor to the second line of | 9 | * wid-edit.el (widget-choose): Move cursor to the second line of |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 51e42809153..5fc4a5f99df 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -584,6 +584,21 @@ Otherwise, it saves all modified buffers without asking." | |||
| 584 | :group 'compilation) | 584 | :group 'compilation) |
| 585 | 585 | ||
| 586 | ;;;###autoload | 586 | ;;;###autoload |
| 587 | (defcustom compilation-save-buffers-predicate nil | ||
| 588 | "The second argument (PRED) passed to `save-some-buffers' before compiling. | ||
| 589 | E.g., one can set this to | ||
| 590 | (lambda () | ||
| 591 | (string-prefix-p my-compilation-root (file-truename (buffer-file-name)))) | ||
| 592 | to limit saving to files located under `my-compilation-root'. | ||
| 593 | Note, that, in general, `compilation-directory' cannot be used instead | ||
| 594 | of `my-compilation-root' here." | ||
| 595 | :type '(choice | ||
| 596 | (const :tag "Default (save all file-visiting buffers)" nil) | ||
| 597 | (const :tag "Save all buffers" t) | ||
| 598 | function) | ||
| 599 | :group 'compilation) | ||
| 600 | |||
| 601 | ;;;###autoload | ||
| 587 | (defcustom compilation-search-path '(nil) | 602 | (defcustom compilation-search-path '(nil) |
| 588 | "List of directories to search for source files named in error messages. | 603 | "List of directories to search for source files named in error messages. |
| 589 | Elements should be directory names, not file names of directories. | 604 | Elements should be directory names, not file names of directories. |
| @@ -1097,7 +1112,8 @@ to a function that generates a unique name." | |||
| 1097 | (consp current-prefix-arg))) | 1112 | (consp current-prefix-arg))) |
| 1098 | (unless (equal command (eval compile-command)) | 1113 | (unless (equal command (eval compile-command)) |
| 1099 | (setq compile-command command)) | 1114 | (setq compile-command command)) |
| 1100 | (save-some-buffers (not compilation-ask-about-save) nil) | 1115 | (save-some-buffers (not compilation-ask-about-save) |
| 1116 | compilation-save-buffers-predicate) | ||
| 1101 | (setq-default compilation-directory default-directory) | 1117 | (setq-default compilation-directory default-directory) |
| 1102 | (compilation-start command comint)) | 1118 | (compilation-start command comint)) |
| 1103 | 1119 | ||
| @@ -1108,7 +1124,8 @@ If this is run in a Compilation mode buffer, re-use the arguments from the | |||
| 1108 | original use. Otherwise, recompile using `compile-command'. | 1124 | original use. Otherwise, recompile using `compile-command'. |
| 1109 | If the optional argument `edit-command' is non-nil, the command can be edited." | 1125 | If the optional argument `edit-command' is non-nil, the command can be edited." |
| 1110 | (interactive "P") | 1126 | (interactive "P") |
| 1111 | (save-some-buffers (not compilation-ask-about-save) nil) | 1127 | (save-some-buffers (not compilation-ask-about-save) |
| 1128 | compilation-save-buffers-predicate) | ||
| 1112 | (let ((default-directory (or compilation-directory default-directory))) | 1129 | (let ((default-directory (or compilation-directory default-directory))) |
| 1113 | (when edit-command | 1130 | (when edit-command |
| 1114 | (setcar compilation-arguments | 1131 | (setcar compilation-arguments |