Re: Get list of top-level headings

2021-05-19 Thread John Kitchin
that is often true, especially with large buffers, but you have to add a bunch of code to go to point-max, and check the level with this. #+BEGIN_SRC emacs-lisp (save-excursion (goto-char (point-max)) (let (components (headings '())) (while (re-search-backward org-complex-heading-regexp ni

Re: Get list of top-level headings

2021-05-19 Thread Jonathan Gregory
Hi On 19 May 2021, John Kitchin wrote: I think this is all you need to get a list of titles of level 1 headings as strings (org-map-entries (lambda () (fifth (org-heading-components))) "LEVEL=1") this also works for me: #+BEGIN_SRC emacs-lisp (org-map-entries (lambda () (org-element-property

Re: Get list of top-level headings

2021-05-19 Thread Jonathan Gregory
Hello Florian On 19 May 2021, Florian Lindner wrote: Hello, I, an Emacs Lisp newbie, want to get a list of all top-level headings of the current buffer. My approach so far is: (defun test-org-map() (interactive) (setq headings '()) (org-map-entries (lambda () (set

Re: Get list of top-level headings

2021-05-19 Thread John Kitchin
I think this is all you need to get a list of titles of level 1 headings as strings (org-map-entries (lambda () (fifth (org-heading-components))) "LEVEL=1") this also works for me: #+BEGIN_SRC emacs-lisp (org-map-entries (lambda () (org-element-property :title (org-element-at-point)) ) "LEVEL=1"

Get list of top-level headings

2021-05-19 Thread Florian Lindner
Hello, I, an Emacs Lisp newbie, want to get a list of all top-level headings of the current buffer. My approach so far is: (defun test-org-map()   (interactive)   (setq headings '())   (org-map-entries (lambda () (setq current-header-item (org-element-property :title (org-