all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Documentation: Side effects of org-entry-properties and others
@ 2020-02-17 23:19 D
  2020-02-18  0:08 ` John Kitchin
  2020-02-18  0:53 ` Nicolas Goaziou
  0 siblings, 2 replies; 3+ messages in thread
From: D @ 2020-02-17 23:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

it seems a few functions meant to expose org internals to programmers
seem to cause undocumented side effects.  A particular example being
org-entry-properties.  When called, it changes the match-data.  This can
cause issues in cases where leaking match-data can cause font-lock to
behave inconsistently or throw errors.  I think it would be a good idea
to add a prominent warning to such interfacing functions, or document it
somewhere in the module.

The same is true for org-element-lineage, but I am not so sure whether
it is intended for hacking purposes as much as org-entry-properties.
Sadly, I have no overview over the scope of this issue, so I do not know
whether my suggestion is unrealistic (for example, because it would mean
adding warnings practically everywhere).

Regards,

D.

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

* Re: Documentation: Side effects of org-entry-properties and others
  2020-02-17 23:19 Documentation: Side effects of org-entry-properties and others D
@ 2020-02-18  0:08 ` John Kitchin
  2020-02-18  0:53 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: John Kitchin @ 2020-02-18  0:08 UTC (permalink / raw)
  To: D; +Cc: org-mode-email

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

I guess org-element-context and (org-element-at-point) also do this too (or
at least once did), because I have code that wraps them in save-match data
with notes to my self that match-data changes.

There are other things that unexpectedly do this, like split-string I think
(again based on code using this that is wrapped in save-match-data).


John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Feb 17, 2020 at 6:20 PM D <d.williams@posteo.net> wrote:

> Hi,
>
> it seems a few functions meant to expose org internals to programmers
> seem to cause undocumented side effects.  A particular example being
> org-entry-properties.  When called, it changes the match-data.  This can
> cause issues in cases where leaking match-data can cause font-lock to
> behave inconsistently or throw errors.  I think it would be a good idea
> to add a prominent warning to such interfacing functions, or document it
> somewhere in the module.
>
> The same is true for org-element-lineage, but I am not so sure whether
> it is intended for hacking purposes as much as org-entry-properties.
> Sadly, I have no overview over the scope of this issue, so I do not know
> whether my suggestion is unrealistic (for example, because it would mean
> adding warnings practically everywhere).
>
> Regards,
>
> D.
>
>

[-- Attachment #2: Type: text/html, Size: 2162 bytes --]

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

* Re: Documentation: Side effects of org-entry-properties and others
  2020-02-17 23:19 Documentation: Side effects of org-entry-properties and others D
  2020-02-18  0:08 ` John Kitchin
@ 2020-02-18  0:53 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2020-02-18  0:53 UTC (permalink / raw)
  To: D; +Cc: emacs-orgmode

Hello,

D <d.williams@posteo.net> writes:

> The same is true for org-element-lineage, but I am not so sure whether
> it is intended for hacking purposes as much as org-entry-properties.
> Sadly, I have no overview over the scope of this issue, so I do not know
> whether my suggestion is unrealistic (for example, because it would mean
> adding warnings practically everywhere).

I think this is unrealistic. If you need to save match data, execute
non-trivial code, and use the saved match data, I suggest to use
`save-match-data'.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2020-02-18  0:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-17 23:19 Documentation: Side effects of org-entry-properties and others D
2020-02-18  0:08 ` John Kitchin
2020-02-18  0:53 ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.