Start a new topic

Dropbox syncing best practice

Hi there,


I'm really liking beorg so far. Thanks for the efforts!


I am using Dropbox as the sync backend, so I can sync up with my Linux laptop. I'd like to find out what people think is the best way to set things up to ensure a smooth experience with as few as possible opportunities for conflicts. I'm mainly worried about loss of items/text if I'm working across both devices.


The manual says 'where possible make sure that you don’t have unsaved files on your computer that you are going to edit in beorg,' which is clearly sensible. But, while I could attempt to be completely strict in my usage, in practice I tend to leave Emacs and various org files open for days, and they are /usually/ saved, but perhaps not always. So trying to ensure consistency through self-discipline is probably going to cause me issues down the line.


So what can I do to give me some peace of mind?


There seem to be a few people out there also advocating the use of auto-revert-mode in Emacs, i.e. to ensure that the changes from beorg are loaded into Emacs, when a Dropbox sync occurs. However, this worries me, since as I understand it, it means that local changes will be overwritten, when there is a Dropbox sync and some changes in beorg, unless the laptop's changes have already been saved and synced back, before beorg made the change. Is that right?


I also wonder about setting Emacs up to automatically save org files at regular intervals, which would mitigate this to an extent, although this leaves the possibility of syncing partial items, which isn't ideal.


At the moment, I am restricting beorg to capturing items to one 'mobile-inbox.org' file only, and everything else I'm doing with it is read-only. But this means I'm missing out on much of what I can do with beorg. I'd just like to know I can do those things safely.


Any suggestions / best practice workflows / Emacs settings, etc.?


Thanks.


Peter.


If you are using a Unix environment, then you probably want to shell script something around rsync. Also, Emacs has a run-at-time function that you can use to regularly save key files that are open in your Emacs session. You can also use. Got to change control your key .Org files.
That’s “git” not “got”...

I use Linux also, and I use the Dropbox software integrated with GNome, silently syncing Dropbox space.

I had some conflicts happening sometimes, mainly when the dropbox deamon crashed leading to no more background sync.

But I never suffered any real loss of data, as when it happens, BeOrg saves the conflicting file as something like "xxx.org - conflicting version 01/07/2019".

To try to make it happen as unfequently as possible, I eventually put all the files but inbox.org are in the read-only list.

If you use Working Copy on iOS (a fantastic git client) you can use its feature called "synced directories" to effectively use git with beorg. You would setup beorg to sync with iCloud and then Working Copy can setup a git repository in beorgs iCloud directory and then handle commits, etc. You would need to switch to Working Copy to commit, push, etc so depending on the sort of workflow you want this might be too fiddly for some users.

I use dropbox for syncing between linux and iphone.


I've got my emacs (spacemacs actually, but it is a general emacs solution) to autosave files and autobackup files on each save (just in case). The implementation is here https://github.com/syl20bnr/spacemacs/pull/11903


The save to backup hook is given here https://github.com/syl20bnr/spacemacs/pull/11903/files#diff-8b4d8dd934735ec60803acf0f1f19ac4R48


It still sometimes results in `tasks.org - conflicting copy 01/07/2019`, but quite rarely, if I edit file in emacs and on mobile at the same time. In general it I think this is acceptable.


Also, since org is just plain text, I ediff the `tasks.org` and `tasks.org - conflicting copy ...` and had no issues merging the edits yet.

Matt,


Are you going to do anything about having BeOrg handle Dropbox directory hierarchies?  I'm considering using Org to generate a (basic) website.  That will mean that I have Org files in one (hierarchy of) directory(s) and image/media in another (hierarchy of) directory(s).   I'll use Org to publish my website, but I'll Rsync my Org & Image files up to Dropbox to refer to them with BeOrg.  Naturally, I'll want to keep the hierarchy the same so that the external relative links continue to work in the Org files.


Make sense?

This is something I do want to support. I'm currently trying to build up the number of beorg users to help finance features such as these which primarily benefit more advanced users. Regardless of how that goes I will bring support for subdirectories - ideally in the next few months.

This thread inspired me to make Dropbox sync finally work for me, too. Until now, I only used beorg to capture to an inbox file that wasn't managed by org-agenda on my Mac, and limited myself to only view the rest, but never edit, because the Mac wouldn't pick up the changes.


I don't like to enable `global-auto-revert-mode`. But I found you can do this:


1) Enable auto-saving of org buffers:   (add-hook 'auto-save-hook 'org-save-all-org-buffers)

2) Enable auto-loading from Dropbox: 

; ~/USERNAME/Dropbox/path/to/org/files/.dir-locals.el
; Enable auto-revert-mode for buffers from files from this directory:
((nil . ((eval . (auto-revert-mode 1)))))


With the settings from `.dir-locals.el` now the buffers are auto-loaded (reverted) from disk, i.e. when I change stuff from the dropbox.


I am so happy with this setup that I wrote this up as step-by-step instructions:

https://christiantietze.de/posts/2019/03/sync-emacs-org-files/


Beorg is great, and with Dropbox sync I can now capture and do more stuff on the go! :)

Thanks for writing up this advice in a blog post for other users. I do hope in time to have Dropbox sync automatically pick up changes in the same way as iCloud sync does - but for now your advice should be invaluable for others who want to use Dropbox sync in this way.

Login or Signup to post a comment