Texmacs_home_path

Hi all, ok so I need to put my .TeXmacs directory in a non-standard location (a Google Drive folder under MacOS) in order to share it between my computers (a not that recent iMac and a recent Macbook Air). Unfortunately, setting the environment variable TEXMACS_HOME_PATH had no effect, so I did a hack of sorts making a symbolic link in my home directory pointing to the relevant place on my Google Drive folder. This works fine as far as sharing is concerned, yet there is one problem: autosave files (e.g. foo.tm~) are written but disappear almost instantly. Worse, I wasn’t able to determine where they go (which is quite strange for it’s own sake). So any help will be appreciated. Krzysztof

PS For the record I’ve been using TeXmacs for more than 10 years now, it’s an otherwise fantastic tool! The only one I can write math and think at the same time…

Hi @Kris and welcome to the forum.

If setting the environment variable TEXMACS_HOME_PATH cannot be done from the shell you are launching TeXmacs from (I do not have my Linux installation for a few days and cannot test it, but I take for good what you said that fits with something I recall hearing from @mgubi—that is that the variable is set internally when starting TeXmacs, I hope I remember well), maybe the following could work (it feels like a hack).

Set in each of the my-init-texmacs.scm files the following:

(setenv "TEXMACS_HOME_PATH" path-to-shared-folder)

Sessions now should see the shared folder as home path. I have made only one test, that is I write this command in my default my-init-texmacs.scm, started TeXmacs, opened my-init-texmacs.scm through the Developer menu and verified that TeXmacs opens the file in the directory I set.

I did not test the autosave files as I did not figure out when one such file is created, and I do not know if there are any other “side-effects”.

On the other hand, after I removed the setenv command from my initialization file TeXmacs showed me the welcome file at the first start, so the software “knows” that its path has been altered.

You could try posting your question on the mailing list as well, as Joris van der Hoeven follows that regularly and only rarely the forum, as far as I understand.

Hi @pireddag, many thx for your quite exhaustive answer. I will test your suggestion to modify the .scm file when I return home! In the meantime I identified the problem with the backup files (.tm~): it’s a Google Drive issue. It seems that the latter doesn’t like files ending with ~, to the point that it throws them away without further ado… Fortunately into the Google Drive bin, so I was able to recover my lost bit of lecture notes using the web app. However it is not optimal…

I realized that you also need to load the “master” my-init-texmacs.scm file at the beginning of each “local” my-init-texmacs.scm file

E.g.

(load path-to-shared-my-init-texmacs.scm)
(setenv "TEXMACS_HOME_PATH" path-to-shared-folder)

assuming that you maintain control over the shared my-init-texmacs.scm, this load command is not going to be risky (I am thinking that loading an arbitrary file could cause the execution of any command and I do not know what is the security that TeXmacs applies over my-init-texmacs.scm, but if you know what is in the file you are loading the caution does not apply).

I would just like to say that setting the TEXMACS_HOME_PATH environment variable definitely affects TeXmacs on Linux. I regularly use it for testing purposes.

@Kris How did you set the environment variable and how did you start TeXmacs (from the terminal or graphically)?

1 Like

@jeroen: I tried to set TEXMACS_HOME_PATH at the level of the shell’s config file (like .bashrc, I tried several ones), without noticeable results l. And yes, I typically use the Mac app, so perhaps I should use “open” from the terminal (?)

Yes, I think so. I don’t have a Mac myself, but, judging from some other comments on this forum (I believe surrounding the detection of Python on the path), it seems that the graphical user interface on Mac somehow sees a different environment than the terminal.

This might help:

Although a symlink seems like a perfectly fine solution to me.