emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Document-level properties incorrect and/or missing based on preceding blank lines and/or comments
@ 2023-10-11 19:46 Tom Alexander
  2023-10-12 10:38 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Alexander @ 2023-10-11 19:46 UTC (permalink / raw)
  To: emacs-orgmode

Emacs version: Emacs 29.1
Org-mode version: e1569918cc94253650781e83a09695739c93352f  (latest in git)

The org-mode syntax document[1] says that property drawers can exist in the zeroth section with the format:
```
BEGINNING-OF-FILE
BLANK-LINES
COMMENT
PROPERTYDRAWER
```

Using this test document:
```
:PROPERTIES:
:FOO:    bar
:END:
```

I correctly get the foo property in the top-level org-data
```
(org-data
(:standard-properties
  [1 1 1 33 33 0 nil org-data nil nil nil 32 33 nil #<buffer *scratch*> nil nil nil]
  :path nil :FOO "bar" :CATEGORY nil)
```

But now there are two separate issues:

### Issue 1

Putting a comment before it makes the value for the foo property incorrect (seems to be grabbing an earlier string slice):
```
# baz
:PROPERTIES:
:FOO:    bar
:END:
```

```
(org-data
(:standard-properties
  [1 1 1 39 39 0 nil org-data nil nil nil 38 39 nil #<buffer *scratch*> nil nil nil]
  :path nil :FOO "O: " :CATEGORY nil)
```

Interestingly, looking farther down the AST, the value for foo is properly set in the node-property, just not the org-data:
```
(node-property
    (:standard-properties
     [20 20 nil nil 33 0 nil node-property nil nil nil nil nil nil #<buffer *scratch*> nil nil #2]
     :key "FOO" :value "bar"))
```

### Issue 2

Putting any blank lines before it makes the foo property not appear in org-data at all
```

:PROPERTIES:
:FOO:    bar
:END:
```

```
(org-data
(:standard-properties
  [1 1 2 34 34 0 nil org-data nil nil nil 4 34 nil #<buffer *scratch*> nil nil nil]
  :path nil :CATEGORY nil)
```

Looking farther down the AST it seems the property-drawer became a regular drawer


[1] https://orgmode.org/worg/org-syntax.html#Property_Drawers

--
Tom Alexander
pgp: https://fizz.buzz/pgp.asc


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-12 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11 19:46 Document-level properties incorrect and/or missing based on preceding blank lines and/or comments Tom Alexander
2023-10-12 10:38 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).