]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix sql-mode comment-end parsing
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 8 Apr 2022 13:45:07 +0000 (15:45 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 9 Apr 2022 10:28:58 +0000 (12:28 +0200)
* lisp/progmodes/sql.el (sql-mode): Fix /* ... -*/ parsing
(bug#54769).

lisp/progmodes/sql.el

index 69d16a4357ec08c2101c47b2a51ada0909bd3c48..13fba0c7058591e40f60ab8b7ca99688dde69468 100644 (file)
@@ -4195,7 +4195,18 @@ must tell Emacs.  Here's how to do that in your init file:
                    nil)))
                ;; Propertize rules to not have /- and -* start comments.
                ("\\(/-\\)" (1 "."))
-               ("\\(-\\*\\)" (1 "."))))
+               ("\\(-\\*\\)"
+                (1
+                 (if (save-excursion
+                       (not (ppss-comment-depth
+                             (syntax-ppss (match-beginning 1)))))
+                     ;; If we're outside a comment, we don't let -*
+                     ;; start a comment.
+                    (string-to-syntax ".")
+                   ;; Inside a comment, ignore it to avoid -*/ not
+                   ;; being intepreted as a comment end.
+                   (forward-char -1)
+                   nil)))))
   ;; Set syntax and font-face highlighting
   ;; Catch changes to sql-product and highlight accordingly
   (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591