# HG changeset patch # User Eli Zaretskii # Date 1076935824 0 # Node ID 227623e374e89b205e20ccac21858a1d6e551841 # Parent 980fc678e13c522a1fb3752497bd51be4d890144 (compilation-directory): New defvar. (compile): Save current directory in compilation-directory. (recompile): Bind default-directory to compilation-directory if that is non-nil. diff -r 980fc678e13c -r 227623e374e8 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Mon Feb 16 12:37:21 2004 +0000 +++ b/lisp/progmodes/compile.el Mon Feb 16 12:50:24 2004 +0000 @@ -386,6 +386,9 @@ 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 @@ (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 @@ 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.