[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/diff-hl a625033 10/25: Update Magit bridge to use the r
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/diff-hl a625033 10/25: Update Magit bridge to use the recommended approach |
Date: |
Sun, 20 Dec 2020 05:07:01 -0500 (EST) |
branch: externals/diff-hl
commit a625033fb1dde83f6e4c2fc21f632b22ec34b609
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Update Magit bridge to use the recommended approach
Fixes #136
---
README.md | 1 +
diff-hl.el | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index de07ffe..9bc4576 100644
--- a/README.md
+++ b/README.md
@@ -114,5 +114,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 d30c0a9..f504ddf 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -581,12 +581,22 @@ The value of this variable is a mode line template as in
(declare-function magit-toplevel "magit-git")
(declare-function magit-unstaged-files "magit-git")
+(defvar diff-hl--magit-unstaged-files nil)
+
+(defun diff-hl-magit-pre-refresh ()
+ (setq diff-hl--magit-unstaged-files (magit-unstaged-files t)))
+
(defun diff-hl-magit-post-refresh ()
(let* ((topdir (magit-toplevel))
(modified-files
(mapcar (lambda (file) (expand-file-name file topdir))
- (magit-unstaged-files t)))
+ (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))
- [elpa] externals/diff-hl 9c1c95c 03/25: Fix typo, (continued)
- [elpa] externals/diff-hl 9c1c95c 03/25: Fix typo, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl f95d123 04/25: Merge pull request #129 from tarsiiformes/typo, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 3418630 05/25: diff-hl-flydiff-buffer-with-head: Honor diff-hl-reference-revision, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl fb9eb1c 06/25: Merge pull request #127 from m-cat/diff-apply-hunk, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 2cf8b48 07/25: Avoid the "args out of range error", Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl bc02c99 08/25: Add variable to ask for confirmation when reverting a hunk, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl ba6cf44 12/25: Add tests., Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 7fce94f 09/25: Merge pull request #137 from erickgnavar/feature/ask-for-confirmation-on-revert-hunk, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl ab2f4f0 13/25: Merge pull request #140 from mookid/fix-indirect-buffers, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 2281a89 17/25: Update docstring and untabify, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl a625033 10/25: Update Magit bridge to use the recommended approach,
Dmitry Gutov <=
- [elpa] externals/diff-hl f3b2d15 11/25: diff-hl-diff-goto-hunk, diff-hl-revert-hunk: handle indirect buffers., Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 176f931 14/25: Support buffers in 'conflict' state as well, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 165a30f 16/25: Merge pull request #143 from walseb/master, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl c58098c 15/25: Added option to not automatically enable diff-hl in certain major-modes, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl d1b9a2b 18/25: Add global-diff-hl-amend-mode to diff-hl custom group, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl c31af59 20/25: Don't hook into after-revert-hook, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 8ed1120 22/25: Revert "Don't hook into after-revert-hook", Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl f6244ab 19/25: Merge pull request #150 from tarsiiformes/custom-group, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 09ffe8d 21/25: Introduce diff-hl-update-once, to avoid diffing twice in normal-mode, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 328e23e 23/25: Introduce diff-hl-after-revert, Dmitry Gutov, 2020/12/20