aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Martin-Dorel2019-04-19 11:40:52 +0200
committerGitHub2019-04-19 11:40:52 +0200
commit946be87a944c9d8b850fdddb83d36e2ef9dad5c9 (patch)
treefd3eedea1e64a4ea6cb09d2ebd5d2f2e13c09137
parent612eac576472f405fc64af98d1f1c5a13cd5fb0a (diff)
parent0726820e39565e0cdb27254a99ab1df961a0fdf2 (diff)
Merge pull request #418 from SkySkimmer/clean-args
Clean -topfile for coq-prog-args properly
-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))))