Re: [O] Return Top-Level Heading

2015-10-19 Thread Myles English
Hello Zach,

Zach Sheffler writes:

> Is there a way to reference the top-level heading that a lower-level
> heading belongs to? For instance:
>
> * One
> ** Two
> *** Three
>
> If I have "Three", how can I get it to tell me that the top-level is "One"?
> For reference, this is for an org-agenda-prefix.

Perhaps this:

(defun findTop()
(interactive)
(let* ((tree (org-element-parse-buffer))
   (curs_pos (point))
   (up_tree (org-element-map tree 'headline
  (lambda (hl)
(and (> curs_pos (org-element-property :begin hl))
 (= (org-element-property :level hl) 1)
 (org-element-property :raw-value hl) 
   (local_up_tree (last up_tree)))
  local_up_tree))

Myles



[O] Return Top-Level Heading

2015-10-13 Thread Zach Sheffler
Hello,

Is there a way to reference the top-level heading that a lower-level
heading belongs to? For instance:

* One
** Two
*** Three

If I have "Three", how can I get it to tell me that the top-level is "One"?
For reference, this is for an org-agenda-prefix.

Thanks!