Function: js-beginning-of-defun
js-beginning-of-defun is a byte-compiled function defined in js.el.gz.
Signature
(js-beginning-of-defun &optional ARG)
Documentation
Value of beginning-of-defun-function for js-mode.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js-beginning-of-defun (&optional arg)
"Value of `beginning-of-defun-function' for `js-mode'."
(setq arg (or arg 1))
(let ((found))
(while (and (not (eobp)) (< arg 0))
(incf arg)
(when (and (not js-flat-functions)
(or (eq (js-syntactic-context) 'function)
(js--function-prologue-beginning)))
(js-end-of-defun))
(if (js--re-search-forward
"\\_<function\\_>" nil t)
(progn (goto-char (js--function-prologue-beginning))
(setq found t))
(goto-char (point-max))
(setq found nil)))
(while (> arg 0)
(decf arg)
;; If we're just past the end of a function, the user probably wants
;; to go to the beginning of *that* function
(when (eq (char-before) ?})
(backward-char))
(let ((prologue-begin (js--function-prologue-beginning)))
(cond ((and prologue-begin (< prologue-begin (point)))
(goto-char prologue-begin)
(setq found t))
(js-flat-functions
(setq found (js--beginning-of-defun-flat)))
(t
(when (js--beginning-of-defun-nested)
(setq found t))))))
found))