emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/tuareg 862a088 1/2: Suppress bogus "Mismatched parentheses


From: ELPA Syncer
Subject: [nongnu] elpa/tuareg 862a088 1/2: Suppress bogus "Mismatched parentheses" at end of comment
Date: Fri, 3 Sep 2021 18:57:43 -0400 (EDT)

branch: elpa/tuareg
commit 862a088228496629637a8eff6b0a87699b43fcb2
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]