Function: tuareg-beginning-of-defun
tuareg-beginning-of-defun is an interactive and natively compiled
function defined in tuareg.el.
Signature
(tuareg-beginning-of-defun &optional ARG)
Documentation
Move point backward to the beginning of a definition.
See variable beginning-of-defun-function.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg.el
(defun tuareg-beginning-of-defun (&optional arg)
"Move point backward to the beginning of a definition.
See variable `beginning-of-defun-function'."
(interactive "^P")
(unless arg (setq arg 1))
(let ((ret t))
(cond
((>= arg 0)
(while (and (> arg 0) ret)
(unless (tuareg-backward-beginning-of-defun)
(setq ret nil))
(cl-decf arg)))
(t
(while (and (< arg 0) ret)
(let ((start (point)))
(tuareg-end-of-defun)
(skip-chars-forward " \t\n")
(tuareg--skip-forward-comments-semicolon)
(let ((end (point)))
(tuareg-backward-beginning-of-defun)
;; Did we make forward progress?
(when (<= (point) start)
;; No, try again.
(goto-char end)
(tuareg-end-of-defun)
(skip-chars-forward " \t\n")
(tuareg--skip-forward-comments-semicolon)
(tuareg-backward-beginning-of-defun)
;; This time?
(when (<= (point) start)
;; No, no more defuns.
(goto-char (point-max))
(setq ret nil)))))
(cl-incf arg))))
ret))