2013-11-24 23:20:22 +01:00
|
|
|
#+TITLE:
|
2013-11-27 23:56:07 +01:00
|
|
|
#+STARTUP: showall
|
2013-11-24 23:20:22 +01:00
|
|
|
|
|
|
|
* Some quick git diff tips :org:lisp:config:
|
2013-11-24 23:04:18 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
** For org-mode
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
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:
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[diff "org"]
|
|
|
|
xfuncname = "^\\*+.*"
|
|
|
|
#+END_SRC
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
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:
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
,*.org diff=org
|
|
|
|
#+END_EXAMPLE
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
** For lisp and lisp-like langauges
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
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:
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[diff "lisp"]
|
|
|
|
xfuncname = "^\\([^ ]+ [^ ]+"
|
|
|
|
#+END_SRC
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
Which should show the opening parenthesis and the first two words.
|
|
|
|
For example:
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
(defun some-function-name
|
|
|
|
(defclass my-awesome-class
|
|
|
|
(define-route this-strange-route
|
|
|
|
#+END_EXAMPLE
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
And then put in your ~$XDG_CONFIG_HOME/git/attributes~ or
|
|
|
|
~$HOME/.config/git/attributes~:
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
,*.lisp diff=lisp
|
|
|
|
,*.el diff=lisp
|
|
|
|
,*.hy diff=lisp
|
|
|
|
,*.scm diff=lisp
|
|
|
|
#+END_EXAMPLE
|
2013-11-24 23:04:18 +01:00
|
|
|
|
2013-11-24 23:20:22 +01:00
|
|
|
And possibly any other lisp-like language files you can think of.
|