Function: org--forward-paragraph-once
org--forward-paragraph-once is an interactive and byte-compiled
function defined in org.el.gz.
Signature
(org--forward-paragraph-once)
Documentation
Move forward to end of paragraph or equivalent, once.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--forward-paragraph-once ()
"Move forward to end of paragraph or equivalent, once.
See `org-forward-paragraph'."
(interactive)
(save-restriction
(widen)
(skip-chars-forward " \t\n")
(cond
((eobp) nil)
;; When inside a folded part, move out of it.
((when (org-invisible-p nil t)
(goto-char (cdr (org-fold-get-region-at-point)))
(forward-line)
t))
(t
(let* ((element (org--paragraph-at-point))
(type (org-element-type element))
(contents-begin (org-element-contents-begin element))
(end (org-element-end element))
(post-affiliated (org-element-post-affiliated element)))
(cond
((eq type 'plain-list)
(forward-char)
(org--forward-paragraph-once))
;; If the element is folded, skip it altogether.
((when (org-with-point-at post-affiliated (org-invisible-p (line-end-position) t))
(goto-char (cdr (org-fold-get-region-at-point
nil
(org-with-point-at post-affiliated
(line-end-position)))))
(forward-line)
t))
;; At a greater element, move inside.
((and contents-begin
(> contents-begin (point))
(not (eq type 'paragraph)))
(goto-char contents-begin)
;; Items and footnote definitions contents may not start at
;; the beginning of the line. In this case, skip until the
;; next paragraph.
(cond
((not (bolp)) (org--forward-paragraph-once))
((org-previous-line-empty-p) (forward-line -1))
(t nil)))
;; Move between empty lines in some blocks.
((memq type '(comment-block example-block export-block src-block
verse-block))
(let ((contents-start
(org-with-point-at post-affiliated
(line-beginning-position 2))))
(if (< (point) contents-start)
(goto-char contents-start)
(let ((contents-end
(org-with-point-at end
(skip-chars-backward " \t\n")
(line-beginning-position))))
(cond
((>= (point) contents-end)
(goto-char end)
(skip-chars-backward " \t\n")
(forward-line))
((re-search-forward "^[ \t]*\n" contents-end :move)
(forward-line -1))
(t nil))))))
(t
;; Move to element's end.
(goto-char end)
(skip-chars-backward " \t\n")
(forward-line))))))))