October 30, 2018 erobles

Working Emacs Lock Files and Syncthing

Emacs and Lock Files

Emacs is great for many reasons but it can be a 3 headed monster when it comes to configuring it. I recently ran into a interesting error when I was syncronizing my Org files in Syncthing.

The error I was getting was coming from my Android phone, basically every time I used Emacs to edit my Org files it would create a Lock file. Now a Lock file is simply a symlink that Emacs creates.

This Lock file was causing errors in my Android Syncthing client. Android cannot read symlinks the way Linux does and so it would throw an error in the Syncthing Android Client causing my files to not fully sync.
The Android would try to sync the symlink but it would fail and return an “Out of Sync”, error.

How to fix this error

Well luckily the fix was relatively easy but it does have one caveat.

First, the fix: (Disclaimer I use Spacemacs but this configuration works in Emacs as well) Simply add this line to your .spacemacs configuration (or your emacs.d)
(setq create-lockfiles nil)
You should place this configuration in your dotspacemacs/user-config (or user-config). The caveat is that Lock files will permanently disabled.

If you want to have Lock files once again simply comment out the previous line or delete it.

It’s Sync heaven

Now everything syncs up with no issues. It’s interesting that this small error happened but at least the fix was easy.

Tagged: , , , , ,