From: Dmitry Gutov Date: Sun, 15 May 2016 00:01:18 +0000 (+0300) Subject: Allow using --patience through vc-git-diff-switches X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/4bfa149d60024da408970e24edc8ece81eb0d32c Allow using --patience through vc-git-diff-switches Closes #9. --- diff --git a/README.md b/README.md index b8bbe3a27..725466b46 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,16 @@ Notes it's only accurate when the buffer is in saved state. Check out `diff-hl-flydiff-mode`, it aims to handle unsaved buffers as well. +* To use an + [alternative diff algorithm](http://stackoverflow.com/questions/32365271/whats-the-difference-between-git-diff-patience-and-git-diff-histogram) + with Git, add a corresponding argument to `vc-git-diff-switches`, + e.g. `(setq vc-git-diff-switches '("--histogram"))`. Using the + `diff.algorithm` option doesn't work + [because](http://article.gmane.org/gmane.comp.version-control.git/294622) + `vc-git-diff` calls `git diff-index`. `diff-hl-flydiff-mode` does + not support alternative algorithms, because it uses the external + `diff` program. + * We conflict with other modes when they put indicators on the fringe, such as [Flycheck](https://github.com/flycheck/flycheck). This is rarely a significant problem, since if you're using such a mode, diff --git a/diff-hl.el b/diff-hl.el index 106a487ef..c52bf0e2a 100644 --- a/diff-hl.el +++ b/diff-hl.el @@ -209,8 +209,15 @@ (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"))