E.g., with this input:

* Test A thing! ** Testing * Hello

Get this output:

(1 3 4)


org-map-entries is a great function for this sort of thing:

(org-map-entries FUNC &optional MATCH SCOPE &rest SKIP)

Call FUNC at each headline selected by MATCH in SCOPE.

To do what you outlined above from within the target file it's simply a matter of:

(org-map-entries (lambda () (line-number-at-pos)) nil 'file)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.