* [PATCH] Add org-goto-first-child
@ 2010-09-15 2:37 Jambunathan K
0 siblings, 0 replies; only message in thread
From: Jambunathan K @ 2010-09-15 2:37 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 84 bytes --]
Add org-goto-first-child. Completes existing set of org tree traversal
functions.
[-- Attachment #2: Type: text/plain, Size: 1234 bytes --]
From ee430632f0d5088ed71f0d8ae48bac43f4d6208c Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@gmail.com>
Date: Wed, 15 Sep 2010 08:00:41 +0530
Subject: [PATCH] Add org-goto-first-child
* lisp/org.el (org-goto-first-child): New
Completes existing set of org tree traversal functions.
TINYCHANGE.
---
lisp/org.el | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 70dd482..c2e6253 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19200,6 +19200,18 @@ move point."
(while (org-goto-sibling 'previous)
(org-flag-heading nil))))
+(defun org-goto-first-child ()
+ "Goto the first child, even if it is invisible.
+Return t when a child was found. Otherwise don't move point and
+return nil."
+ (let (level (pos (point)) (re (concat "^" outline-regexp)))
+ (when (condition-case nil (org-back-to-heading t) (error nil))
+ (setq level (outline-level))
+ (forward-char 1)
+ (if (and (re-search-forward re nil t) (> (outline-level) level))
+ (progn (goto-char (match-beginning 0)) t)
+ (goto-char pos) nil))))
+
(defun org-show-hidden-entry ()
"Show an entry where even the heading is hidden."
(save-excursion
--
1.7.0.4
[-- Attachment #3: Type: text/plain, Size: 16 bytes --]
Jambunathan K.
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-15 2:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 2:37 [PATCH] Add org-goto-first-child Jambunathan K
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.