From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Documentation: Side effects of org-entry-properties and others Date: Mon, 17 Feb 2020 19:08:03 -0500 Message-ID: References: <90aecaeb-c182-cc2e-9f31-4dc24db65af9@posteo.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e53a99059ece7717" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37248) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3qR0-0005VB-VT for emacs-orgmode@gnu.org; Mon, 17 Feb 2020 19:08:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3qQz-0005nY-8g for emacs-orgmode@gnu.org; Mon, 17 Feb 2020 19:08:18 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:40407) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3qQy-0005mu-QP for emacs-orgmode@gnu.org; Mon, 17 Feb 2020 19:08:17 -0500 Received: by mail-wr1-x42d.google.com with SMTP id t3so21784786wru.7 for ; Mon, 17 Feb 2020 16:08:16 -0800 (PST) In-Reply-To: <90aecaeb-c182-cc2e-9f31-4dc24db65af9@posteo.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: D Cc: org-mode-email --000000000000e53a99059ece7717 Content-Type: text/plain; charset="UTF-8" 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 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. > > --000000000000e53a99059ece7717 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I guess org-element-context and=C2=A0(org-element-at-point= ) also do this too (or at least once did), because I have code that wraps t= hem in save-match data with notes to my self that match-data changes.=C2=A0=

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


John

-----------------------------------=
Professor John Kitchin=C2=A0
Doherty Hall A207F
Department of Che= mical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
= 412-268-7803


Hi,

it seems a few functions meant to expose org internals to programmers
seem to cause undocumented side effects.=C2=A0 A particular example being org-entry-properties.=C2=A0 When called, it changes the match-data.=C2=A0 T= his can
cause issues in cases where leaking match-data can cause font-lock to
behave inconsistently or throw errors.=C2=A0 I think it would be a good ide= a
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.

--000000000000e53a99059ece7717--