Hello, Jambunathan K <kjambunat...@gmail.com> writes:
> Nicolas Goaziou <n.goaz...@gmail.com> writes: > >> Here's a first draft for the linear forward motion. > > cond: Symbol's function definition is void: > org-forward-and-down-element Hmm. That's a silly mistake (few aren't): I changed its name as a second thought and forgot to update the recursive calls. Thanks. Take 2: (defun org-forward-linear-element () (interactive) (when (eobp) (user-error "Cannot move further down")) (let* ((origin (point)) (element (org-element-at-point)) (type (org-element-type element)) (contents-begin (org-element-property :contents-begin element)) (contents-end (org-element-property :contents-end element)) (end (let ((end (org-element-property :end element)) (parent element)) (while (and (setq parent (org-element-property :parent parent)) (= (org-element-property :contents-end parent) end)) (setq end (org-element-property :end parent))) end))) (skip-chars-forward " \r\t\n") (or (eobp) (goto-char (max (line-beginning-position) origin))) (cond ((or (eobp) (= (point) end))) ((not contents-begin) (goto-char end)) ((< (point) contents-begin) (cond ((eq type 'item) (end-of-line) (org-forward-linear-element)) ((eq type 'table-row) (goto-char end)) (t (goto-char contents-begin)))) ((>= (point) contents-end) (goto-char end)) ((eq type 'paragraph) (goto-char end)) ((eq type 'plain-list) (end-of-line) (org-forward-linear-element)) ((eq type 'table) (forward-line) (when (>= (point) contents-end) (goto-char end))) ((eq type 'verse-block) (or (re-search-forward "^[ \t]*$" contents-end t) (goto-char end))) (t (error "This shouldn't happen"))) (when (org-invisible-p2) (goto-char end)))) Regards, -- Nicolas Goaziou