[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 027b0d2 20/25: diff-hl-revert-hunk: Emphasize the hunk
From: |
Dmitry Gutov |
Subject: |
[elpa] master 027b0d2 20/25: diff-hl-revert-hunk: Emphasize the hunk |
Date: |
Sat, 8 Dec 2018 19:19:40 -0500 (EST) |
branch: master
commit 027b0d2c37c1d6aed5349d75d116b5eb78acffa4
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
diff-hl-revert-hunk: Emphasize the hunk
#111
---
diff-hl.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/diff-hl.el b/diff-hl.el
index 436165f..dea9b27 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -381,6 +381,11 @@ in the source file, or the last line of the hunk above it."
(unless (looking-at "^-")
(cl-decf to-go))))))))))
+(defface diff-hl-reverted-hunk-highlight
+ '((default :inverse-video t))
+ "Face used to highlight the first characters of each line.
+Each line of the hunk to be reverted.")
+
(defun diff-hl-revert-hunk ()
"Revert the diff hunk with changes at or above the point."
(interactive)
@@ -397,7 +402,7 @@ in the source file, or the last line of the hunk above it."
(vc-diff-internal nil fileset diff-hl-reference-revision nil
nil diff-buffer)
(vc-exec-after
- `(let (beg-line end-line)
+ `(let (beg-line end-line m-end)
(when (eobp)
(with-current-buffer ,buffer (diff-hl-remove-overlays))
(user-error "Buffer is up-to-date"))
@@ -406,6 +411,7 @@ in the source file, or the last line of the hunk above it."
(save-excursion
(while (looking-at "[-+]") (forward-line 1))
(setq end-line (line-number-at-pos (point)))
+ (setq m-end (point-marker))
(unless (eobp) (diff-split-hunk)))
(unless (looking-at "[-+]") (forward-line -1))
(while (looking-at "[-+]") (forward-line -1))
@@ -413,6 +419,12 @@ in the source file, or the last line of the hunk above it."
(unless (looking-at "@")
(forward-line 1)
(diff-split-hunk))
+ (let ((inhibit-read-only t))
+ (save-excursion
+ (while (< (point) m-end)
+ (font-lock-prepend-text-property (point) (1+ (point))
'font-lock-face
+
'diff-hl-reverted-hunk-highlight)
+ (forward-line 1))))
(let ((wbh (window-body-height)))
(if (>= wbh (- end-line beg-line))
(recenter (/ (+ wbh (- beg-line end-line) 2) 2))
- [elpa] master 04c3b01 05/25: Use `user-error' when we can't proceed., (continued)
- [elpa] master 04c3b01 05/25: Use `user-error' when we can't proceed., Dmitry Gutov, 2018/12/08
- [elpa] master c476e40 07/25: Update the Requirements section, Dmitry Gutov, 2018/12/08
- [elpa] master 8dab389 09/25: Add separate set of faces for diff-hl-margin-mode, Dmitry Gutov, 2018/12/08
- [elpa] master 1d672dd 11/25: Clarify diff-hl-flydiff-mode docstring, Dmitry Gutov, 2018/12/08
- [elpa] master 3e9d264 08/25: Clean up diff-hl-dired process buffers, Dmitry Gutov, 2018/12/08
- [elpa] master 09b9354 12/25: Add a variable for the diff-hl-mode lighter, Dmitry Gutov, 2018/12/08
- [elpa] master bec9889 13/25: Define diff-hl-margin-unknown and diff-hl-margin-ignored, Dmitry Gutov, 2018/12/08
- [elpa] master f0b945a 14/25: Don't call vc-state unless the file exists, Dmitry Gutov, 2018/12/08
- [elpa] master ce93571 19/25: Add some FIXMEs related to #71, Dmitry Gutov, 2018/12/08
- [elpa] master 9ef21e4 15/25: Merge pull request #93 from Wilfred/handle_file_move, Dmitry Gutov, 2018/12/08
- [elpa] master 027b0d2 20/25: diff-hl-revert-hunk: Emphasize the hunk,
Dmitry Gutov <=
- [elpa] master 069a925 24/25: Bump the version, Dmitry Gutov, 2018/12/08
- [elpa] master a626bf8 23/25: Merge pull request #109 from edkolev/revert-hunk-in-narrowed-buffer, Dmitry Gutov, 2018/12/08
- [elpa] master a48699f 21/25: #111 Extract diff-hl-highlight-revert-hunk-function, Dmitry Gutov, 2018/12/08
- [elpa] master 154c64a 18/25: Merge pull request #105 from phst/license, Dmitry Gutov, 2018/12/08
- [elpa] master 63f1687 10/25: diff-hl-dired-update: Handle up-to-date entries properly, Dmitry Gutov, 2018/12/08
- [elpa] master 190622d 16/25: Fix #102, Dmitry Gutov, 2018/12/08
- [elpa] master 93aa34d 22/25: Make sure buffer is not narrowed when reverting a hunk, Dmitry Gutov, 2018/12/08
- [elpa] master 262a6d5 17/25: Add a LICENSE file, Dmitry Gutov, 2018/12/08
- [elpa] master 7964c46 25/25: Merge commit '069a92590000269a9a5b0b7aebbae9595675a59c' from diff-hl, Dmitry Gutov, 2018/12/08