bugGNU TeXmacs - Bugs: bug #61418, Potential data loss without...


You are not allowed to post comments on this tracker with your current authentication level.

bug #61418: Potential data loss without warning after opening my-init-texmacs.scm

Submitted by:  JW <jeronim>
Submitted on:  Wed 03 Nov 2021 02:42:46 PM UTC  
Category:  None Priority:  5 - Normal
Item Group:  Error Status:  Confirmed
Privacy:  Public Assigned to:  Massimiliano Gubinelli <mgubi>
Originator Name:  Open/Closed:  Open
Release:  2.1 Release:  None
Fixed Release:  None Fixed Release: 

Mon 06 Dec 2021 11:15:25 PM UTC, comment #3: 

The unsaved, modified buffer is erroneously marked as saved by `(buffer-pretend-saved (current-buffer)))` in `buffer-set-default-style` (file TeXmacs/progs/texmacs/texmacs/tm-files.scm).

The reason this function is called is because `(cpp-buffer-close)` is called when another window is closed, which calls `kill_buffer` and `get_new_view` (in src/Texmacs/Data/new_window.cpp). This in turn runs `init-buffer.scm`, which calls `buffer-set-default-style`.

In summary, the sequence of function calls leading to this is:

-> kill_buffer
-> get_new_view
-> init-buffer.scm
-> buffer-set-default-style
-> buffer-pretend-saved

After opening and closing a new window, we end up with two views on the unsaved modified buffer, which can be checked by doing (buffer->views (current-buffer)) before and after.

I believe this shouldn't be the case and that kill_buffer shouldn't open a new view when the buffer is already opened in another window. Is this interpretation correct?

JW <jeronim>
Mon 06 Dec 2021 12:44:37 PM UTC, comment #2: 

I've done some testing and this seems to have been introduced in svn revision 13417 (git commit 7e010d0e0bc1e8d76509b49585668e51b681e159) "New attempt to fix bug #59996: New documents are sometimes created with "no-style"".

JW <jeronim>
Tue 09 Nov 2021 04:59:59 PM UTC, comment #1: 

The bug does not occur when using the 'Emacs' look and feel and 'Multiple documents share window', but it does occur with the default settings under MacOS.

The bug does not seem to be related to the my-init-texmacs.scm file: it also occurs when open (e.g.) a help file.

No idea yet how to correct it, so I keep it on the list for now.

Joris van der Hoeven <vdhoeven>
Project Administrator
Wed 03 Nov 2021 02:42:46 PM UTC, original submission:  

The following sequence allows closing unsaved work without being warned of potential data loss:

1) Open TeXmacs
2) Make changes to the empty new document that appears, without saving the changes
3) Developer -> Open my-init-texmacs.scm
4) Close my-init-texmacs.scm
5) Close the unsaved new document

No warning is given when closing the unsaved document. Note that editing my-init-texmacs.scm is not necessary, simply opening it suffices.

JW <jeronim>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by vdhoeven (Posted a comment)
  • -email is unavailable- added by jeronim (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-09 vdhoeven StatusNone => Confirmed
        Assigned toNone => mgubi

    Back to the top

    Powered by Savane 3.7