emacs-orgmode
[Top][All Lists]
Advanced

[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 21:48:53 +0200

Hello,

Suvayu Ali <address@hidden> writes:

> 1. When traversing the file header, goes one line at a time.  I would
>    expect to go to the next blank line.  In the attached Org file, from
>    somewhere on #+TITLE to the blank line before the first headline.

There no such thing as a "file header". I think that navigating through
(regular) keywords is better, so that's a feature.

> 2. Skips whole source block even if there are blank lines.  So can't
>    navigate large source blocks for small edits.  Try on the python
>    source block under the first headline.

I concentrate on Org syntax for now.
>
> 3. Goes through each row of a table instead of going over the table in
>    one go.  Start with cursor on "From ConDBBrowser:".

OK. Rows should be skipped now.
>
> 4. Skips the whole body under a headline when followed by link.  Try
>    putting point on the headline "Important points" and move; you will
>    jump to "Tagging Issues" instead of the link and the list after.

That was a bug. Should be fixed.

> How can I test going backward?

It is not written yet.

New version:

(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))
         (post-affiliated (org-element-property :post-affiliated 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)))
          ;; At a table row, move to the end of the table.
          ((eq type 'table-row)
           (goto-char (org-element-property
                       :end (org-element-property :parent element))))
          ((and post-affiliated (< (point) post-affiliated))
           (goto-char post-affiliated))
          ((eq type 'table) (goto-char end))
          ((not contents-begin) (goto-char end))
          ((< (point) contents-begin)
           (if (not (memq type '(footnote-definition item)))
               (goto-char contents-begin)
             (end-of-line)
             (org-forward-linear-element)))
          ((>= (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 'verse-block)
           (or (re-search-forward "^[ \t]*$" contents-end t)
               (goto-char end)))
          (t (error "This shouldn't happen")))
    (when (memq (org-invisible-p2) '(org-hide-block outline))
      (goto-char end))))


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]