aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-06-19 15:31:04 +0200
committerLars Ingebrigtsen2022-06-19 15:31:04 +0200
commit46db98ece2cab6bac67c05aff1def9d910591cbb (patch)
tree7c84f4603c9504188863dc8ef18d21681b44e8d4
parent94d76adde1b4b2bd86168f8d703241f60d1749b2 (diff)
downloademacs-46db98ece2cab6bac67c05aff1def9d910591cbb.tar.gz
emacs-46db98ece2cab6bac67c05aff1def9d910591cbb.zip
Recognize \' as a quoted quote in MySQL
* lisp/progmodes/sql.el (sql-mode): Recognize \' as a quoted quote in MySQL (bug#38302).
-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:
4161 (setq-local sql-contains-names t) 4161 (setq-local sql-contains-names t)
4162 (setq-local escaped-string-quote "'") 4162 (setq-local escaped-string-quote "'")
4163 (setq-local syntax-propertize-function 4163 (setq-local syntax-propertize-function
4164 (syntax-propertize-rules 4164 (eval
4165 ;; Handle escaped apostrophes within strings. 4165 '(syntax-propertize-rules
4166 ("''" 4166 ;; Handle escaped apostrophes within strings.
4167 (0 4167 ((if (eq sql-product 'mysql)
4168 (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) 4168 "\\\\'"
4169 (string-to-syntax ".") 4169 "''")
4170 (forward-char -1) 4170 (0
4171 nil))) 4171 (if (save-excursion
4172 ;; Propertize rules to not have /- and -* start comments. 4172 (nth 3 (syntax-ppss (match-beginning 0))))
4173 ("\\(/-\\)" (1 ".")) 4173 (string-to-syntax ".")
4174 ("\\(-\\*\\)" 4174 (forward-char -1)
4175 (1 4175 nil)))
4176 (if (save-excursion 4176 ;; Propertize rules to not have /- and -* start comments.
4177 (not (ppss-comment-depth 4177 ("\\(/-\\)" (1 "."))
4178 (syntax-ppss (match-beginning 1))))) 4178 ("\\(-\\*\\)"
4179 ;; If we're outside a comment, we don't let -* 4179 (1
4180 ;; start a comment. 4180 (if (save-excursion
4181 (string-to-syntax ".") 4181 (not (ppss-comment-depth
4182 ;; Inside a comment, ignore it to avoid -*/ not 4182 (syntax-ppss (match-beginning 1)))))
4183 ;; being interpreted as a comment end. 4183 ;; If we're outside a comment, we don't let -*
4184 (forward-char -1) 4184 ;; start a comment.
4185 nil))))) 4185 (string-to-syntax ".")
4186 ;; Inside a comment, ignore it to avoid -*/ not
4187 ;; being interpreted as a comment end.
4188 (forward-char -1)
4189 nil))))
4190 t))
4186 ;; Set syntax and font-face highlighting 4191 ;; Set syntax and font-face highlighting
4187 ;; Catch changes to sql-product and highlight accordingly 4192 ;; Catch changes to sql-product and highlight accordingly
4188 (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591 4193 (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591