emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Tom Alexander" <tom@fizz.buzz>
To: emacs-orgmode@gnu.org
Subject: Document-level properties incorrect and/or missing based on preceding blank lines and/or comments
Date: Wed, 11 Oct 2023 15:46:07 -0400	[thread overview]
Message-ID: <0ec8c4ae-4f5b-4e37-8c5c-f92ef497a461@app.fastmail.com> (raw)

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


             reply	other threads:[~2023-10-11 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11 19:46 Tom Alexander [this message]
2023-10-12 10:38 ` Document-level properties incorrect and/or missing based on preceding blank lines and/or comments Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0ec8c4ae-4f5b-4e37-8c5c-f92ef497a461@app.fastmail.com \
    --to=tom@fizz.buzz \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).