diff lisp/progmodes/compile.el @ 94566:c31e26fe0b1f

* progmodes/compile.el (compilation-start): Move setting of compilation-directory after (funcall mode) as that resets local variables, this fixes recompile in grep buffers. * grep.el (grep-mode-map): Bind "g" to recompile (like in dired &c).
author Sam Steingold <sds@gnu.org>
date Fri, 02 May 2008 18:37:07 +0000
parents c444df26b274
children 77be8c29913f
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Fri May 02 18:32:18 2008 +0000
+++ b/lisp/progmodes/compile.el	Fri May 02 18:37:07 2008 +0000
@@ -1159,10 +1159,6 @@
       (buffer-disable-undo (current-buffer))
       ;; first transfer directory from where M-x compile was called
       (setq default-directory thisdir)
-      ;; Remember the original dir, so we can use it when we recompile.
-      ;; default-directory' can't be used reliably for that because it may be
-      ;; affected by the special handling of "cd ...;".
-      (set (make-local-variable 'compilation-directory) thisdir)
       ;; Make compilation buffer read-only.  The filter can still write it.
       ;; Clear out the compilation buffer.
       (let ((inhibit-read-only t)
@@ -1182,6 +1178,11 @@
 	  (setq buffer-read-only nil)
 	  (with-no-warnings (comint-mode))
 	  (compilation-shell-minor-mode))
+        ;; Remember the original dir, so we can use it when we recompile.
+        ;; default-directory' can't be used reliably for that because it may be
+        ;; affected by the special handling of "cd ...;".
+        ;; NB: must be fone after (funcall mode) as that resets local variables
+        (set (make-local-variable 'compilation-directory) thisdir)
 	(if highlight-regexp
 	    (set (make-local-variable 'compilation-highlight-regexp)
 		 highlight-regexp))