summaryrefslogtreecommitdiff
path: root/lisp/progmodes/sql.el
diff options
context:
space:
mode:
authorIngo Lohmar <ingo.lohmar@posteo.net>2022-11-06 17:31:05 +0100
committerIngo Lohmar <ingo.lohmar@posteo.net>2022-11-06 17:31:05 +0100
commit4103b6c4079e94550e0e8434e21ad8504b9e3a7c (patch)
tree0188fffed46d40a2cdbb10dfd4ba0f2c6a2ea5b3 /lisp/progmodes/sql.el
parente46f6804892ad67a5fbfd096da568d86f0a4a2f8 (diff)
downloademacs-4103b6c4079e94550e0e8434e21ad8504b9e3a7c.tar.gz
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.
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r--lisp/progmodes/sql.el10
1 files 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)