emacs-orgmode
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
Re: [O] Go to heading using LISP
From
:
Alexander Wingård
Subject
:
Re: [O] Go to heading using LISP
Date
:
Wed, 19 Jun 2013 20:24:26 +0200
On Mon, Jun 10, 2013 at 11:14 PM, Alexander Wingård
<
address@hidden
>
wrote:
Maybe some day I will learn some LISP and teach it to navigate the hierarchical structure.
I actually got curious and gave this a try and here's what I came up with:
test.org
:
* a
** b
*** h
** b
*** q
**** h
** c
*** d
Elisp:
(defun goto-notes ()
(interactive)
(find-file "~/
test.org
")
(org-goto-subtree '("a" "b" "q" "h"))
(org-show-context)
(org-show-entry)
(show-children))
(defun org-goto-subtree (path)
(let ((level 1))
(org-element-map
(org-element-parse-buffer 'headline)
'headline
(lambda (x)
(if (< (org-element-property :level x) level)
(setq level (org-element-property :level x)))
(if (and (= level (org-element-property :level x))
(string= (nth (- level 1) path) (org-element-property :raw-value x)))
(progn (setq level (+ level 1))
(if (> level (list-length path))
(goto-char (org-element-property :begin x))))))
nil t)))
https://gist.github.com/AlexanderWingard/5814843
My very first attempt at programming Elisp so any feedback is appreciated.
Best regards
Alexander
reply via email to
[
Prev in Thread
]
Current Thread
[Next in Thread]
[O] Go to heading using LISP
,
Alexander Wingård
,
2013/06/08
Re: [O] Go to heading using LISP
,
Eric Abrahamsen
,
2013/06/08
Re: [O] Go to heading using LISP
,
Alexander Wingård
,
2013/06/09
Re: [O] Go to heading using LISP
,
Eric Abrahamsen
,
2013/06/10
Re: [O] Go to heading using LISP
,
Jambunathan K
,
2013/06/10
Re: [O] Go to heading using LISP
,
Myles English
,
2013/06/10
Re: [O] Go to heading using LISP
,
Alexander Wingård
,
2013/06/10
Re: [O] Go to heading using LISP
,
Alexander Wingård
<=
Prev by Date:
Re: [O] [PATCH 1/2] org-notify: Don't use obsolete flet and macrolet
Next by Date:
[O] [ANN] Edit emails in Org-mode
Previous by thread:
Re: [O] Go to heading using LISP
Next by thread:
[O] different font sizes for headings
Index(es):
Date
Thread