branch: scratch/add-vdiff
commit 1549115d034389ae56027df1f8f2478183a15475
Author: justbur <[email protected]>
Commit: justbur <[email protected]>
Add option to lock scrolling by default
---
vdiff.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/vdiff.el b/vdiff.el
index 063b4c4..4d74544 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1,3 +1,7 @@
+(defcustom vdiff-lock-scrolling t
+ "Whether to lock scrolling by default when starting
+ `vdiff-mode'.")
+
(defcustom vdiff-diff-program "diff"
"diff program to use.")
@@ -529,11 +533,15 @@ lines in sync.")
(if vdiff-mode
(progn
(setq cursor-in-non-selected-windows nil)
- (add-hook 'after-save-hook #'vdiff-refresh nil t))
+ (add-hook 'after-save-hook #'vdiff-refresh nil t)
+ (when vdiff-lock-scrolling
+ (vdiff-scroll-lock-mode 1)))
(setq cursor-in-non-selected-windows t)
(setq vdiff-diff-data nil)
(vdiff-remove-all-overlays)
- (remove-hook 'after-save-hook #'vdiff-refresh t)))
+ (remove-hook 'after-save-hook #'vdiff-refresh t)
+ (when vdiff-scroll-lock-mode
+ (vdiff-scroll-lock-mode -1))))
(define-minor-mode vdiff-scroll-lock-mode
" "