[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/diff-hl 65a5de16e2 2/2: Merge pull request #225 from wy
From: |
ELPA Syncer |
Subject: |
[elpa] externals/diff-hl 65a5de16e2 2/2: Merge pull request #225 from wyuenho/fix-171 |
Date: |
Thu, 5 Dec 2024 18:57:47 -0500 (EST) |
branch: externals/diff-hl
commit 65a5de16e21c87b7c12a78a63fc3b57e07c03c86
Merge: d9f54b512a e736917fba
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: GitHub <noreply@github.com>
Merge pull request #225 from wyuenho/fix-171
Fix #171 by updating changed files in the last commit
---
README.md | 1 -
diff-hl.el | 65 ++++++++++++++++++++++++++------------------------------------
2 files changed, 27 insertions(+), 39 deletions(-)
diff --git a/README.md b/README.md
index bce0b71aaa..c473d7e189 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,6 @@ If you're using a version before 2.4.0, it defines
`magit-revert-buffer-hook`
When using Magit 2.4 or newer, add this to your init script:
```lisp
-(add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
```
diff --git a/diff-hl.el b/diff-hl.el
index c8f7887c0a..c266fa6b86 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -1000,49 +1000,38 @@ The value of this variable is a mode line template as in
diff-hl-command-map)
(declare-function magit-toplevel "magit-git")
-(declare-function magit-unstaged-files "magit-git")
+(declare-function magit-git-items "magit-git")
-(defvar diff-hl--magit-unstaged-files nil)
-
-(defun diff-hl-magit-pre-refresh ()
- (unless (and diff-hl-disable-on-remote
- (file-remote-p default-directory))
- (setq diff-hl--magit-unstaged-files (magit-unstaged-files t))))
+(define-obsolete-function-alias 'diff-hl-magit-pre-refresh 'ignore "1.11.0")
(defun diff-hl-magit-post-refresh ()
(unless (and diff-hl-disable-on-remote
(file-remote-p default-directory))
- (let* ((topdir (magit-toplevel))
- (modified-files
- (mapcar (lambda (file) (expand-file-name file topdir))
- (delete-consecutive-dups
- (sort
- (nconc (magit-unstaged-files t)
- diff-hl--magit-unstaged-files)
- #'string<))))
- (unmodified-states '(up-to-date ignored unregistered)))
- (setq diff-hl--magit-unstaged-files nil)
- (dolist (buf (buffer-list))
- (when (and (buffer-local-value 'diff-hl-mode buf)
- (not (buffer-modified-p buf))
- ;; Solve the "cloned indirect buffer" problem
- ;; (diff-hl-mode could be non-nil there, even if
- ;; buffer-file-name is nil):
- (buffer-file-name buf)
- (file-in-directory-p (buffer-file-name buf) topdir)
- (file-exists-p (buffer-file-name buf)))
- (with-current-buffer buf
- (let* ((file buffer-file-name)
- (backend (vc-backend file)))
- (when backend
- (cond
- ((member file modified-files)
- (when (memq (vc-state file) unmodified-states)
- (vc-state-refresh file backend))
- (diff-hl-update))
- ((not (memq (vc-state file backend) unmodified-states))
- (vc-state-refresh file backend)
- (diff-hl-update)))))))))))
+ (let* ((topdir (magit-toplevel))
+ (modified-files
+ (magit-git-items "diff-tree" "-z" "--name-only" "-r" "HEAD~"
"HEAD"))
+ (unmodified-states '(up-to-date ignored unregistered)))
+ (dolist (buf (buffer-list))
+ (when (and (buffer-local-value 'diff-hl-mode buf)
+ (not (buffer-modified-p buf))
+ ;; Solve the "cloned indirect buffer" problem
+ ;; (diff-hl-mode could be non-nil there, even if
+ ;; buffer-file-name is nil):
+ (buffer-file-name buf)
+ (file-in-directory-p (buffer-file-name buf) topdir)
+ (file-exists-p (buffer-file-name buf)))
+ (with-current-buffer buf
+ (let* ((file buffer-file-name)
+ (backend (vc-backend file)))
+ (when backend
+ (cond
+ ((member file modified-files)
+ (when (memq (vc-state file) unmodified-states)
+ (vc-state-refresh file backend))
+ (diff-hl-update))
+ ((not (memq (vc-state file backend) unmodified-states))
+ (vc-state-refresh file backend)
+ (diff-hl-update)))))))))))
(defun diff-hl-dir-update ()
(dolist (pair (if (vc-dir-marked-files)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/diff-hl 65a5de16e2 2/2: Merge pull request #225 from wyuenho/fix-171,
ELPA Syncer <=