Subject: bug#5852: 23.1; Incorrect references in ses-mode

From: Vincent Belaïche <[email-masked]>
Date: Sun, 25 Jul 2021 19:27:21 +0200

Dear Stefan (Monnier),

I am calling to your deep knowledge of Emacs internals.

We have a bug which seems to be real time dependant, which makes me
think that there is some race condition somewhere. I think it can't be
any race between the command and the post-command hook, because they
are run sequentially in the command loop : post-command hook of
command N does not overlap command N+1, please confirm …

Now, I have another speculation : SES gets the current cell from the
cursor position by reading some buffer text property
'cursor-intangible. I speculate that the radix of the bug is that when
a command sets this cursor property, then the buffer is actually
modified in the backgroun, and the change may not be yet in effect
when the next command runs. Could you confirm / infirm this
speculation.

One more thing is the following : in SES the cursor-intangile property
is the symbol corresponding to the cell object (which under the hood
is a vector), not the cell object itself. This means that the property
has to change when there are row/column insertion / deletion, which
also inherently change the buffer, because of symbol relocation. I
think this might be some bad design choice, and pointing directly at
the cell object would have saved some troubles (and probably would
also create a bunch of other problems, so do not take my statement for
sure). Of course the idea of using symbols makes sense as they make it
easy for the formulas, and as such some sort of relocation is
unavoidable. On the other hand, the cell index (say (0 0) for A1, (0
1) for B1, (1 0) for A2, etc…), is retrieved from a property of the
cell symbol, so things are a bit intricate …

  Vincent.

Le dim. 25 juil. 2021 à 08:44, Lars Ingebrigtsen <[email-masked]> a écrit :
>
> Vincent Belaïche <[email-masked]> writes:
>
> > Just to say that I did the test manually on my home PC a couple of
> > time, and I could not reproduce the problem.
> > That is quite annoying, yesterday I reproduced it on my office PC once.
>
> Yeah, timing dependent bugs are really annoying to try to debug..
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no