From 4103b6c4079e94550e0e8434e21ad8504b9e3a7c Mon Sep 17 00:00:00 2001 From: Ingo Lohmar Date: Sun, 6 Nov 2022 17:31:05 +0100 Subject: [PATCH] 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 b950f93f2a0..4121e4dc3cd 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) -- 2.39.2