I am trying to customize export behavior for emacs org-mode. A task I am getting stuck on is obtaining the element hierarchy for a given location in the document.

I am using emacs 24.5.1 with org-mode 8.2.10.

I have found the function "org-export-get-genealogy", which is supposed to return the hierarchy of an element in org-mode 8.2, but I cannot figure out how to initialize the environment correctly for it to work. Specifically, it seems like you need to initialize the parse tree for the buffer before you can invoke org-export-get-genealogy, and I cannot figure out how to do this correctly. I am fairly new to emacs lisp, and am not very familiar with the ways dynamic scope is used.

This is my current code

(setq *myvar* (org-element-parse-buffer)) ;how can I link this to the next line?
(org-export-get-genealogy (org-element-at-point))

Org-export-get-genealogy invoked as above always returns nil. How can I change the code so that org-export-get-genealogy returns the hierarchy for the element?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.