From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Outline cycling does not preserve point's position Date: Tue, 10 Sep 2013 23:08:23 +0200 Message-ID: <47C95833-7AC7-493C-AA1B-9E733549A443@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> <871u4w8nkq.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJVAm-0005NW-GK for emacs-orgmode@gnu.org; Tue, 10 Sep 2013 17:08:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJVAe-0005FH-26 for emacs-orgmode@gnu.org; Tue, 10 Sep 2013 17:08:32 -0400 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:64303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJVAd-0005F3-Nn for emacs-orgmode@gnu.org; Tue, 10 Sep 2013 17:08:23 -0400 Received: by mail-ea0-f175.google.com with SMTP id m14so4130607eaj.20 for ; Tue, 10 Sep 2013 14:08:23 -0700 (PDT) In-Reply-To: <871u4w8nkq.fsf@gmail.com> 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org On 10.9.2013, at 21:48, Nicolas Goaziou wrote: > Hello, >=20 > Suvayu Ali writes: >=20 >> 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. >=20 > There no such thing as a "file header". I think that navigating = through > (regular) keywords is better, so that's a feature. >=20 >> 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. >=20 > I concentrate on Org syntax for now. >>=20 >> 3. Goes through each row of a table instead of going over the table = in >> one go. Start with cursor on "=46rom ConDBBrowser:". >=20 > OK. Rows should be skipped now. >>=20 >> 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. >=20 > That was a bug. Should be fixed. Hi Nicolas, this looks very good already, thank you! And I agree with you, beginning of line is a good target column. Cheers - Carsten >=20 >> How can I test going backward? >=20 > It is not written yet. >=20 > New version: >=20 > (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)) > (=3D (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) (=3D (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))) > ((>=3D (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)))) >=20 >=20 > Regards, >=20 > --=20 > Nicolas Goaziou