Function: tuareg-end-of-defun
tuareg-end-of-defun is an interactive and natively compiled function
defined in tuareg.el.
Signature
(tuareg-end-of-defun)
Documentation
Assuming that we are at the beginning of a definition, move to its end.
See variable end-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-end-of-defun ()
"Assuming that we are at the beginning of a definition, move to its end.
See variable `end-of-defun-function'."
(interactive)
(let* ((start (point))
(head (tuareg-smie--forward-token))) ; Skip the head token.
(cond
((member head '("type" "d-let" "let" "and" "exception" "module"
"class" "val" "external" "open"))
;; Non-expression defun.
(tuareg-smie--forward-sexp-and)
(let ((end (point)))
;; Check whether this defun is part of a let...and... chain that
;; ends with "in", in which case it is a single big defun.
;; Otherwise, go back to the first end position.
(while
(let ((tok (tuareg-smie--forward-token)))
(cond ((equal tok "and")
;; Skip the "and" clause and keep looking.
(tuareg-smie--forward-sexp-and)
t)
((equal tok "in")
;; It's an expression, not a declaration: go to its end.
(tuareg-smie--forward-sexp-and)
nil)
(t
;; No "in" found; use what we had at the start.
(goto-char end)
nil))))))
(t
;; Expression: go back and skip it all at once.
(goto-char start)
(smie-forward-sexp ";;"))))
(tuareg--skip-forward-comments-semicolon))