Skip to content

Commit 224a938

Browse files
committed
par-compile: record and set current scripting buffer
Record the current scripting buffer when starting background compilation, pass it down the dependency tree, and set it as current buffer in all asynchronously called functions. This ensures that local variables and `default-directory' have correct values. Fixes ProofGeneral#797
1 parent c14e54f commit 224a938

File tree

3 files changed

+198
-160
lines changed

3 files changed

+198
-160
lines changed

ci/compile-tests/011-current-buffer/Makefile

+13-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,23 @@
1212
# internal states. compile-test-start-delayed outputs diagnostics on
1313
# file descriptor 9, which bypasses emacs and is joined with stderr of
1414
# the current make. Open file descriptor 9 here.
15+
#
16+
# To run not all tests, replace line
17+
#
18+
# -f ert-run-tests-batch-and-exit \
19+
#
20+
# with
21+
#
22+
# -eval '(ert-run-tests-batch-and-exit "pattern")' \
23+
#
24+
# where pattern should match the test names to run.
25+
1526
.PHONY: test
1627
test:
1728
$(MAKE) clean
1829
emacs -batch -l ../../../generic/proof-site.el -l ../cct-lib.el \
19-
-l runtest.el -f ert-run-tests-batch-and-exit \
30+
-l runtest.el \
31+
-f ert-run-tests-batch-and-exit \
2032
9>&1
2133

2234
.PHONY: clean

ci/compile-tests/011-current-buffer/runtest.el

+13-13
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ Hook function for `cct-after-busy-waiting-hook'. Switches back to
7777
;;; The tests itself
7878

7979
(ert-deftest test-current-buffer-vok ()
80-
:expected-result :failed
8180
"Check that second stage compilation uses the right local variables.
8281
Second stage compilation (vok and vio2vo) should use the local
8382
variables from the original scripting buffer, see also PG issue
@@ -100,8 +99,9 @@ variables from the original scripting buffer, see also PG issue
10099
(setq cdv-buffer (current-buffer))
101100
(set-buffer av-buffer)
102101

103-
(message (concat "coqdep: %s\ncoqc: %s\nPATH %s\n"
104-
"exec-path: %s\ndetected coq version: %s")
102+
(message (concat "Settings in a.v:\n"
103+
" coqdep: %s\n coqc: %s\n PATH %s\n"
104+
" exec-path: %s\n detected coq version: %s")
105105
coq-dependency-analyzer
106106
coq-compiler
107107
(getenv "PATH")
@@ -121,7 +121,7 @@ variables from the original scripting buffer, see also PG issue
121121
(message
122122
(concat "\nWait for 2nd stage (vok/vio2vo) compilation "
123123
"in buffer b.v with"
124-
"\ncoqdep: %s\ncoqc: %s")
124+
"\n coqdep: %s\n coqc: %s")
125125
coq-dependency-analyzer
126126
coq-compiler))
127127

@@ -147,7 +147,6 @@ variables from the original scripting buffer, see also PG issue
147147
(setq switch-buffer-while-waiting nil)))
148148

149149
(ert-deftest test-current-buffer-coqdep ()
150-
:expected-result :failed
151150
"Check that dependency analysis uses the right local variables.
152151
Dependency analysis during parallel background compilation (i.e.,
153152
runing `coqdep` on dependencies) should use the local variables
@@ -165,8 +164,9 @@ from the original scripting buffer, see also PG issue #797."
165164
(setq cdv-buffer (current-buffer))
166165
(set-buffer av-buffer)
167166

168-
(message (concat "coqdep: %s\ncoqc: %s\nPATH %s\n"
169-
"exec-path: %s\ndetected coq version: %s")
167+
(message (concat "Settings in a.v:\n"
168+
" coqdep: %s\n coqc: %s\n PATH %s\n"
169+
" exec-path: %s\n detected coq version: %s")
170170
coq-dependency-analyzer
171171
coq-compiler
172172
(getenv "PATH")
@@ -176,7 +176,7 @@ from the original scripting buffer, see also PG issue #797."
176176
(with-current-buffer cdv-buffer
177177
(message
178178
(concat "\nProcess a.v to end while visiting d.v with"
179-
"\ncoqdep: %s\ncoqc: %s")
179+
"\n coqdep: %s\n coqc: %s")
180180
coq-dependency-analyzer
181181
coq-compiler))
182182

@@ -201,7 +201,6 @@ from the original scripting buffer, see also PG issue #797."
201201
(setq switch-buffer-while-waiting nil)))
202202

203203
(ert-deftest test-current-buffer-coqc ()
204-
:expected-result :failed
205204
"Check that compilation of dependencies uses the right local variables.
206205
Compilation of dependencies during parallel background
207206
compilation (i.e., runing `coqc` on dependencies) should use the
@@ -224,8 +223,9 @@ switch to buffer c.v, which sets `coq-compiler' but leaves
224223
(setq cdv-buffer (current-buffer))
225224
(set-buffer av-buffer)
226225

227-
(message (concat "coqdep: %s\ncoqc: %s\nPATH %s\n"
228-
"exec-path: %s\ndetected coq version: %s")
226+
(message (concat "Settings in a.v:\n"
227+
" coqdep: %s\n coqc: %s\n PATH %s\n"
228+
" exec-path: %s\n detected coq version: %s")
229229
coq-dependency-analyzer
230230
coq-compiler
231231
(getenv "PATH")
@@ -235,8 +235,8 @@ switch to buffer c.v, which sets `coq-compiler' but leaves
235235
(with-current-buffer cdv-buffer
236236
(message (concat "\nProcess a.v to end, "
237237
"including compilation of dependency b.v\n"
238-
"while temporarily visiting c.v with\n"
239-
"coqdep: %s\ncoqc: %s")
238+
" while temporarily visiting c.v with\n"
239+
" coqdep: %s\n coqc: %s")
240240
coq-dependency-analyzer
241241
coq-compiler))
242242

0 commit comments

Comments
 (0)