summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@is.elta.co.il>2004-02-16 12:53:25 +0000
committerEli Zaretskii <eliz@is.elta.co.il>2004-02-16 12:53:25 +0000
commitebb8cb682a16160f5b2db373f5e7276dd74f1892 (patch)
tree3d157209c6f60232a5011b774f14927ec47d70ba /lisp
parenta71b3805cd48d60dc80ace3da006195235152d31 (diff)
downloademacs-ebb8cb682a16160f5b2db373f5e7276dd74f1892.tar.gz
emacs-ebb8cb682a16160f5b2db373f5e7276dd74f1892.tar.bz2
emacs-ebb8cb682a16160f5b2db373f5e7276dd74f1892.zip
(compilation-directory): New defvar.
(compile): Save current directory in compilation-directory. (recompile): Bind default-directory to compilation-directory if that is non-nil.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/compile.el10
2 files changed, 15 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4176661ca90..096169d8c5b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-16 Alfred M. Szmidt <ams@kemisten.nu> (tiny change)
+
+ * progmodes/compile.el (compilation-directory): New defvar.
+ (compile): Save current directory in compilation-directory.
+ (recompile): Bind default-directory to compilation-directory if
+ that is non-nil.
+
2004-02-16 Dave Love <fx@gnu.org>
* newcomment.el (comment-insert-comment-function)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index de050411411..5f9ffbf2c33 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -386,6 +386,9 @@ If any FILE-FORMAT is given, each is a format string to produce a file name to
try; %s in the string is replaced by the text matching the FILE-IDX'th
subexpression.")
+(defvar compilation-directory nil
+ "Directory to restore to when doing `recompile'.")
+
(defvar compilation-enter-directory-regexp-alist
'(
;; Matches lines printed by the `-w' option of GNU Make.
@@ -578,6 +581,7 @@ to a function that generates a unique name."
(unless (equal command (eval compile-command))
(setq compile-command command))
(save-some-buffers (not compilation-ask-about-save) nil)
+ (setq compilation-directory default-directory)
(compile-internal command "No more errors"))
;; run compile with the default command line
@@ -587,8 +591,10 @@ 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)
- (apply 'compile-internal (or compilation-arguments
- `(,(eval compile-command) "No more errors"))))
+ (let ((default-directory (or compilation-directory default-directory)))
+ (apply 'compile-internal (or compilation-arguments
+ `(,(eval compile-command)
+ "No more errors")))))
(defcustom compilation-scroll-output nil
"*Non-nil to scroll the *compilation* buffer window as output appears.