From d45bad350834876a0b7e625039313bd1f643c50b Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Fri, 14 Dec 2018 18:24:21 +0100 Subject: Fixes the fix of #407. Is this temporary. This fix is not completely satisfying for the following reason: 1- I had to add a new hook in generic code. But I don't see how we could avoid this: the computation of options must happen AFTER the proof-prog-name is asked to the user, because this computation depends on the version of coq. 2- We should fix the synchronization between coq-prog-name and proof-prog-name. Either remove coq-prog-name and use only proof-prog-name, or have the generic coq always point to some (proof-ass-sym prog-name). --- coq/coq-system.el | 10 ++++++++++ generic/proof-shell.el | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/coq/coq-system.el b/coq/coq-system.el index 28c73ae7..e89a0fdb 100644 --- a/coq/coq-system.el +++ b/coq/coq-system.el @@ -618,6 +618,16 @@ Does nothing if `coq-use-project-file' is nil." 'coq-load-project-file nil t))) +; detecting coqtop args should happen at the last moment before +; calling the process. In particular it should ahppen after that +; proof-prog-name-ask is performed, this hook is at the right place. +(add-hook 'proof-shell-before-process-hook + '(lambda () + ;; It seems coq-prog-name and proof-prog-name are not correctly linked + ;; so let us make sure they are the same before computing options + (setq coq-prog-name proof-prog-name) + (setq coq-prog-args (coq-prog-args)))) + ;; smie's parenthesis blinking is too slow, let us have the default one back (add-hook 'coq-mode-hook '(lambda () diff --git a/generic/proof-shell.el b/generic/proof-shell.el index a176283d..6287629c 100644 --- a/generic/proof-shell.el +++ b/generic/proof-shell.el @@ -295,6 +295,10 @@ In this case `proof-shell-filter' must be called again after it finished.") (setq string (replace-match "" t t string))) string) +(defvar proof-shell-before-process-hook nil + "Functions run from `proof-shell-start' just before + starting the prover process. Last chance to modify + xxx-prog-args and xxx-prog-name") (defun proof-shell-start () "Initialise a shell-like buffer for a proof assistant. @@ -321,6 +325,10 @@ process command." (setq proof-prog-name (proof-strip-whitespace-at-end (read-shell-command "Run process: " prog-name))))) + ;; Once proof-prog-name is set (possibly asked to the user by the + ;; code above), some final option setting may need to be done. + (run-hooks 'proof-shell-before-process-hook) + (let ((proc (downcase proof-assistant))) -- cgit v1.2.3