aboutsummaryrefslogtreecommitdiffhomepage
path: root/coq/coq-smie.el
diff options
context:
space:
mode:
authorGravatar Pierre Courtieu <Pierre.Courtieu@cnam.fr>2016-01-14 16:04:50 +0100
committerGravatar Pierre Courtieu <Pierre.Courtieu@cnam.fr>2016-01-14 16:04:50 +0100
commitece7af6fc988d835de9b16fc1bb67f5762bb6aad (patch)
treee3b3fb8f7f550563cc5d65310d7c650c4b7a65a3 /coq/coq-smie.el
parente9e2f7ec5f50916e11b44162762f30f1f6a2b659 (diff)
Fix #29 + indentation glitch + regexp refactoring.
Diffstat (limited to 'coq/coq-smie.el')
-rw-r--r--coq/coq-smie.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/coq/coq-smie.el b/coq/coq-smie.el
index 403dc4a8..a609727a 100644
--- a/coq/coq-smie.el
+++ b/coq/coq-smie.el
@@ -958,6 +958,7 @@ KIND is the situation and TOKEN is the thing w.r.t which the rule applies."
;; tac1 ; <-- no indentation here
;; now ( tac3 ; <- neither here
;; tac5) ;
+ ;; ]
((and (equal token "; tactic")
coq-indent-semicolon-tactical
(not (coq-smie-is-ltacdef))
@@ -974,13 +975,19 @@ KIND is the situation and TOKEN is the thing w.r.t which the rule applies."
((equal token "} subproof") (smie-rule-parent))
- ; using user customized variable to set indentation of modules,
- ; section and proofs.
+ ;; proofstart is a special hack, since "." should be used as a
+ ;; separator between commands, here it is recognized as an open
+ ;; parenthesis, hence the current command (C) ending with "."
+ ;; is not recognized as correctly terminated. The "parent"
+ ;; computed by smie is therefore wrong and default indetation
+ ;; is broken. We fix this by indenting from the real-start of
+ ;; the command terminated by ". proofstart".
((equal token ". proofstart")
- (smie-rule-parent coq-indent-proofstart))
+ (save-excursion (forward-char -1) (coq-find-real-start)
+ `(column . ,(+ coq-indent-modulestart (current-column)))))
((equal token ". modulestart")
- (smie-rule-parent coq-indent-modulestart))
- ))
+ (save-excursion (forward-char -1) (coq-find-real-start)
+ `(column . ,(+ coq-indent-modulestart (current-column)))))))
(:before
(cond