diff options
author | Tom Willemse | 2015-01-02 03:40:45 +0100 |
---|---|---|
committer | Tom Willemse | 2015-01-02 03:40:45 +0100 |
commit | bada4ecc1a09a3e4a98ae3449f6e6e7e6de19fef (patch) | |
tree | 4d342203736f3d4e739c5650aa58021cf572b381 /some-quick-git-diff-tips.post | |
download | blog-bada4ecc1a09a3e4a98ae3449f6e6e7e6de19fef.tar.gz blog-bada4ecc1a09a3e4a98ae3449f6e6e7e6de19fef.zip |
Initial commit
Diffstat (limited to 'some-quick-git-diff-tips.post')
-rw-r--r-- | some-quick-git-diff-tips.post | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/some-quick-git-diff-tips.post b/some-quick-git-diff-tips.post new file mode 100644 index 0000000..12a728d --- /dev/null +++ b/some-quick-git-diff-tips.post @@ -0,0 +1,51 @@ +;;;;; +title: Some quick git diff tips +tags: org-mode, lisp, config, git +date: 2013-08-11 00:54 +format: md +;;;;; + +A couple of quick tips. As you possibly know you can specify some +options to be used for diffs (and other things) per file type. The one +I'm interested in is the function name. + +## For org-mode + +The primary way of identifying which part of an org-mode document a +change occurs in seems to me to be the heading. So, in your +`$HOME/.gitconfig` put: + + [diff "org"] + xfuncname = "^\\*+.*" + +Which should show any lines starting with one or more `*` characters. +And then in `$XDG_CONFIG_HOME/git/attributes` or +`$HOME/.config/git/attributes` put: + + ,*.org diff=org + +## For lisp and lisp-like langauges + +For anything that resembles lisp (so Common Lisp, Emacs Lisp, Hy, +scheme, etc.) I would think that the easiest thing to do is just see +the closes top-level form. So, in your `$HOME/.gitconfig` put: + + [diff "lisp"] + xfuncname = "^\\([^ ]+ [^ ]+" + +Which should show the opening parenthesis and the first two words. For +example: + + (defun some-function-name + (defclass my-awesome-class + (define-route this-strange-route + +And then put in your `$XDG_CONFIG_HOME/git/attributes` or +`$HOME/.config/git/attributes`: + + ,*.lisp diff=lisp + ,*.el diff=lisp + ,*.hy diff=lisp + ,*.scm diff=lisp + +And possibly any other lisp-like language files you can think of. |