comparison 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
comparison
equal deleted inserted replaced
94565:fe81b2cb42e0 94566:c31e26fe0b1f
1157 (error "Cannot have two processes in `%s' at once" 1157 (error "Cannot have two processes in `%s' at once"
1158 (buffer-name))))) 1158 (buffer-name)))))
1159 (buffer-disable-undo (current-buffer)) 1159 (buffer-disable-undo (current-buffer))
1160 ;; first transfer directory from where M-x compile was called 1160 ;; first transfer directory from where M-x compile was called
1161 (setq default-directory thisdir) 1161 (setq default-directory thisdir)
1162 ;; Remember the original dir, so we can use it when we recompile.
1163 ;; default-directory' can't be used reliably for that because it may be
1164 ;; affected by the special handling of "cd ...;".
1165 (set (make-local-variable 'compilation-directory) thisdir)
1166 ;; Make compilation buffer read-only. The filter can still write it. 1162 ;; Make compilation buffer read-only. The filter can still write it.
1167 ;; Clear out the compilation buffer. 1163 ;; Clear out the compilation buffer.
1168 (let ((inhibit-read-only t) 1164 (let ((inhibit-read-only t)
1169 (default-directory thisdir)) 1165 (default-directory thisdir))
1170 ;; Then evaluate a cd command if any, but don't perform it yet, else 1166 ;; Then evaluate a cd command if any, but don't perform it yet, else
1180 (if (not (eq mode t)) 1176 (if (not (eq mode t))
1181 (funcall mode) 1177 (funcall mode)
1182 (setq buffer-read-only nil) 1178 (setq buffer-read-only nil)
1183 (with-no-warnings (comint-mode)) 1179 (with-no-warnings (comint-mode))
1184 (compilation-shell-minor-mode)) 1180 (compilation-shell-minor-mode))
1181 ;; Remember the original dir, so we can use it when we recompile.
1182 ;; default-directory' can't be used reliably for that because it may be
1183 ;; affected by the special handling of "cd ...;".
1184 ;; NB: must be fone after (funcall mode) as that resets local variables
1185 (set (make-local-variable 'compilation-directory) thisdir)
1185 (if highlight-regexp 1186 (if highlight-regexp
1186 (set (make-local-variable 'compilation-highlight-regexp) 1187 (set (make-local-variable 'compilation-highlight-regexp)
1187 highlight-regexp)) 1188 highlight-regexp))
1188 (if (or compilation-auto-jump-to-first-error 1189 (if (or compilation-auto-jump-to-first-error
1189 (eq compilation-scroll-output 'first-error)) 1190 (eq compilation-scroll-output 'first-error))