emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Why is `org-element-affiliated-keywords' a var when `org-element--affiliated-re' is a const?
@ 2020-04-03  9:34 Johan Tolö
  2020-04-05 17:06 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Tolö @ 2020-04-03  9:34 UTC (permalink / raw)
  To: emacs-orgmode

Dear all,

I want to add my own org-element affiliated keyword "REF" in order 
to provide a reference to some other part of an org mode document 
(or another document) for a link.

For example:

#+NAME: a-figure
#+REF: [[file:another_document.org]]
[[file:a-figure.png]]

I want to use `org-element-context' to get the link element and 
use `org-element-property' to get the `REF' property.

I tried changing `org-element-affiliated-keywords' in order to 
define my own keyword. This is never picked up by 
`org-element-context' since it uses `org-element--affiliated-re' 
which is defined as a const and thus is never updated to reflect 
the change to `org-element-affiliated-keywords'. The help text for 
`org-element--affiliated-re' even mentions changing 
`org-element-affiliated-keywords'.

Is this an oversight or am I trying to use this is a way that is 
not intended?

Johan

-- 
Johan


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

* Re: Why is `org-element-affiliated-keywords' a var when `org-element--affiliated-re' is a const?
  2020-04-03  9:34 Why is `org-element-affiliated-keywords' a var when `org-element--affiliated-re' is a const? Johan Tolö
@ 2020-04-05 17:06 ` Nicolas Goaziou
  2020-04-05 21:01   ` Johan Tolö
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2020-04-05 17:06 UTC (permalink / raw)
  To: Johan Tolö; +Cc: emacs-orgmode

Hello,

Johan Tolö <johan@toloe.se> writes:

> Dear all,
>
> I want to add my own org-element affiliated keyword "REF" in order 
> to provide a reference to some other part of an org mode document 
> (or another document) for a link.
>
> For example:
>
> #+NAME: a-figure
> #+REF: [[file:another_document.org]]
>
> [[file:a-figure.png]]
>
> I want to use `org-element-context' to get the link element and 
> use `org-element-property' to get the `REF' property.
>
> I tried changing `org-element-affiliated-keywords' in order to 
> define my own keyword. This is never picked up by 
> `org-element-context' since it uses `org-element--affiliated-re' 
> which is defined as a const and thus is never updated to reflect 
> the change to `org-element-affiliated-keywords'. The help text for 
> `org-element--affiliated-re' even mentions changing 
> `org-element-affiliated-keywords'.
>
> Is this an oversight or am I trying to use this is a way that is 
> not intended?

Syntax is not meant to be changed by users. Also,
`org-element-affiliated-keywords' is a defconst.

You might abuse #+header: affiliated keyword to add a reference.

Regards,

-- 
Nicolas Goaziou


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

* Re: Why is `org-element-affiliated-keywords' a var when `org-element--affiliated-re' is a const?
  2020-04-05 17:06 ` Nicolas Goaziou
@ 2020-04-05 21:01   ` Johan Tolö
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Tolö @ 2020-04-05 21:01 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

snip
> Syntax is not meant to be changed by users. Also,
> `org-element-affiliated-keywords' is a defconst.

Oh, yes you are of course right. Somehow I got the definition 
mixed up, must have been looking at the definition in 
'org-pcomplete.el' or something. Sorry about that.


> You might abuse #+header: affiliated keyword to add a reference.

OK, thanks. I will give it a try.


-- 
Johan


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

end of thread, other threads:[~2020-04-05 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03  9:34 Why is `org-element-affiliated-keywords' a var when `org-element--affiliated-re' is a const? Johan Tolö
2020-04-05 17:06 ` Nicolas Goaziou
2020-04-05 21:01   ` Johan Tolö

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