Watching for external edits stops in Linux

Hi all, first of all, thanks for your work on Joplin!

I use gvim to edit documents externally on linux in v 1.0.158. Unfortunately about half of the time, Joplin stops watching the file and does not see the updates from the external editor file. I have not been able to reproduce consistently, but it seems that the line

2019-05-31 13:00:51: "ExternalEditWatcher: Event: unlink: /home/zach/.config/joplin-desktop/edit-2440e4599062486daf5144b529a23d87.md"

is logged when this happens.

This is a big inconvenience and has caused me to lose work several times.

Should I file an issue on github?

Thanks!

I had the issue, but it happened consistently after about 3 saves (I don’t remember exactly). To fix this I needed to start vim like this
gvim -c 'set backupcopy=yes'
And to get that into joplin (using gnome-terminal on linux)


(Replace vim with gvim)

If this doesn’t fix your issue, you should probably open an issue on github.

2 Likes

Ah, just found this

I will try it

Putting it in .../ftplugin/markdown.vim or your vimrc as suggested by matthewmoppett is probably the easiest way to handle it.

Thanks @CalebJohn, that appears to have fixed it!

Maybe we should add this to the FAQ?

Yeah, it might be a good thing in the FAQ.

I think what would be more useful is to change the “Watching” button to say “Error” if an “unlink” event happens and possibly point to a place where they can find out how to fix it.

Another question is “should Joplin be able to tolerate these unlink events?” it would be nice if it just worked. Maybe chokidar has something that can handle it.

This seems like a relevant issue: https://github.com/paulmillr/chokidar/issues/35, but it was closed long ago.

In any case, imo this code https://github.com/laurent22/joplin/commit/0a5ad1d6286fbb1632f56a43e9a8298229ea7ca5 needs to be changed so at least the button displays an accurate status, or maybe even can recover.

There are actually quite a few problems with fsevent and chokidar. And they are being worked on upstream.

I can't say anything to that, but maybe @laurent can.

I made an issue: https://github.com/laurent22/joplin/issues/1614

Same issue with xed on Linux Mint. I was using that since it came default. I get 1 save before it stops capturing changes. It seems that the -nb (no backup) argument for xed has been depreciated (found it on a manpage somewhere online).

Anyone using gedit? Is that working?

i’m using gedit on linux debian. 1 save before it stops capturing changes! i opened the discussion here: Bug saving notes in external editor