Oct 26, 2014 - Sync Org-Mode Agenda files with MobileOrg

Comments

Introduction

The following article describes, how to sync your org agenda files with your mobile device. I use an android phone with MobileOrg, but the setup should work more or less with an iOS app like MobileOrg. I also assume, that you have a basic org-mode agenda setup working. But lets dive right into it.

Basic Understanding

To sync org-mode files with mobile devices, there is support within org-mode. With the commands org-mobile-push and org-mobile-pull org copy's a set of files into a defined directory or reads them from that directory. That folder can than be synchronized with the mobile device via a bunch of mechanisms:

  • WebDAV
  • Dropbox
  • UbuntuOne
  • ssh
  • git

The easiest way might be via dropbox, but i will describe my setup via git. I will describe, how to sync your org-files with a local folder and will cover the syncing of that folder with your mobile device later.

Basic Setup

You can configure your org-mode directory by setting the variable org-directory, which in my case is set to

    (setq
     org-directory "/home/frosch03/Org/")

Create your directory for your mobile-org sync within your org-directory and tell it's name to emacs by setting the variable org-mobile-directory which in my case is

    (setq org-mobile-directory "/home/frosch03/Org/mobile-org/")

Set org-mobile-files to the list of files, that org-mode should copy into your mobile directory. For example

    (setq org-mobile-files
          (quote ("~/Org/todo.org"   "~/Org/notes.org"
                  "~/Org/privat.org" "~/Org/work.org")))

Pushing to mobile-org

You can push files into your mobile-org directory with the command org-mobile-push. This will copy the files specified within org-mobile-files into your mobile org directory.

It will then create a agends.org file, that contains specific agenda views, that are exported.

After that, links to all relevant files (defined within org-mobile-files) are stored inside an index file, that can be specified by the variable org-mobile-index-file

    (setq org-mobile-index-file "index.org")

Last but not least, a checksums.dat file is written, that contains md5 checksums of each file, so that changed files can easily be identified.

Pulling from mobile-org

Let's assume, you done some changes on your mobile device and transferred them back into the mobile org director. With the command org-mobile-pull, you read those changes back into your local org-mode world.

Your mobile app captures all changes, that you made on your mobile device within mobileorg.org. After issuing org-mobile-pull all entries within mobileorg.org care copied into an org file (org-mobile-inbox-for-pull) within your org-directory. In my setup it's:

    (setq org-mobile-inbox-for-pull "~/Org/fromMobile.org")

So org-mode tries then to import these entries into your local org-mode files. For details see the documentation. It will then let you with an agenda view, and you must insert the remaining entries by hand.

Setup with git

So now that we have a setup, for writing into the mobile org directory and also reading from it, how to sync it with your mobile device. As mentioned earlier, the easiest way would be dropbox. But i like to keep my data close to me, so i sync my folder via git.

I've setup a server that is running gitolite. My mobile-org-folder is a git-repository, that i push to the one on my gitolite server. On my mobile, i use SGit to sync folders via git.

Last but not least, if you setup MobileOrg, to sync with ="SD-Card"=, you can specify a folder on your mobile. I point that folder to the folder of the mobile-org repository of SGit. (That is usually pretty deep in the file structure, mine is at: Android/data/me.sheimi.sgit/files/repo/mobileorg

Now after i did changes within MobileOrg, i switch over to SGit, stage everything, commit it and then push the changes to the server. Once back on the laptop, i pull the changes from the server, and issue org-mobile-pull, to integrate the changes to my agenda files.

Before i close emacs, i do a org-mobile-push followed by staging, committing and pushing the changes via git. (I assume, this can be automated also…)