summaryrefslogtreecommitdiff
path: root/lisp/progmodes/sql.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-04-08 15:45:07 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-04-09 12:28:58 +0200
commit8b3748c234e8be8c2b34c263cb216fef5a5f2279 (patch)
tree7b1890a90e0866c0b7121964d5531c243c816df3 /lisp/progmodes/sql.el
parent40c2bfdae198100a4be3a8b25e0722fd7c953516 (diff)
downloademacs-8b3748c234e8be8c2b34c263cb216fef5a5f2279.tar.gz
Fix sql-mode comment-end parsing
* lisp/progmodes/sql.el (sql-mode): Fix /* ... -*/ parsing (bug#54769).
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r--lisp/progmodes/sql.el13
1 files changed, 12 insertions, 1 deletions
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