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") #+END_SRC John ----------------------------------- Professor John Kitchin (he/him/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Wed, May 19, 2021 at 3:51 AM 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 () > (setq current-header-item (org-element-property > :title (org-element-at-point)) > (message "Header: %s" current-header-item) > (message "Is String: %s" (stringp > (org-element-property :title (org-element-at-point)))) > (setq headings (append current-header-item headings)) > ) > "LEVEL=1" > ) > (dolist (heading headings) > (message "Header Item: %s" heading) > ) > ) > > This gives the otput: > > Header: AAA > Is String: t > Header: BBB > Is String: t > Header Item: 66 [3 times] > Header Item: 65 [3 times] > > so basically the (org-element-property :title (org-element-at-point) does > exactly what I want, but building the list does not what I want. I suppose > that comes from a fundamental misunderstanding of how strings work in elisp. > > I would appreciate a short explanation (or pointers) why this does not > work. And of course, I am very open to completely different, likely better, > approches to that simply problem! > > Thanks, > Florian >