Function: python-nav-beginning-of-defun

python-nav-beginning-of-defun is a byte-compiled function defined in python.el.gz.

Signature

(python-nav-beginning-of-defun &optional ARG)

Documentation

Move point to beginning-of-defun.

With positive ARG search backwards else search forward. ARG nil or 0 defaults to 1. When searching backwards, nested defuns are handled with care depending on current point position. Return non-nil if point is moved to beginning-of-defun.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-nav-beginning-of-defun (&optional arg)
  "Move point to `beginning-of-defun'.
With positive ARG search backwards else search forward.
ARG nil or 0 defaults to 1.  When searching backwards,
nested defuns are handled with care depending on current
point position.  Return non-nil if point is moved to
`beginning-of-defun'."
  (when (or (null arg) (= arg 0)) (setq arg 1))
  (let ((found))
    (while (and (not (= arg 0))
                (let ((keep-searching-p
                       (python-nav--beginning-of-defun arg)))
                  (when (and keep-searching-p (null found))
                    (setq found t))
                  keep-searching-p))
      (setq arg (if (> arg 0) (1- arg) (1+ arg))))
    found))