Function: markdown-fill-forward-paragraph

markdown-fill-forward-paragraph is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-fill-forward-paragraph &optional ARG)

Documentation

Function used by fill-paragraph to move over ARG paragraphs.

This is a fill-forward-paragraph-function for markdown-mode. It is called with a single argument specifying the number of paragraphs to move. Just like forward-paragraph, it should return the number of paragraphs left to move.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-fill-forward-paragraph (&optional arg)
  "Function used by `fill-paragraph' to move over ARG paragraphs.
This is a `fill-forward-paragraph-function' for `markdown-mode'.
It is called with a single argument specifying the number of
paragraphs to move.  Just like `forward-paragraph', it should
return the number of paragraphs left to move."
  (or arg (setq arg 1))
  (if (> arg 0)
      ;; With positive ARG, move across ARG non-code-block paragraphs,
      ;; one at a time.  When passing a code block, don't decrement ARG.
      (while (and (not (eobp))
                  (> arg 0)
                  (= (forward-paragraph 1) 0)
                  (or (markdown-code-block-at-pos (line-beginning-position 0))
                      (setq arg (1- arg)))))
    ;; Move backward by one paragraph with negative ARG (always -1).
    (let ((start (point)))
      (setq arg (forward-paragraph arg))
      (while (and (not (eobp))
                  (progn (move-to-left-margin) (not (eobp)))
                  (looking-at-p paragraph-separate))
        (forward-line 1))
      (cond
       ;; Move point past whitespace following list marker.
       ((looking-at markdown-regex-list)
        (goto-char (match-end 0)))
       ;; Move point past whitespace following pipe at beginning of line
       ;; to handle Pandoc line blocks.
       ((looking-at "^|\\s-*")
        (goto-char (match-end 0)))
       ;; Return point if the paragraph passed was a code block.
       ((markdown-code-block-at-pos (line-beginning-position 2))
        (goto-char start)))))
  arg)