emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 46db98ece2: Recognize \' as a quoted quote in MySQL


From: Lars Ingebrigtsen
Subject: master 46db98ece2: Recognize \' as a quoted quote in MySQL
Date: Sun, 19 Jun 2022 09:32:22 -0400 (EDT)

branch: master
commit 46db98ece2cab6bac67c05aff1def9d910591cbb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Recognize \' as a quoted quote in MySQL
    
    * lisp/progmodes/sql.el (sql-mode): Recognize \' as a quoted quote
    in MySQL (bug#38302).
---
 lisp/progmodes/sql.el | 49 +++++++++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 8d25986090..ef8375e859 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]