Function: clojure-beginning-of-defun-function

clojure-beginning-of-defun-function is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure-beginning-of-defun-function &optional N)

Documentation

Go to top level form.

Set as beginning-of-defun-function so that these generic operators can be used. Given a positive N it will do it that many times.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure-beginning-of-defun-function (&optional n)
  "Go to top level form.
Set as `beginning-of-defun-function' so that these generic
operators can be used.  Given a positive N it will do it that
many times."
  (let ((beginning-of-defun-function nil))
    (if (and clojure-toplevel-inside-comment-form
             (clojure-top-level-form-p "comment"))
        (condition-case nil
            (save-match-data
              (let ((original-position (point))
                    clojure-comment-end)
                (beginning-of-defun-raw)
                (end-of-defun)
                (setq clojure-comment-end (point))
                (beginning-of-defun-raw)
                (forward-char 1)              ;; skip paren so we start at comment
                (clojure-forward-logical-sexp) ;; skip past the comment form itself
                (if-let ((sexp-start (seq-find
                                      (lambda (beg-pos)
                                        (< beg-pos original-position))
                                      (clojure-sexp-starts-until-position
                                       clojure-comment-end))))
                    (progn (goto-char sexp-start) t)
                  (beginning-of-defun-raw n))))
          (scan-error (beginning-of-defun-raw n)))
      (beginning-of-defun-raw n))))