Function: lua-goto-matching-block

lua-goto-matching-block is an interactive and byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-goto-matching-block &optional NOREPORT)

Documentation

Go to the keyword balancing the one under the point.

If the point is on a keyword/brace that starts a block, go to the matching keyword that ends the block, and vice versa.

If optional NOREPORT is non-nil, it won't flag an error if there is no block open/close open.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-goto-matching-block (&optional noreport)
  "Go to the keyword balancing the one under the point.
If the point is on a keyword/brace that starts a block, go to the
matching keyword that ends the block, and vice versa.

If optional NOREPORT is non-nil, it won't flag an error if there is no
block open/close open."
  (interactive)
  ;; Search backward to the beginning of the keyword if necessary
  (when (and (eq (char-syntax (following-char)) ?w)
             (not (looking-at "\\_<")))
    (re-search-backward "\\_<" nil t))
  (if-let* ((position (lua-goto-matching-block-token)))
      position
    (unless noreport (error "Not on a block control keyword or brace"))))