emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Mikhanosha <max@openchat.com>
To: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: FR: headline iteration API
Date: Wed, 16 Jul 2008 11:06:04 -0400	[thread overview]
Message-ID: <87prpdc1ib.wl%max@openchat.com> (raw)
In-Reply-To: <b71b18520806111015n530c4621r75e4296ea60efea4@mail.gmail.com>

At Wed, 11 Jun 2008 12:15:11 -0500,
Eddward DeVilla wrote:

>  - doc traversal
>     - first-item
>       Go to the first item in the file.
>     - current-item
>       Go to the beginning of the item containing the cursor.
>     - next-item
>       Go to the item after the current one.
>     - previous-item
>       Go to item before the current one

Some time ago I wrote the following for myself, and I find that I use
these bindings several times a day.

(defun my-org-skip-forward (arg)
  "Move forward to the next visible 2nd or greater level heading,
skipping headings of the same level as the starting position"
  (interactive "p")
  (let ((initial-level (org-outline-level))
        (done nil))
    (while (not done)
      (outline-next-visible-heading arg)
      (let ((level (org-outline-level)))
        (when (and (> initial-level 1) (= level 1))
           (setq initial-level -1))
        (setq done (or
                    (and (< arg 0) (bobp)) 
                    (and (> arg 0) (eobp))
                    (and (not (= level initial-level)))))))))

(defun my-org-skip-backward (arg)
  (interactive "p")
  (my-org-skip-forward (- arg)))

The idea is that point is moved to the next visible boundary where
outline level changes. This is useful when you have your file in
collapsed state with only a few trees expanded. Above command allows
one to quickly jump between such trees.

Also useful for navigating result of a sparse tree search in the same
manner.

Regards,
  Max

      parent reply	other threads:[~2008-07-16 15:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 12:46 FR: headline iteration API Adam Spiers
2008-06-04 14:35 ` Daniel Clemente
2008-06-10 10:28   ` Adam Spiers
2008-06-12  6:46     ` Carsten Dominik
2008-06-12 10:16       ` Adam Spiers
2008-06-12 10:51         ` Carsten Dominik
2008-06-11  6:57 ` Dominik, C.
2008-06-11 11:06   ` Adam Spiers
2008-06-11 17:15     ` Eddward DeVilla
2008-06-12  1:09       ` Eddward DeVilla
2008-07-16 15:06       ` Max Mikhanosha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87prpdc1ib.wl%max@openchat.com \
    --to=max@openchat.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).