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

From: Vincent Belaïche <[email-masked]>
Date: Sat, 29 Feb 2020 21:13:01 +0100

Dear Stefan and Güran,

I confirm that the bug still exists, I followed the instructions by
Güran and I reproduced the same result.

Actually, after doing all these and typing:

M-x ses-repair-cell-reference-all

I get the following answer :

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
Warning (emacs): ----------------------------------------------------------------
Some references were corrupted.

The following is a list where each element ELT is such
that (car ELT) is the reference of cell CELL with corruption,
and (cdr ELT) is a property list where

* property ‘:corrupt-property’ means that
  property ‘:ses-repair-reference’ of cell CELL was initially non
  nil,

* property ‘:missing’ is a list of missing references

* property ‘:irrelevant’ is a list of non needed references

((B2 :irrelevant (B4)))
--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

This shows that the cut and paste can actually breaks the reference list
in some cases.

Please note that 'ses-repair-cell-reference-all' is the command that I
added to SES after I became the maintainer in order to fix broken
reference lists, as this can still happen if you type C-g during some
cell editing post-commands. However I hadn't realized that even by
normal editing (no C-g) you can get broken references.

I will investigate why and feed back once I have a better idea of what
is happening.

VBR,
	Vincent.

Le 29/02/2020 à 04:14, Stefan Kangas a écrit :
> Hi Vincent,
>
> Could you please take a look at the below bug report?  It was reported
> in 2010, before you were listed as the maintainer of ses.el.
>
> Thanks in advance.
>
> Best regards,
> Stefan Kangas
>
>
> Göran Uddeborg <[email-masked]> writes:
>
>> I discovered this when emacs sometimes complains that I have circular
>> references in ses-mode files where there shouldn't be any.  When
>> investigating the ses file I've noticed some cells contain references
>> that are incorrect.  When I remove these incorrect references, the
>> complaints about circular references go away, so I strongly suspect
>> the problems are related.  And even if I'm wrong, the incorrect
>> references is a bug.
>>
>> While I haven't been able to create a simple test case where I get a
>> circular reference complaint, I can easily get to a state where there
>> are incorrect references.  Create a ses file with these keystrokes:
>>
>>     C-x C-f s . s e s <return> <tab> 1 <return> C-o 2 <return>
>>     <tab> <left> ( + SPC B 1 SPC A 2 <return>
>>     C-n C-o 3 <return> ( + SPC B 2 SPC A 3 <return> C-a
>>     C-o 4 <return> C-p C-SPC C-f M-w C-n C-b C-y C-n C-y
>>     C-x C-s
>>
>> In the resulting file, cell B2 has cell B4 incorrectly listed among
>> its references:
>>
>>     (ses-cell B2 3 (+ B1 A2) nil (B3 B4))
>>
>> Only B3 does actually reference B2.
>>
>>
>> In GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.18.3)
>>  of 2009-12-02 on x86-3.fedora.phx.redhat.com
>> Windowing system distributor `Fedora Project', version 11.0.10705000
>> configured using `configure  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic''
>>
>> Important settings:
>>   value of $LC_ALL: nil
>>   value of $LC_COLLATE: nil
>>   value of $LC_CTYPE: nil
>>   value of $LC_MESSAGES: nil
>>   value of $LC_MONETARY: nil
>>   value of $LC_NUMERIC: nil
>>   value of $LC_TIME: nil
>>   value of $LANG: sv_SE.utf8
>>   value of $XMODIFIERS: nil
>>   locale-coding-system: utf-8-unix
>>   default-enable-multibyte-characters: t
>>
>> Major mode: SES
>>
>> Minor modes in effect:
>>   tooltip-mode: t
>>   tool-bar-mode: t
>>   mouse-wheel-mode: t
>>   menu-bar-mode: t
>>   file-name-shadow-mode: t
>>   global-font-lock-mode: t
>>   font-lock-mode: t
>>   blink-cursor-mode: t
>>   global-auto-composition-mode: t
>>   auto-composition-mode: t
>>   auto-encryption-mode: t
>>   auto-compression-mode: t
>>   line-number-mode: t
>>   transient-mark-mode: t
>>
>> Recent input:
>> <tab> 1 <tab> <backspace> <return> C-o 2 <return> <tab> 
>> <left> ( + SPC B 1 SPC A 2 <return> <return> <return> 
>> C-n C-o 3 <return> ( + SPC B 2 SPC A 3 <return> C-n 
>> C-o C-p C-o 4 <return> C-p C-SPC C-f M-w C-n C-b C-y 
>> C-n C-y C-x C-s <help-echo> M-x r e p o r t - e m a 
>> c s - b u g <return>
>>
>> Recent messages:
>>   [2 times]
>> Yanking...done
>> Mark set
>> Yanking...done
>>   [2 times]
>> Yanking...done
>>   [2 times]
>> Yanking...done
>> Saving file /home/g=f6ran/x.ses...
>> Wrote /home/g=f6ran/x.ses