[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/diff-hl 738c5d6: diff-hl-set-reference-rev: Use vc-read
From: |
ELPA Syncer |
Subject: |
[elpa] externals/diff-hl 738c5d6: diff-hl-set-reference-rev: Use vc-read-revision in all cases |
Date: |
Tue, 23 Feb 2021 18:57:08 -0500 (EST) |
branch: externals/diff-hl
commit 738c5d6a6bffe46b18249c77d59ae1d9e2d4d126
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
diff-hl-set-reference-rev: Use vc-read-revision in all cases
Resolves #156.
---
diff-hl.el | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/diff-hl.el b/diff-hl.el
index 1cb7002..b541432 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -819,15 +819,17 @@ your `exec-path'."
(turn-on-diff-hl-mode)))
;;;###autoload
-(defun diff-hl-set-reference-rev (&optional rev)
+(defun diff-hl-set-reference-rev (rev)
"Set the reference revision globally to REV.
-When called interactively, REV is get from contexts:
+When called interactively, REV read with completion.
+
+The default value chosen using one of methods below:
- In a log view buffer, it uses the revision of current entry.
Call `vc-print-log' or `vc-print-root-log' first to open a log
view buffer.
- In a VC annotate buffer, it uses the revision of current line.
-- In other situations, get the revision name at point.
+- In other situations, it uses the symbol at point.
Notice that this sets the reference revision globally, so in
files from other repositories, `diff-hl-mode' will not highlight
@@ -836,16 +838,19 @@ changes correctly, until you run
`diff-hl-reset-reference-rev'.
Also notice that this will disable `diff-hl-amend-mode' in
buffers that enables it, since `diff-hl-amend-mode' overrides its
effect."
- (interactive)
- (let* ((rev (or rev
- (and (equal major-mode 'vc-annotate-mode)
- (car (vc-annotate-extract-revision-at-line)))
- (log-view-current-tag)
- (thing-at-point 'symbol t))))
- (if rev
- (message "Set reference rev to %s" rev)
- (user-error "Can't find a revision around point"))
- (setq diff-hl-reference-revision rev))
+ (interactive
+ (let* ((def (or (and (equal major-mode 'vc-annotate-mode)
+ (car (vc-annotate-extract-revision-at-line)))
+ (log-view-current-tag)
+ (thing-at-point 'symbol t)))
+ (prompt (if def
+ (format "Reference revision (default %s): " def)
+ "Reference revision: ")))
+ (list (vc-read-revision prompt nil nil def))))
+ (if rev
+ (message "Set reference revision to %s" rev)
+ (user-error "No reference revision specified"))
+ (setq diff-hl-reference-revision rev)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when diff-hl-mode
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/diff-hl 738c5d6: diff-hl-set-reference-rev: Use vc-read-revision in all cases,
ELPA Syncer <=