Function: org-forward-element

org-forward-element is an interactive and byte-compiled function defined in org.el.gz.

Signature

(org-forward-element)

Documentation

Move forward by one element.

Move to the next element at the same level, when possible.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-forward-element ()
  "Move forward by one element.
Move to the next element at the same level, when possible."
  (interactive)
  (cond ((eobp) (user-error "Cannot move further down"))
	((org-with-limited-levels (org-at-heading-p))
	 (let ((origin (point)))
	   (goto-char (org-end-of-subtree nil t))
	   (unless (org-with-limited-levels (org-at-heading-p))
	     (goto-char origin)
	     (user-error "Cannot move further down"))))
	(t
	 (let* ((elem (org-element-at-point))
		(end (org-element-property :end elem))
		(parent (org-element-property :parent elem)))
	   (cond ((and parent (= (org-element-property :contents-end parent) end))
		  (goto-char (org-element-property :end parent)))
		 ((integer-or-marker-p end) (goto-char end))
		 (t (message "No element at point")))))))