aboutsummaryrefslogtreecommitdiff
path: root/coq
diff options
context:
space:
mode:
authorGaëtan Gilbert2019-04-04 12:07:09 +0200
committerGaëtan Gilbert2019-04-19 07:08:41 +0100
commit0726820e39565e0cdb27254a99ab1df961a0fdf2 (patch)
tree1e2fc20efbb5faddc130d7a669dbb9229d5ad64e /coq
parent8f90ac961c22099a615c03ed07576aaef820e06d (diff)
Clean -topfile for coq-prog-args properly
This makes it possible to run new and old coq versions consecutively without manually cleaning coq-prog-args.
Diffstat (limited to 'coq')
-rw-r--r--coq/coq-system.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/coq/coq-system.el b/coq/coq-system.el
index 44a774ae..839553e7 100644
--- a/coq/coq-system.el
+++ b/coq/coq-system.el
@@ -378,12 +378,24 @@ options of a few coq-project files does the right thing."
LOADPATH, CURRENT-DIRECTORY, PRE-V85: see `coq-include-options'."
(coq-include-options loadpath current-directory pre-v85))
+(defun coq--clean-prog-args (args)
+ "Return ARGS without the entries added by `coq-coqtop-prog-args'.
+
+Such entries are currently -emacs and -topfile."
+ (pcase args
+ ((or `("-emacs" . ,rest)
+ `("-topfile" . (,(pred (apply-partially #'equal buffer-file-name)) . ,rest)))
+ (coq--clean-prog-args rest))
+ (`(,car . ,cdr)
+ (cons car (coq--clean-prog-args cdr)))
+ (_ args)))
+
(defun coq-coqc-prog-args (loadpath &optional current-directory pre-v85)
"Build a list of options for coqc.
LOADPATH, CURRENT-DIRECTORY, PRE-V85: see `coq-include-options'."
;; coqtop always adds the current directory to the LoadPath, so don't
;; include it in the -Q options.
- (append (remove "-emacs" coq-prog-args)
+ (append (coq--clean-prog-args coq-prog-args)
(let ((coq-load-path-include-current nil)) ; Not needed in >=8.5beta3
(coq-coqdep-prog-args loadpath current-directory pre-v85))))