Function: lua-end-of-proc

lua-end-of-proc is an interactive and byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-end-of-proc &optional ARG)

Documentation

Move forward to next end of Lua proc (or similar).

With argument ARG, do it that many times. Negative ARG -N means move back to Nth preceding end of proc.

This function just searches for a end at the beginning of a line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-end-of-proc (&optional arg)
  "Move forward to next end of Lua proc (or similar).

With argument ARG, do it that many times.  Negative ARG -N means move
back to Nth preceding end of proc.

This function just searches for a `end' at the beginning of a line."
  (interactive "P")
  (or arg
      (setq arg 1))
  (let ((found nil)
        (ret t))
    (if (and (< arg 0)
             (not (bolp))
             (save-excursion
               (beginning-of-line)
               (eq (following-char) ?})))
        (forward-char -1))
    (while (> arg 0)
      (if (re-search-forward "^end" nil t)
          (setq arg (1- arg)
                found t)
        (setq ret nil
              arg 0)))
    (while (< arg 0)
      (if (re-search-backward "^end" nil t)
          (setq arg (1+ arg)
                found t)
        (setq ret nil
              arg 0)))
    (if found
        (progn
          (beginning-of-line)
          (forward-line)))
    ret))