]> code.delx.au - gnu-emacs-elpa/commitdiff
Allow using --patience through vc-git-diff-switches
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 15 May 2016 00:01:18 +0000 (03:01 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 15 May 2016 00:01:18 +0000 (03:01 +0300)
Closes #9.

README.md
diff-hl.el

index b8bbe3a2724188fc231329144320e1daf2aaefb0..725466b46d62cefe238ab00cf47b0059156a94a6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -52,6 +52,16 @@ Notes
   it's only accurate when the buffer is in saved state. Check out\r
   `diff-hl-flydiff-mode`, it aims to handle unsaved buffers as well.\r
 \r
+* To use an\r
+  [alternative diff algorithm](http://stackoverflow.com/questions/32365271/whats-the-difference-between-git-diff-patience-and-git-diff-histogram)\r
+  with Git, add a corresponding argument to `vc-git-diff-switches`,\r
+  e.g. `(setq vc-git-diff-switches '("--histogram"))`. Using the\r
+  `diff.algorithm` option doesn't work\r
+  [because](http://article.gmane.org/gmane.comp.version-control.git/294622)\r
+  `vc-git-diff` calls `git diff-index`. `diff-hl-flydiff-mode` does\r
+  not support alternative algorithms, because it uses the external\r
+  `diff` program.\r
+\r
 * We conflict with other modes when they put indicators on the fringe,\r
   such as [Flycheck](https://github.com/flycheck/flycheck). This is\r
   rarely a significant problem, since if you're using such a mode,\r
index 106a487efb13675ec9006b240666bd37158a28e2..c52bf0e2a3f43aac5737d6f31983e3b44ec0e422 100644 (file)
 (defvar vc-svn-diff-switches)
 
 (defmacro diff-hl-with-diff-switches (body)
-  ;; https://github.com/dgutov/diff-hl/issues/67
-  `(let ((vc-git-diff-switches '("-U0"))
+  `(let ((vc-git-diff-switches
+          ;; https://github.com/dgutov/diff-hl/issues/67
+          (cons "-U0"
+                ;; https://github.com/dgutov/diff-hl/issues/9
+                (and (listp vc-git-diff-switches)
+                     (cl-remove-if-not
+                      (lambda (arg)
+                        (member arg '("--histogram" "--patience" "--minimal")))
+                      vc-git-diff-switches))))
          (vc-hg-diff-switches nil)
          (vc-svn-diff-switches nil)
          (vc-diff-switches '("-U0"))