emacs-diffs
[Top][All Lists]
Advanced

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

master 4103b6c407: Fix sql-{beginning,end}-of-statement counting


From: Ingo Lohmar
Subject: master 4103b6c407: Fix sql-{beginning,end}-of-statement counting
Date: Sun, 6 Nov 2022 11:45:51 -0500 (EST)

branch: master
commit 4103b6c4079e94550e0e8434e21ad8504b9e3a7c
Author: Ingo Lohmar <ingo.lohmar@posteo.net>
Commit: Ingo Lohmar <ingo.lohmar@posteo.net>

    Fix sql-{beginning,end}-of-statement counting
    
    * lisp/progmodes/sql.el (sql-beginning-of-statement, sql-end-of-statement):
    Do not count statement separators if inside a string.
---
 lisp/progmodes/sql.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index b950f93f2a..4121e4dc3c 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3030,9 +3030,10 @@ displayed."
 
     ;; Our start must be between them
     (goto-char last)
-    ;; Find a beginning-of-stmt that's not in a comment
+    ;; Find a beginning-of-stmt that's not in a string or comment
     (while (and (re-search-forward regexp next t 1)
-                (nth 7 (syntax-ppss)))
+                (or (nth 3 (syntax-ppss))
+                    (nth 7 (syntax-ppss))))
       (goto-char (match-end 0)))
     (goto-char
      (if (match-data)
@@ -3062,8 +3063,9 @@ displayed."
       ;; If we found another end-of-stmt
       (if (not (apply re-search term nil t n nil))
           (setq arg 0)
-        ;; count it if we're not in a comment
-        (unless (nth 7 (syntax-ppss))
+        ;; count it if we're not in a string or comment
+        (unless (or (nth 3 (syntax-ppss))
+                    (nth 7 (syntax-ppss)))
           (setq arg (- arg (cl-signum arg))))))
     (goto-char (if (match-data)
                    (match-end 0)



reply via email to

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