Function: lua-send-defun

lua-send-defun is an interactive and byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-send-defun POS)

Documentation

Send the function definition around POS to the Lua process.

Key Bindings

Aliases

lua-send-proc

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-send-defun (pos)
  "Send the function definition around POS to the Lua process."
  (interactive "d")
  (save-excursion
    (let ((start (if (save-match-data (looking-at "^function[ \t]"))
                     ;; point already at the start of "function".  We
                     ;; need to handle this case explicitly since
                     ;; lua-beginning-of-proc will move to the beginning
                     ;; of the _previous_ function.
                     (point)
                   ;; point is not at the beginning of function, move
                   ;; there and bind start to that position
                   (lua-beginning-of-proc)
                   (point)))
          (end (progn (lua-end-of-proc) (point))))

      ;; Make sure point is in a function definition before sending to
      ;; the process
      (if (and (>= pos start) (< pos end))
          (lua-send-region start end)
        (error "Not on a function definition")))))