From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Outline cycling does not preserve point's position Date: Tue, 10 Sep 2013 21:48:53 +0200 Message-ID: <871u4w8nkq.fsf@gmail.com> References: <7CB7B681-DD2E-446C-AE45-DDCA204EE95C@gmail.com> <5855E8E1-9730-4A29-89FF-E35C64E54EDD@gmail.com> <20130910073257.GO20690@kuru.dyndns-at-home.com> <20130910075345.GP20690@kuru.dyndns-at-home.com> <25A21DB7-B2E5-47BB-8A64-594A15CB24B8@gmail.com> <20130910085057.GQ20690@kuru.dyndns-at-home.com> <4ED2509E-8A2E-4ED2-BFCF-CB7B27F1D2B4@gmail.com> <20130910095043.GR20690@kuru.dyndns-at-home.com> <87a9jk8wmr.fsf@gmail.com> <20130910185843.GA20690@kuru.dyndns-at-home.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJTve-0000gw-8K for emacs-orgmode@gnu.org; Tue, 10 Sep 2013 15:48:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJTvV-0005rl-OF for emacs-orgmode@gnu.org; Tue, 10 Sep 2013 15:48:50 -0400 Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:40336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJTvV-0005rc-Fg for emacs-orgmode@gnu.org; Tue, 10 Sep 2013 15:48:41 -0400 Received: by mail-ee0-f44.google.com with SMTP id b47so4153918eek.31 for ; Tue, 10 Sep 2013 12:48:40 -0700 (PDT) In-Reply-To: <20130910185843.GA20690@kuru.dyndns-at-home.com> (Suvayu Ali's message of "Tue, 10 Sep 2013 20:58:43 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Suvayu Ali Cc: emacs-orgmode@gnu.org, Carsten Dominik Hello, Suvayu Ali 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