Option of not opening a new empty document on startup

If you double-click on a .tm or pass a file name to TeXmacs in a shell (command line) then you have not only the targeted file opened but also another undesired empty file opened. It ask for a confirm when you have already saved the targeted file and try to close the window that “there is still some file not saved, are you sure to close?” This is really very annoying. I think this blank document should at least considered as “not modified” and do not prevent me from closing the window and make me always more worried about that I forgot to save some useful thing than needed.

This seems to be a very old issue that was once mentioned here texmacs-users - Re: [TeXmacs] An empty document opened every time I open a file? - arc in 2016, and now it is 2023!

Best respect and regards.

Hi @hyuyao and welcome to the forum.

I know how to get TeXmacs to consider every new file as “already saved”, but I do not know how to do it for the first document only. One needs to put the following

(if (not (buffer-has-name? (current-buffer)))
   (buffer-pretend-saved (current-buffer)))

in my-init-buffer.scm (please ask if you need help to do that).

I have seen in one test that if one writes something in the new file, then TeXmacs will ask if the user wants to save it before closing (I did not guess that from buffer-has-name?); but it will not ask if the file is not modified.

Perhaps this is enough for you. And maybe someone knows what to do for the first file only.