How one can programmatically read and set a buffer-wide org-mode property?
I am aware of this, which points to
(org-entry-put POM "PWE-1" "47")
but it does not seem useful in case of buffer global properties.
Details:
If a file has buffer global properties, like,
#+PROPERTY: PWE-1 42
#+PROPERTY: Cite "Silmarillon 1984"
#+PROPERTY: my/common-list (1 "two" (1 2 3 5 7))
How could one fetch, for example, the buffer-wide property PWE-1, or any other?
How would one set it, ie, write a different value, say
#+PROPERTY: PWE-1 2197
so that the buffer will keep the updated value as stored in the file, available at next load?
Where could I look up similar information in detail? Is there a detailed list of org-mode's API?
org-element-parse-buffer
. Maybe, that helps. As far as I remember, you get also the buffer positions of the parsed stuff. So you can replace the text forPWE-1
. (Don't have time to check right now.)(setq p (org-element-parse-buffer))
and you will get(org-data nil (section (:begin 1 :end 108 :contents-begin 1 :contents-end 107 :post-blank 1 :parent #0) (keyword (:key "PROPERTY" :value "PWE-1 42" :begin 1 :end 22 :post-blank 0 :post-affiliated 1 :parent #1))
at the beginning ofp
if your example text is at the beginning of the current org-buffer.:PROPERTIES:
, then:PWE-1: 42
, then:END:
?#+PROPERTY: PWE-1 42
is also fine. That's global. (See info files.)