emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [SYNC] How do you sync your org-mode files between n devices (n > 2)
Date: Thu, 5 Sep 2013 14:54:04 +0200	[thread overview]
Message-ID: <20130905125404.GC2392@kuru.dyndns-at-home.com> (raw)
In-Reply-To: <m2fvtjjvpt.fsf@polytechnique.org>

Just a few typo/editorial comments.

On Thu, Sep 05, 2013 at 02:31:42PM +0200, Alan Schmitt wrote:
> 
> * Synchronizing org files with Unison
> 
> This describes how to synchronize org files using the [[http://www.cis.upenn.edu/~bcpierce/unison/][Unison file synchronizer]],
> as well as how to configure it to use an external tool to merge conflicting
> edits.
> 
> ** Prerequisites
> 
> You should have Unison up and running. Binaries can be found [[http://www.cis.upenn.edu/~bcpierce/unison/download.html][here]] and the
> documentation is [[http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html][here]].
> 
> ** Synchronization
> 
> Unison is a file synchronizer, thus it may be used to synchronize org files. To
> configure Unison, on uses a /profile/ which states where the things to

on uses -> one uses

> synchronize are as well as some options. Assuming I want to synchronize the
> files in ~/Users/schmitta/dir1~ and ~/Users/schmitta/dir2~, the profile would
> look like this
> 
> #+BEGIN_EXAMPLE
> root = /Users/schmitta/dir1
> root = /Users/schmitta/dir2
> #+END_EXAMPLE
> 
> In most cases Unison will be used with a remote machine. The local machine is
> called the /client/ and the remote one the /server/. For such remote
> synchronization, the ~unison~ binary must be installed in the server as
> well. The simplest way to connect to the machine is using ssh. One should check
> that unison can be found there by doing ~ssh user@remote unison -version~. If
> ~unison~ cannot be found in the path, one may set the ~servercmd~ option as
> indicated in the next example.
> 
> (Please see the [[http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#roots][manual section on roots]] for further details.)
> 
> #+BEGIN_EXAMPLE
> root = /Users/schmitta/dir1
> root = ssh://user@remote/relative/path/to/dir2
> 
> servercmd = /usr/bin/unison
> #+END_EXAMPLE
> 
> ** Merging
> 
> As Unison works on the level of files, it will trigger a /conflict/ if both
> files have changed since the last synchronization. In that case one can only
> choose which file to keep, which is not satisfying. Unison offers the

Maybe satisfactory is better than satisfying?

> possibility to use external tools to merge the files. There is an [[http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#merge][extensive
> manual section]] regarding this, we'll just describe how to use emacs and ediff to
> do it.
> 
> For better merging, we will ask unison to keep the last synchronized version of
> every org file on the client; this way we can use ediff with ancestor. These
> ~currentbackup~ files may live alongside the synchronized files (with names of
> the form ~.bak.version.name~, which is configurable) or in a central location.
> 
> Here is the modified configuration file.
> 
> #+BEGIN_EXAMPLE
> root = /Users/schmitta/dir1
> root = ssh://user@remote/relative/path/to/dir2
> 
> servercmd = /usr/bin/unison
> 
> backupcurrent = Name *.org
> backuplocation = local
> maxbackups = 0
> 
> merge = Name *.org -> emacsclient -c --eval '(ediff-merge-files-with-ancestor "CURRENT1" "CURRENT2" "CURRENTARCH" nil "NEW")'
> 
> #+END_EXAMPLE
> 
> The ~backupcurrent~ option tells unison to keep a backup of the last
> synchronized version of ever file with an ~org~ extension. The location of the

ever file -> every file

> backup should be local (alongside the file). Finally, no other backup should be
> created.
> 
> Next follows the merge command. For every org file in conflict, use the command
> that launches a new emacs frame calling the ediff with ancestor function. The
> ~CURRENT1~, ~CURRENT2~, and ~CURRENTARCH~ strings are  replaced with the file
> from the first root, the file from the second root, and the last synchronized
> version. The ~NEW~ file is where Unison expects the file to be saved (which will
> be done by the ediff session).
> 
> Thus, when an org file has been modified on both hosts, an ediff session will be
> launched in a new frame. Closing the frame will make Unison commit the merge (it
> waits until the command has finished).
> 
> If one does not want to use backups, it's possible to use the simpler ediff
> (without ancestor) command as follows.
> 
> #+BEGIN_EXAMPLE
> root = /Users/schmitta/dir1
> root = ssh://user@remote/relative/path/to/dir2
> 
> servercmd = /usr/bin/unison
> 
> merge = Name *.org -> emacsclient -c --eval '(ediff-merge-files "CURRENT1" "CURRENT2" nil "NEW")'
> 
> #+END_EXAMPLE

This a very clear and complete write-up.  Thanks a lot Alan!

:)

-- 
Suvayu

Open source is the future. It sets us free.

  reply	other threads:[~2013-09-05 12:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 21:34 [SYNC] How do you sync your org-mode files between n devices (n > 2) noreply
2013-09-04  6:04 ` Suvayu Ali
2013-09-04  6:30   ` Xiao-Yong Jin
2013-09-04  7:43     ` Suvayu Ali
2013-09-04  8:00       ` Torsten Wagner
2013-09-05  8:50       ` Alan Schmitt
2013-09-05  9:42         ` Suvayu Ali
2013-09-05 10:00           ` Alan Schmitt
2013-09-05 10:26             ` Karl Voit
2013-09-05 11:42               ` Jonas Hörsch
2013-09-05 13:03                 ` [SYNC] How do you sync your org-mode files between ndevices (n > 2)) Alan Schmitt
2013-09-05 11:25             ` [SYNC] How do you sync your org-mode files between n devices (n > 2) Suvayu Ali
2013-09-05 12:31               ` Alan Schmitt
2013-09-05 12:54                 ` Suvayu Ali [this message]
2013-09-05 13:24                   ` Alan Schmitt
2013-09-05 16:14                 ` [SYNC] How do you sync your org-mode files between ndevices (n > 2)) Ramon Diaz-Uriarte
2013-09-05 13:37             ` [SYNC] How do you sync your org-mode files between n devices (n > 2) Robert Horn
2013-09-04  6:21 ` Jambunathan K
2013-09-04  6:47 ` Paul Rudin
2013-09-04  6:50 ` Samuel Loury
2013-09-05 20:00 ` Marc Ihm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130905125404.GC2392@kuru.dyndns-at-home.com \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).