emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Differentiating org element properties from built-ins?
@ 2024-09-17 14:22 tomas
  2024-09-22 17:15 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: tomas @ 2024-09-17 14:22 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

Hi, Orgxperts

assume I have something like this:

** Some heading
   :properties:
   :foo: some value for foo
   :bar: some value for bar
   :end:

Now, when I do

  (org-element-properties-mapc
    (lambda (k v) (message "%s -> %s" k v))
    (org-element-at-point))

I do see foo and bar (well, OK, :FOO and :BAR) with their values, but lots
of other (let's call them "built-ins") like :begin and :post-affiliated.

How do I keep those apart? Or do I have to resort to running regexps through
the buffer?

Cheers & thanks
-- 
tomás

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: Differentiating org element properties from built-ins?
  2024-09-17 14:22 Differentiating org element properties from built-ins? tomas
@ 2024-09-22 17:15 ` Ihor Radchenko
  2024-09-23  6:07   ` tomas
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-09-22 17:15 UTC (permalink / raw)
  To: tomas; +Cc: emacs-orgmode

<tomas@tuxteam.de> writes:

> I do see foo and bar (well, OK, :FOO and :BAR) with their values, but lots
> of other (let's call them "built-ins") like :begin and :post-affiliated.
>
> How do I keep those apart? Or do I have to resort to running regexps through
> the buffer?

   (defun org-element-headline-parser (&optional _ raw-secondary-p)
     "Parse a headline.

   Return a new syntax node of `headline' type containing `:raw-value',
   `:title', `:begin', `:end', `:pre-blank', `:contents-begin' and
   `:contents-end', `:level', `:priority', `:tags', `:todo-keyword',
   `:todo-type', `:scheduled', `:deadline', `:closed', `:archivedp',
   `:commentedp' `:footnote-section-p', `:post-blank' and
   `:post-affiliated' properties.

   The plist also contains any property set in the property drawer,
   with its name in upper cases and colons added at the
   beginning (e.g., `:CUSTOM_ID').

So, properties from the property drawer are always upcased.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: Differentiating org element properties from built-ins?
  2024-09-22 17:15 ` Ihor Radchenko
@ 2024-09-23  6:07   ` tomas
  0 siblings, 0 replies; 3+ messages in thread
From: tomas @ 2024-09-23  6:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On Sun, Sep 22, 2024 at 05:15:25PM +0000, Ihor Radchenko wrote:
> <tomas@tuxteam.de> writes:
> 
> > I do see foo and bar (well, OK, :FOO and :BAR) with their values, but lots
> > of other (let's call them "built-ins") like :begin and :post-affiliated.
> >
> > How do I keep those apart? Or do I have to resort to running regexps through
> > the buffer?
> 
>    (defun org-element-headline-parser (&optional _ raw-secondary-p)
>      "Parse a headline.
> 
>    Return a new syntax node of `headline' type containing `:raw-value',
>    `:title', `:begin', `:end', `:pre-blank', `:contents-begin' and
>    `:contents-end', `:level', `:priority', `:tags', `:todo-keyword',
>    `:todo-type', `:scheduled', `:deadline', `:closed', `:archivedp',
>    `:commentedp' `:footnote-section-p', `:post-blank' and
>    `:post-affiliated' properties.
> 
>    The plist also contains any property set in the property drawer,
>    with its name in upper cases and colons added at the
>    beginning (e.g., `:CUSTOM_ID').
> 
> So, properties from the property drawer are always upcased.

Thanks for that, Ihor

I ended up regexping my was through (which brought about some other
advantages with it; I'm using those props to communicate with other
things outside, and there, keeping the keys's cases is a nice-to-have).

Actually, the case treatment of property names is one of the most
acute pain points in Org for me, but this ship has sailed :-)

Cheers & thanks again for your help.
-- 
tomás

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2024-09-23  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17 14:22 Differentiating org element properties from built-ins? tomas
2024-09-22 17:15 ` Ihor Radchenko
2024-09-23  6:07   ` tomas

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).