Function: sqlind-beginning-of-statement

sqlind-beginning-of-statement is an interactive and natively compiled function defined in sql-indent.el.

Signature

(sqlind-beginning-of-statement)

Documentation

Move point to the beginning of the current statement.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-beginning-of-statement ()
  "Move point to the beginning of the current statement."
  (interactive)

  (goto-char
   (or
    ;; If we are inside a paranthesis expression, the start is the start of
    ;; that expression.
    (let ((ppss (syntax-ppss (point))))
      (when (> (nth 0 ppss) 0)
        (nth 1 ppss)))
    ;; Look for an ordinary statement start
    (or (sqlind-beginning-of-statement-1 sqlind-search-limit)
        ;; Fall back on the search limit
        sqlind-search-limit)
    ;; ... or point-min
    (point-min)))

  ;; a loop keyword might be part of an "end loop" statement, in that case,
  ;; the statement starts with the "end" keyword.  we use skip-syntax-backward
  ;; so we won't skip over a semicolon (;)
  (let ((pos (point)))
    (skip-syntax-backward "w")
    (if (looking-at "loop")
        (progn
          (forward-word -1)
          (if (looking-at "\\bend\\b")
              (goto-char (match-beginning 0))
            (goto-char pos)))
      (goto-char pos)))

  ;; now skip over any whitespace and comments until we find the first
  ;; character that is program code.
  (sqlind-forward-syntactic-ws))