-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will flydiff work after committing changes from terminal? #186
Comments
Hi! This actually seems to work fine for me. Do you have some non-default settings maybe? Try writing a step-by-step reproduction scenario. |
My settings (use-package diff-hl
:config
(global-diff-hl-mode)
(diff-hl-flydiff-mode)
(if (not (display-graphic-p))
(diff-hl-margin-mode t))) Instead of writing a textual description, a gif may give a better demonstration. So, after saving and committing, the indicators are still there until I run |
I can see it now. Is that a real nuisance? Do you know if similar editors have this behavior? Something like VS Code aside, which likely plugs into inotify, which I'm not sure we can do. Not easily, at least. The alternative would be running the equivalent of |
Hi again! I've though about this some more, and there are several ways you can have some improved behavior. The first one is simply having that diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index e366eec..56be107 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -36,6 +36,13 @@
"The idle delay in seconds before highlighting is updated."
:type 'number)
+(defcustom diff-hl-flydiff-always-check t
+ "Non-nil to always run the full status check of the current file.
+
+This will make it always pick up changes in HEAD even when commit is made
+outside of Emacs (e.g. in terminal) before any changes to buffers are made."
+ :type 'boolean)
+
(defvar diff-hl-flydiff-modified-tick nil)
(defvar diff-hl-flydiff-timer nil)
(make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
@@ -47,14 +54,16 @@
(defun diff-hl-flydiff-update ()
(unless (or
(not diff-hl-mode)
- (eq diff-hl-flydiff-modified-tick (buffer-chars-modified-tick))
+ (unless diff-hl-flydiff-always-check
+ (eq diff-hl-flydiff-modified-tick (buffer-chars-modified-tick)))
(not buffer-file-name)
(file-remote-p default-directory)
(not (file-exists-p buffer-file-name)))
(diff-hl-update)))
(defun diff-hl-flydiff/modified-p (_state)
- (buffer-modified-p))
+ (or diff-hl-flydiff-always-check
+ (buffer-modified-p)))
;;;###autoload
(define-minor-mode diff-hl-flydiff-mode Please go ahead and test it when you have the time. The downside is it will produce somewhat wasteful work, and in larger repositories Another approach would be to use Let me know if you're still around and interesting in trying out the patches -- I will do one for the second option as well. |
Any changes are correctly updated in the buffer immediately if flydiff is enabled. So I think it works at this point.
But I notice that if I commit those changes, instead of using built-in
vc
ormagit
, but via git cli from terminal, which is how I get used to doing all reversion stuffs, the buffer won't be updated and those indicators in fringe are still there.I inspected using
vc
and the buffer then is updated on the fly. So is this behavior a desired result that only revision operations performed inside Emacs will trigger diff-hl-update to update buffer on time?The text was updated successfully, but these errors were encountered: