[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Outline cycling does not preserve point's position
From: |
Nicolas Goaziou |
Subject: |
Re: [O] Outline cycling does not preserve point's position |
Date: |
Tue, 10 Sep 2013 20:39:09 +0200 |
Hello,
Jambunathan K <address@hidden> writes:
> Nicolas Goaziou <address@hidden> 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
- Re: [O] Outline cycling does not preserve point's position, (continued)
- Re: [O] Outline cycling does not preserve point's position, Carsten Dominik, 2013/09/13
- Re: [O] Outline cycling does not preserve point's position, Nicolas Goaziou, 2013/09/13
- Re: [O] Outline cycling does not preserve point's position, Carsten Dominik, 2013/09/14
- Re: [O] Outline cycling does not preserve point's position, Suvayu Ali, 2013/09/14
- Re: [O] Outline cycling does not preserve point's position, Carsten Dominik, 2013/09/15
- Re: [O] Outline cycling does not preserve point's position, Jambunathan K, 2013/09/12
- Re: [O] Outline cycling does not preserve point's position,
Nicolas Goaziou <=
- Re: [O] Outline cycling does not preserve point's position, Jambunathan K, 2013/09/12
- Re: [O] Outline cycling does not preserve point's position, Nicolas Goaziou, 2013/09/10
- Re: [O] Outline cycling does not preserve point's position, Jambunathan K, 2013/09/12
- Re: [O] Outline cycling does not preserve point's position, Samuel Wales, 2013/09/10
- Re: [O] Outline cycling does not preserve point's position, Jambunathan K, 2013/09/10
- Re: [O] Outline cycling does not preserve point's position, Jambunathan K, 2013/09/12
- Re: [O] Outline cycling does not preserve point's position, Nicolas Goaziou, 2013/09/11