]> git.donarmstrong.com Git - don.git/blob - posts/working_with_org.mdwn
add working with org post
[don.git] / posts / working_with_org.mdwn
1 [[!meta title="Working with Org-mode: Committing Changes Everywhere"]]
2
3 I'm a huge fan of [Org-mode](http://orgmode.org/), and I keep all of
4 my org-mode files in git repositories which are under
5 [myrepos](http://myrepos.branchable.com/) control.
6
7 However, because I often make lots of changes to my agenda and notes,
8 I hate having to manually visit each individual project and make
9 changes to it.
10 [And it's also annoying when I forget to commit a specific change and then have to try to get my laptop and desktop back into sync.]
11
12 Luckily, myrepos can easily run a command in parallel in all of the
13 repositories! The following "update_org_files" command will update all
14 of my org-file containing repositories in parallel:
15
16 [[!format sh """
17 #!/bin/bash
18
19 ORG_GREP='-e .org$ -e .org_archive$ -e .org_done$'
20
21 if [ "x$1" == "xdoit" ]; then
22     if git status --porcelain -z | grep -z '^ M' | grep -zq $ORG_GREP; then
23         git status --porcelain -z | grep -z '^ M' | grep -z $ORG_GREP | \ 
24         sed -z 's/^ M//g' | \
25             xargs -0 git commit -m'update org files'
26         git push;
27     fi; 
28 else
29     emacsclient -n -e '(org-save-all-org-buffers)' >/dev/null 2>&1
30     mr -d ~ -j5 run update_org_files doit;
31 fi;
32 """]]
33
34 An
35 [updated version](http://git.donarmstrong.com/?p=bin.git;a=blob_plain;f=update_org_files;hb=HEAD)
36 of this lives in my
37 [git repository](http://git.donarmstrong.com/bin.git)
38
39 [[!tag tech org-mode emacs debian]]