branch: master
commit 2209370e6bfd0471f07d5198589102b3dbfe85a7
Author: PythonNut <[email protected]>
Commit: PythonNut <[email protected]>
Ensure working revisions are never stale
---
diff-hl-flydiff.el | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index c065831..04bf1b9 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -66,6 +66,11 @@
(advice-add 'vc-git-mode-line-string :override
#'diff-hl-flydiff/vc-git-mode-line-string)))
+(defun diff-hl-flydiff/working-revision (file)
+ "Like vc-working-revision, but always up-to-date"
+ (vc-file-setprop file 'vc-working-revision
+ (vc-call-backend (vc-backend file) 'working-revision file)))
+
(defun diff-hl-flydiff-make-temp-file-name (file rev &optional manual)
"Return a backup file name for REV or the current version of FILE.
If MANUAL is non-nil it means that a name for backups created by
@@ -114,14 +119,11 @@ This requires the external program `diff' to be in your
`exec-path'."
(if (file-directory-p "/dev/shm/")
"/dev/shm/"
temporary-file-directory))
- (rev (diff-hl-flydiff-create-revision
- file
- (vc-working-revision file
- (vc-responsible-backend file)))))
+ (rev (diff-hl-flydiff-create-revision file
+ (diff-hl-flydiff/working-revision file))))
(diff-no-select rev (current-buffer) "-U 0" 'noasync
(get-buffer-create " *diff-hl-diff*")))))
-
(defun diff-hl-flydiff/update (old-fun &optional auto)
(unless (and auto
(or