Discuss nice git diff settings for Org

This commit is contained in:
TEC 2021-03-07 11:24:49 +08:00
parent 77b5a6d0f8
commit 02a761c71e
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 16 additions and 0 deletions

View File

@ -3987,6 +3987,22 @@ Then set Emacs as the default editor
#+begin_src shell :tangle (if (string= (shell-command-to-string "xdg-mime query default text/org") "emacs-client.desktop\n") "no" "setup.sh")
xdg-mime default emacs.desktop text/org
#+end_src
**** Git diffs
Protesilaos wrote a [[https://protesilaos.com/codelog/2021-01-26-git-diff-hunk-elisp-org/][very helpful article]] in which he explains how to change the
git diff chunk heading to something more useful than just the immediate line
above the hunk --- like the parent heading.
This can be achieved by first adding a new diff mode to git in =~/.config/git/attributes=
#+begin_src fundamental
,*.org diff=org
#+end_src
Then adding a regex for it to =~/.config/git/config=
#+begin_src gitconfig
[diff "org"]
xfuncname = "^(\\*+ +.*)$"
#+end_src
**** Development
Testing patches from the ML is currently more hassle than it needs to be. Let's
change that.