branch: elpa/tuareg commit 862a088228496629637a8eff6b0a87699b43fcb2 Author: Mattias EngdegÄrd <matti...@acm.org> Commit: Mattias EngdegÄrd <matti...@acm.org>
Suppress bogus "Mismatched parentheses" at end of comment Partially fixes #269. --- tuareg.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tuareg.el b/tuareg.el index fb9d76b..48069b4 100644 --- a/tuareg.el +++ b/tuareg.el @@ -3028,12 +3028,26 @@ expansion at run-time, if the run-time version of Emacs does know this macro." (if (equal "->" (nth 2 (smie-forward-sexp "-dlpd-"))) (smie-indent-forward-token)))) +(defun tuareg--blink-matching-check (start end) + (let ((pt (point))) + (if (and (> pt (+ (point-min) 3)) + (eq (char-before) ?\)) + (eq (char-before (1- pt)) ?*) + (save-excursion + (and (forward-comment -1) + (forward-comment 1) + (eq (point) pt)))) + ;; Immediately after a comment-ending "*)" -- no mismatch error. + nil + (smie-blink-matching-check start end)))) + (defun tuareg--common-mode-setup () (setq-local syntax-propertize-function #'tuareg-syntax-propertize) (setq-local parse-sexp-ignore-comments t) (smie-setup tuareg-smie-grammar #'tuareg-smie-rules :forward-token #'tuareg-smie-forward-token :backward-token #'tuareg-smie-backward-token) + (setq-local blink-matching-check-function #'tuareg--blink-matching-check) (tuareg--eval-when-macrop add-function (when (boundp 'smie--hanging-eolp-function) ;; FIXME: As its name implies, smie--hanging-eolp-function