Function: sql-end-of-statement
sql-end-of-statement is an interactive and byte-compiled function
defined in sql.el.gz.
Signature
(sql-end-of-statement ARG)
Documentation
Move to the end of the current SQL statement.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
(defun sql-end-of-statement (arg)
"Move to the end of the current SQL statement."
(interactive "p")
(let ((term (or (sql-get-product-feature sql-product :terminator) ";"))
(re-search (if (> 0 arg) 're-search-backward 're-search-forward))
(here (point))
(n 0))
(when (consp term)
(setq term (car term)))
;; Iterate until we've moved the desired number of stmt ends
(while (not (= (cl-signum arg) 0))
;; if we're looking at the terminator, jump by 2
(if (or (and (> 0 arg) (looking-back term nil))
(and (< 0 arg) (looking-at term)))
(setq n 2)
(setq n 1))
;; 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 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)
here))))