Function: lua--goto-line-beginning-rightmost-closer

lua--goto-line-beginning-rightmost-closer is a byte-compiled function defined in lua-mode.el.gz.

Signature

(lua--goto-line-beginning-rightmost-closer &optional PARSE-START)

Documentation

Move point to the opening of the rightmost closing bracket at point.

The argument PARSE-START is a buffer position to start from.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua--goto-line-beginning-rightmost-closer (&optional parse-start)
  "Move point to the opening of the rightmost closing bracket at point.
The argument PARSE-START is a buffer position to start from."
  (let (case-fold-search pos line-end-pos return-val)
    (save-excursion
      (when parse-start (goto-char parse-start))
      (setq line-end-pos (line-end-position))
      (back-to-indentation)
      (unless (lua-comment-or-string-p)
        (cl-loop while (and (<= (point) line-end-pos)
                            (looking-at lua-indentation-modifier-regexp))
                 for token-info = (lua-get-block-token-info (match-string 0))
                 for token-type = (lua-get-token-type token-info)
                 while (not (eq token-type 'open))
                 do (progn
                      (setq pos (match-beginning 0)
                            return-val token-info)
                      (goto-char (match-end 0))
                      (forward-comment (line-end-position))))))
    (when pos
      (goto-char pos)
      return-val)))