summaryrefslogtreecommitdiff
path: root/lisp/progmodes/sql.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-06-19 15:31:04 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-19 15:31:04 +0200
commit46db98ece2cab6bac67c05aff1def9d910591cbb (patch)
tree7c84f4603c9504188863dc8ef18d21681b44e8d4 /lisp/progmodes/sql.el
parent94d76adde1b4b2bd86168f8d703241f60d1749b2 (diff)
downloademacs-46db98ece2cab6bac67c05aff1def9d910591cbb.tar.gz
Recognize \' as a quoted quote in MySQL
* lisp/progmodes/sql.el (sql-mode): Recognize \' as a quoted quote in MySQL (bug#38302).
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r--lisp/progmodes/sql.el49
1 files changed, 27 insertions, 22 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 8d259860901..ef8375e859c 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4161,28 +4161,33 @@ must tell Emacs. Here's how to do that in your init file:
(setq-local sql-contains-names t)
(setq-local escaped-string-quote "'")
(setq-local syntax-propertize-function
- (syntax-propertize-rules
- ;; Handle escaped apostrophes within strings.
- ("''"
- (0
- (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0))))
- (string-to-syntax ".")
- (forward-char -1)
- nil)))
- ;; Propertize rules to not have /- and -* start comments.
- ("\\(/-\\)" (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 interpreted as a comment end.
- (forward-char -1)
- nil)))))
+ (eval
+ '(syntax-propertize-rules
+ ;; Handle escaped apostrophes within strings.
+ ((if (eq sql-product 'mysql)
+ "\\\\'"
+ "''")
+ (0
+ (if (save-excursion
+ (nth 3 (syntax-ppss (match-beginning 0))))
+ (string-to-syntax ".")
+ (forward-char -1)
+ nil)))
+ ;; Propertize rules to not have /- and -* start comments.
+ ("\\(/-\\)" (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 interpreted as a comment end.
+ (forward-char -1)
+ nil))))
+ t))
;; Set syntax and font-face highlighting
;; Catch changes to sql-product and highlight accordingly
(sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591