[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
org-element: headline's :title is sometimes string, sometimes list
From: |
Hraban Luyat |
Subject: |
org-element: headline's :title is sometimes string, sometimes list |
Date: |
Wed, 23 Aug 2023 01:25:04 +0000 |
Hi all.
I'll let the code speak:
(with-temp-buffer
(org-mode)
(insert "* Hello")
(cl-flet ((say-type (prefix hl)
(message "Headline title from %s is of type: %s"
prefix
(type-of (org-element-property :title hl)))))
(org-element-map (org-element-parse-buffer) 'headline
(lambda (hl) (say-type "map" hl)))
(goto-char (point-min))
(say-type "context" (org-element-context))
(say-type "at-point" (org-element-at-point))))
I expect: "string" everywhere.
I get:
Headline title from map is of type: cons
Headline title from context is of type: string
Headline title from at-point is of type: string
Question 1: Do you know what that `cons' structure is? Where is it
documented, how would I go about figuring this out myself? The
org-element API documentation is daunting.
Question 2: how do I reliably get the title as a string? Properties are
fine, I don't mind, but that weird list structure is awkward to handle.
Thank you
Hraban
- org-element: headline's :title is sometimes string, sometimes list,
Hraban Luyat <=