From: Don Armstrong Date: Wed, 12 Feb 2014 01:59:39 +0000 (-0800) Subject: add working with org post X-Git-Url: https://git.donarmstrong.com/?p=don.git;a=commitdiff_plain;h=afd187e65eb57bfc98ab3adb6ec35b319b6d6e75 add working with org post --- diff --git a/posts/working_with_org.mdwn b/posts/working_with_org.mdwn new file mode 100644 index 0000000..9f5bbc0 --- /dev/null +++ b/posts/working_with_org.mdwn @@ -0,0 +1,39 @@ +[[!meta title="Working with Org-mode: Committing Changes Everywhere"]] + +I'm a huge fan of [Org-mode](http://orgmode.org/), and I keep all of +my org-mode files in git repositories which are under +[myrepos](http://myrepos.branchable.com/) control. + +However, because I often make lots of changes to my agenda and notes, +I hate having to manually visit each individual project and make +changes to it. +[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.] + +Luckily, myrepos can easily run a command in parallel in all of the +repositories! The following "update_org_files" command will update all +of my org-file containing repositories in parallel: + +[[!format sh """ +#!/bin/bash + +ORG_GREP='-e .org$ -e .org_archive$ -e .org_done$' + +if [ "x$1" == "xdoit" ]; then + if git status --porcelain -z | grep -z '^ M' | grep -zq $ORG_GREP; then + git status --porcelain -z | grep -z '^ M' | grep -z $ORG_GREP | \ + sed -z 's/^ M//g' | \ + xargs -0 git commit -m'update org files' + git push; + fi; +else + emacsclient -n -e '(org-save-all-org-buffers)' >/dev/null 2>&1 + mr -d ~ -j5 run update_org_files doit; +fi; +"""]] + +An +[updated version](http://git.donarmstrong.com/?p=bin.git;a=blob_plain;f=update_org_files;hb=HEAD) +of this lives in my +[git repository](http://git.donarmstrong.com/bin.git) + +[[!tag tech org-mode emacs debian]]