From 8b3748c234e8be8c2b34c263cb216fef5a5f2279 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 8 Apr 2022 15:45:07 +0200 Subject: [PATCH] Fix sql-mode comment-end parsing * lisp/progmodes/sql.el (sql-mode): Fix /* ... -*/ parsing (bug#54769). --- lisp/progmodes/sql.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 69d16a4357e..13fba0c7058 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -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 -- 2.39.5