Function: markdown-beginning-of-defun
markdown-beginning-of-defun is a byte-compiled function defined in
markdown-mode.el.
Signature
(markdown-beginning-of-defun &optional ARG)
Documentation
beginning-of-defun-function for Markdown.
This is used to find the beginning of the defun and should behave like ‘beginning-of-defun’, returning non-nil if it found the beginning of a defun. It moves the point backward, right before a heading which defines a defun. When ARG is non-nil, repeat that many times. When ARG is negative, move forward to the ARG-th following section.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-beginning-of-defun (&optional arg)
"`beginning-of-defun-function' for Markdown.
This is used to find the beginning of the defun and should behave
like ‘beginning-of-defun’, returning non-nil if it found the
beginning of a defun. It moves the point backward, right before a
heading which defines a defun. When ARG is non-nil, repeat that
many times. When ARG is negative, move forward to the ARG-th
following section."
(or arg (setq arg 1))
(when (< arg 0) (end-of-line))
;; Adjust position for setext headings.
(when (and (thing-at-point-looking-at markdown-regex-header-setext)
(not (= (point) (match-beginning 0)))
(not (markdown-code-block-at-point-p)))
(goto-char (match-end 0)))
(let (found)
;; Move backward with positive argument.
(while (and (not (bobp)) (> arg 0))
(setq found nil)
(while (and (not found)
(not (bobp))
(re-search-backward markdown-regex-header nil 'move))
(markdown-code-block-at-pos (match-beginning 0))
(setq found (match-beginning 0)))
(setq arg (1- arg)))
;; Move forward with negative argument.
(while (and (not (eobp)) (< arg 0))
(setq found nil)
(while (and (not found)
(not (eobp))
(re-search-forward markdown-regex-header nil 'move))
(markdown-code-block-at-pos (match-beginning 0))
(setq found (match-beginning 0)))
(setq arg (1+ arg)))
(when found
(beginning-of-line)
t)))