[elpa] master 40ffc92 29/57: Warn on bad initialization of vdiff session.

2020-11-03 Thread Justin Burkett
branch: master
commit 40ffc92c566b55264f48167a02c17518743870b4
Author: Justin Burkett 
Commit: Justin Burkett 

Warn on bad initialization of vdiff session.

Ref #19
---
 vdiff.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/vdiff.el b/vdiff.el
index 57e75ca..84ad0b4 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -2174,6 +2174,9 @@ nothing to revert then this command fails."
 
 (defun vdiff--buffer-init ()
   ;; this is a buffer-local var
+  (unless vdiff--temp-session
+(user-error "Incorrect initialization of vdiff session. \
+See README for entry points into a vdiff session."))
   (setq vdiff--session vdiff--temp-session)
   (unless vdiff--testing-mode
 (setq cursor-in-non-selected-windows nil)



[elpa] master 992d07b 14/57: Add travis support

2020-11-03 Thread Justin Burkett
branch: master
commit 992d07b29bf0f1b3403fa35f3badd79e676990e6
Author: Justin Burkett 
Commit: Justin Burkett 

Add travis support
---
 .travis.yml | 24 
 Cask|  7 +++
 Makefile| 19 +++
 3 files changed, 50 insertions(+)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..cfe9029
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+before_install:
+  - git clone https://github.com/rejeep/evm.git $HOME/.evm
+  - export PATH="$HOME/.evm/bin:$PATH"
+  - export PATH="$HOME/.cask/bin:$PATH"
+  - evm config path /tmp
+  - evm install $EVM_EMACS --use --skip
+  - curl -fsSkL https://raw.github.com/cask/cask/master/go | python
+
+env:
+  - EVM_EMACS=emacs-24.4-travis
+  - EVM_EMACS=emacs-24.5-travis
+  - EVM_EMACS=emacs-25.1-travis
+  - EVM_EMACS=emacs-25.2-travis
+  - EVM_EMACS=emacs-25.3-travis
+  - EVM_EMACS=emacs-git-snapshot-travis
+
+matrix:
+  fast_finish: true
+  allow_failures:
+- env: EVM_EMACS=emacs-git-snapshot-travis
+
+script:
+  - emacs --version
+  - make test
diff --git a/Cask b/Cask
new file mode 100644
index 000..f3d27cf
--- /dev/null
+++ b/Cask
@@ -0,0 +1,7 @@
+(source gnu)
+
+(package-file "vdiff.el")
+
+(development
+ (depends-on "ert")
+ (depends-on "hydra"))
diff --git a/Makefile b/Makefile
new file mode 100644
index 000..0780a20
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+.PHONY : test
+
+EMACS ?= emacs
+CASK ?= cask
+
+LOADPATH = -L .
+
+ELPA_DIR = \
+   .cask/$(shell $(EMACS) -Q --batch --eval '(princ emacs-version)')/elpa
+
+test: elpa
+   $(CASK) exec $(EMACS) -Q -batch $(LOADPATH) \
+   -l evil-vdiff-tests.el -f ert-run-tests-batch-and-exit
+
+elpa: $(ELPA_DIR)
+$(ELPA_DIR): Cask
+   $(CASK) install
+   mkdir -p $(ELPA_DIR)
+   touch $@



[elpa] master f0de403 21/57: Add emacs-26.1 for Travis

2020-11-03 Thread Justin Burkett
branch: master
commit f0de40379934b7c5762bc5a8d45f0583978cd8fd
Author: Justin Burkett 
Commit: Justin Burkett 

Add emacs-26.1 for Travis
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index cfe9029..03f0d96 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,6 +12,7 @@ env:
   - EVM_EMACS=emacs-25.1-travis
   - EVM_EMACS=emacs-25.2-travis
   - EVM_EMACS=emacs-25.3-travis
+  - EVM_EMACS=emacs-26.1-travis
   - EVM_EMACS=emacs-git-snapshot-travis
 
 matrix:



[elpa] master 45666cc 30/57: README: evil-collection adds vimdiff-like bindings

2020-11-03 Thread Justin Burkett
branch: master
commit 45666cc77506bb06d9a0004da4e0b3fc4a8ee507
Author: Evgeni Kolev 
Commit: Evgeni Kolev 

README: evil-collection adds vimdiff-like bindings
---
 README.org | 16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/README.org b/README.org
index 713487e..1389023 100644
--- a/README.org
+++ b/README.org
@@ -139,21 +139,7 @@ prefix in normal state.
 (evil-define-key 'normal vdiff-mode-map "," vdiff-mode-prefix-map)
 #+END_SRC
 
-To match vimdiff bindings some more work is required. The way the =d= command
-for evil is set up makes it difficult to bind =do= and =dp= as they exist in
-vimdiff. Here is a sample set of bindings that avoids this problem (thanks to
-@edkolev for these).
-
-#+BEGIN_SRC emacs-lisp
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "]c" 'vdiff-next-hunk)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "[c" 'vdiff-previous-hunk)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zc" 'vdiff-close-fold)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zM" 'vdiff-close-all-folds)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zo" 'vdiff-open-fold)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zR" 'vdiff-open-all-folds)
-  (evil-define-minor-mode-key 'motion 'vdiff-mode "go" 'vdiff-receive-changes)
-  (evil-define-minor-mode-key 'motion 'vdiff-mode "gp" 'vdiff-send-changes)
-#+END_SRC
+vimdiff-like binding are provided by 
[[https://github.com/emacs-evil/evil-collection][evil-collection]]'s 
[[https://github.com/emacs-evil/evil-collection/blob/master/evil-collection-vdiff.el][evil-collection-vdiff.el]]
 
 ** Hydra
 



[elpa] master 8f3fa10 15/57: Fix Makefile typo

2020-11-03 Thread Justin Burkett
branch: master
commit 8f3fa10227a502001f8fca440c456fe5438e9575
Author: Justin Burkett 
Commit: Justin Burkett 

Fix Makefile typo
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 0780a20..4e3a180 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ ELPA_DIR = \
 
 test: elpa
$(CASK) exec $(EMACS) -Q -batch $(LOADPATH) \
-   -l evil-vdiff-tests.el -f ert-run-tests-batch-and-exit
+   -l vdiff-tests.el -f ert-run-tests-batch-and-exit
 
 elpa: $(ELPA_DIR)
 $(ELPA_DIR): Cask



[elpa] master 5667bc6 16/57: Ensure input files to diff end in newline

2020-11-03 Thread Justin Burkett
branch: master
commit 5667bc6204086f129292122e6b1b08e9a93906a1
Author: Justin Burkett 
Commit: Justin Burkett 

Ensure input files to diff end in newline
---
 vdiff.el | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 69bde38..0e71a38 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -522,12 +522,27 @@ POST-REFRESH-FUNCTION is called when the process 
finishes."
(proc (get-buffer-process proc-buf)))
   (setq vdiff--last-command cmd)
   (with-current-buffer (car buffers)
-(write-region nil nil tmp-a nil 'quietly))
+(write-region nil nil tmp-a nil 'quietly)
+;; ensure tmp file ends in newline
+(save-excursion
+  (goto-char (point-max))
+  (unless (looking-at-p "\n")
+(write-region "\n" nil tmp-a t 'quietly
   (with-current-buffer (cadr buffers)
-(write-region nil nil tmp-b nil 'quietly))
+(write-region nil nil tmp-b nil 'quietly)
+;; ensure tmp file ends in newline
+(save-excursion
+  (goto-char (point-max))
+  (unless (looking-at-p "\n")
+(write-region "\n" nil tmp-b t 'quietly
   (when vdiff-3way-mode
 (with-current-buffer (nth 2 buffers)
-  (write-region nil nil tmp-c nil 'quietly)))
+  (write-region nil nil tmp-c nil 'quietly)
+  ;; ensure tmp file ends in newline
+  (save-excursion
+(goto-char (point-max))
+(unless (looking-at-p "\n")
+  (write-region "\n" nil tmp-c t 'quietly)
   (when proc
 (kill-process proc))
   (with-current-buffer (get-buffer-create proc-buf)



[elpa] master af74300 01/57: Add vdiff-disable-folding user option

2020-11-03 Thread Justin Burkett
branch: master
commit af74300410d5c980056498db42aa8eb79f6f7826
Author: Justin Burkett 
Commit: Justin Burkett 

Add vdiff-disable-folding user option

* vdiff.el (vdiff-disable-folding): Add
(vdiff--refresh-overlays): Update
---
 vdiff.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vdiff.el b/vdiff.el
index ec0b793..6d990f9 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -85,6 +85,10 @@
 break vdiff. It is empty by default."
   :type 'string)
 
+(defcustom vdiff-disable-folding nil
+  "If non-nil, disable folding in vdiff buffers."
+  :type 'boolean)
+
 (defcustom vdiff-fold-padding 6
   "Unchanged lines to leave unfolded around a fold"
   :type 'integer)
@@ -1142,7 +1146,8 @@ of a \"word\"."
 (with-current-buffer c-buffer
   (line-number-at-pos (point-max))
   folds))
-  (vdiff--add-folds a-buffer b-buffer c-buffer folds
+  (unless vdiff-disable-folding
+(vdiff--add-folds a-buffer b-buffer c-buffer folds)
 
 ;; * Send/Receive changes
 



[elpa] master f2a622f 34/57: Improve vdiff-toggle-fold

2020-11-03 Thread Justin Burkett
branch: master
commit f2a622f46e7a84389972b86c8dbc778a6d890ddf
Author: Justin Burkett 
Commit: Justin Burkett 

Improve vdiff-toggle-fold
---
 vdiff.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vdiff.el b/vdiff.el
index d528d15..17011fb 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1729,7 +1729,8 @@ toggle all folds in region."
 (when (eq (overlay-get ovr 'vdiff-type) 'fold)
   (if (overlay-get ovr 'vdiff-fold-open)
   (vdiff--close-fold ovr)
-(vdiff--open-fold ovr)
+(vdiff--open-fold ovr
+  (vdiff--scroll-function))
 
 (defun vdiff-open-all-folds ()
   "Open all folds in both buffers"



[elpa] master 348d1a7 27/57: Add after-quit arg to vdiff-test-with-buffers

2020-11-03 Thread Justin Burkett
branch: master
commit 348d1a78d217603daebaf2db75f6802cdd435138
Author: Justin Burkett 
Commit: Justin Burkett 

Add after-quit arg to vdiff-test-with-buffers
---
 vdiff-test.el | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/vdiff-test.el b/vdiff-test.el
index 9172990..b026319 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -24,7 +24,7 @@
 (require 'vdiff)
 
 (defmacro vdiff-test-with-buffers
-(a-string b-string operation final-a-string final-b-string)
+(a-string b-string operation final-a-string final-b-string &optional 
after-quit)
   `(let ((buffer-a (get-buffer-create "vdiff-tests-buffer-a"))
  (buffer-b (get-buffer-create "vdiff-tests-buffer-b"))
  (vdiff--testing-mode t))
@@ -36,7 +36,7 @@
(with-current-buffer buffer-b
  (erase-buffer)
  (insert ,(replace-regexp-in-string "|" "\n" b-string)))
-   (vdiff-buffers buffer-a buffer-b nil nil nil t)
+   (vdiff-buffers buffer-a buffer-b)
,operation
(with-current-buffer buffer-a
  (should (string= (buffer-string)
@@ -45,7 +45,10 @@
  (should (string= (buffer-string)
   ,(replace-regexp-in-string "|" "\n" 
final-b-string)
(with-current-buffer buffer-a
- (vdiff-quit)
+ (vdiff-quit))
+   ,after-quit
+   (kill-buffer buffer-a)
+   (kill-buffer buffer-b
 
 (ert-deftest vdiff-test-parsing ()
   "Test parsing of unified diff format."



[elpa] master 45f7019 19/57: Add basic send and receive tests

2020-11-03 Thread Justin Burkett
branch: master
commit 45f7019c6c42aa594553324f05344528f8e625e8
Author: Justin Burkett 
Commit: Justin Burkett 

Add basic send and receive tests

Refactor vdiff-refresh to allow for synchronous parsing to use for testing.
---
 vdiff-tests.el | 116 -
 vdiff.el   |  93 +
 2 files changed, 176 insertions(+), 33 deletions(-)

diff --git a/vdiff-tests.el b/vdiff-tests.el
index ad71e73..52ce1e5 100644
--- a/vdiff-tests.el
+++ b/vdiff-tests.el
@@ -24,7 +24,7 @@
 (require 'vdiff)
 
 (ert-deftest vdiff-test-parsing ()
-  ""
+  "Test parsing of unified diff format."
   (with-temp-buffer
 (insert "--- test1.txt 2018-04-13 11:11:41.0 -0400
 +++ test2.txt  2018-04-13 11:11:46.0 -0400
@@ -58,3 +58,117 @@
 ")
 (should (equal (vdiff--parse-diff-u (current-buffer))
'(((1) (1 . 3)) ((12) (15 . 16)) ((19 . 20) (24 . 25)) 
((23) (28 . 28)))
+
+(ert-deftest vdiff-test-transmiting ()
+  "Test transmitting changes."
+  (cl-letf ((bufa (get-buffer-create "vdiff-tests-bufa"))
+(bufb (get-buffer-create "vdiff-tests-bufb"))
+;; no need to handle scrolling
+((symbol-function 'vdiff--scroll-function) #'ignore)
+;; don't process asynchronously
+(vdiff--synchronous t))
+(unwind-protect
+(progn
+  (with-current-buffer bufa
+(erase-buffer)
+(insert "1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+"))
+  (with-current-buffer bufb
+(erase-buffer)
+(insert "1
+2
+4
+4
+5
+6
+8
+8
+9
+10
+"))
+  (vdiff-buffers bufa bufb)
+  (with-current-buffer bufa
+(vdiff-send-changes (point-min) (point-max)))
+  (with-current-buffer bufb
+(should (string= (buffer-string)
+ "1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+"
+  (kill-buffer bufa)
+  (kill-buffer bufb
+
+(ert-deftest vdiff-test-receiving ()
+  "Test receiving changes."
+  (cl-letf ((bufa (get-buffer-create "vdiff-tests-bufa"))
+(bufb (get-buffer-create "vdiff-tests-bufb"))
+;; no need to handle scrolling
+((symbol-function 'vdiff--scroll-function) #'ignore)
+;; don't process asynchronously
+(vdiff--synchronous t))
+(unwind-protect
+(progn
+  (with-current-buffer bufa
+(erase-buffer)
+(insert "1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+"))
+  (with-current-buffer bufb
+(erase-buffer)
+(insert "1
+2
+4
+4
+5
+6
+8
+8
+9
+10
+"))
+  (vdiff-buffers bufa bufb)
+  (with-current-buffer bufb
+(vdiff-receive-changes (point-min) (point-max)))
+  (with-current-buffer bufb
+(should (string= (buffer-string)
+ "1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+"
+  (kill-buffer bufa)
+  (kill-buffer bufb
+
+
+(provide 'vdiff-tests)
+;;; vdiff-tests.el ends here
diff --git a/vdiff.el b/vdiff.el
index 85a3b58..968f891 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -241,6 +241,8 @@ because those are handled differently.")
 ("Ignore all whitespace (-w)" . "-w")
 ("Ignore space changes (-b)" . "-b")
 ("Ignore blank lines (-B)" . "-B")))
+(defvar vdiff--synchronous nil
+  "Flag to force synchronous parsing.")
 
 ;; Sessions
 (defvar vdiff--temp-session nil
@@ -501,7 +503,7 @@ non-nil. Ignore folds if NO-FOLD is non-nil."
 ;; * Main overlay refresh routine
 
 (defun vdiff-refresh (&optional post-refresh-function)
-  "Asynchronously refresh diff information.
+  "Refresh diff information.
 
 POST-REFRESH-FUNCTION is called when the process finishes."
   (interactive)
@@ -552,20 +554,26 @@ POST-REFRESH-FUNCTION is called when the process 
finishes."
 (kill-process proc))
   (with-current-buffer (get-buffer-create proc-buf)
 (erase-buffer))
-  (setq proc
-(make-process
- :name "*vdiff*"
- :buffer proc-buf
- :command cmd))
-  (when vdiff-3way-mode
-(process-put proc 'vdiff-3way t))
-  (process-put proc 'vdiff-session ses)
-  (process-put proc 'vdiff-tmp-a tmp-a)
-  (process-put proc 'vdiff-tmp-b tmp-b)
-  (process-put proc 'vdiff-post-refresh-function post-refresh-function)
-  (when tmp-c
-(process-put proc 'vdiff-tmp-c tmp-c))
-  (set-process-sentinel proc #'vdiff--diff-refresh-1
+  (if vdiff--synchronous
+  (progn
+(apply #'call-process (car cmd) nil (list proc-buf) nil (cdr cmd))
+(vdiff--diff-refresh-sync-sentinel
+ proc-buf ses vdiff-3way-mode tmp-a tmp-b
+ tmp-c post-refresh-function))
+(setq proc
+  (make-process
+   :name "*vdiff*"
+   :buffer proc-buf
+   :command cmd))
+(when vdiff-3way-mode
+  (process-put 

[elpa] master bd8976e 26/57: Add movement and setup tests

2020-11-03 Thread Justin Burkett
branch: master
commit bd8976efc6c0fa5343d210467dd02f8bb474a182
Author: Justin Burkett 
Commit: Justin Burkett 

Add movement and setup tests
---
 vdiff-test.el | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/vdiff-test.el b/vdiff-test.el
index fa03a3f..9172990 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -83,6 +83,29 @@
 (should (equal (vdiff--parse-diff-u (current-buffer))
'(((1) (1 . 3)) ((12) (15 . 16)) ((19 . 20) (24 . 25)) 
((23) (28 . 28)))
 
+(ert-deftest vdiff-test-setup ()
+  "Test setting up `vdiff-mode'."
+  ;; Setup does not change buffers
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"
+   nil
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"))
+
+(ert-deftest vdiff-test-movement ()
+  "Test movement in buffers."
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (call-interactively 'vdiff-next-hunk)
+ (call-interactively 'vdiff-next-hunk)
+ (should (looking-at-p "7")))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"))
+
 (ert-deftest vdiff-test-transmiting ()
   "Test transmitting changes."
   ;; Test sending first change



[elpa] master 110d672 12/57: Cleanup diff parsing function

2020-11-03 Thread Justin Burkett
branch: master
commit 110d6726bc2f0c6a7c589fb59de8001ad9477950
Author: Justin Burkett 
Commit: Justin Burkett 

Cleanup diff parsing function
---
 vdiff.el | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 01610f6..69bde38 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -603,6 +603,12 @@ an addition when compared to other vdiff buffers."
 (let* ((start-line-a (string-to-number (match-string 1)))
(start-line-b (string-to-number (match-string 2)))
(lines (cons start-line-a start-line-b)))
+  ;; Adjust starting line in case it's not actually a line of one of 
the
+  ;; files
+  (when (looking-at-p "+")
+(setcar lines (1- (car lines
+  (when (looking-at-p "-")
+(setcdr lines (1- (cdr lines
   (while (and (not (looking-at-p "@"))
   (not (eobp)))
 (cond ((looking-at-p "+")
@@ -614,8 +620,7 @@ an addition when compared to other vdiff buffers."
  (when vdiff-debug
(cl-assert (or (looking-at-p " ") (eobp
  (push
-  ;; there's no context lines at the beginning of the file
-  (list (cons (if (= beg-a 1) 1 (1+ beg-a)) nil)
+  (list (cons (car lines) nil)
 (cons beg-b (1- (cdr lines
   res)))
   ((looking-at-p "-")
@@ -627,8 +632,8 @@ an addition when compared to other vdiff buffers."
  (if (or (looking-at-p " ") (eobp))
  ;; subtraction
  (push
-  (list (cons beg-a (if (= (car lines) 1) 1 (1- (car 
lines
-(cons (1+ beg-b) nil))
+  (list (cons beg-a (1- (car lines)))
+(cons (cdr lines) nil))
   res)
(when vdiff-debug
  (cl-assert (or (looking-at-p "+") (eobp
@@ -640,8 +645,9 @@ an addition when compared to other vdiff buffers."
  (push
   (list (cons beg-a (1- (car lines)))
 (cons beg-b (1- (cdr lines
-  res))
-(setq lines (vdiff--inc-lines lines))
+  res)
+  (t
+   (setq lines (vdiff--inc-lines lines
 (nreverse res)))
 
 (defun vdiff--parse-diff3 (buf)



[elpa] master eb553fa 09/57: Add support for different diff algorithms

2020-11-03 Thread Justin Burkett
branch: master
commit eb553facd7b66cf3c108e68a3d96be4a5bcc0b83
Author: Justin Burkett 
Commit: Justin Burkett 

Add support for different diff algorithms

Replace vdiff-diff-{program,extra-args} with vdiff-diff-algorithm{s}, which
allows for selection of pre-specified commands that use different diff
algorithms.

Modify vdiff-diff3-command to comply with the expected format.
---
 vdiff.el | 91 +++-
 1 file changed, 55 insertions(+), 36 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index f9a9a19..0c4e4d3 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -72,23 +72,37 @@
 `vdiff-mode'."
   :type 'boolean)
 
-(defcustom vdiff-diff-program "diff"
-  "diff program to use."
-  :type 'string)
-
-(defcustom vdiff-diff3-program "diff3"
-  "diff3 program to use."
-  :type 'string)
-
-(defcustom vdiff-diff-extra-args "-u"
-  "Extra arguments to pass to diff. If this is set wrong, you may
-break vdiff. It is \"-u\" by default."
-  :type 'string)
-
-(defcustom vdiff-diff3-extra-args ""
-  "Extra arguments to pass to diff. If this is set wrong, you may
-break vdiff. It is empty by default."
-  :type 'string)
+(defcustom vdiff-diff-algorithms
+  '((diff-u . "diff -u")
+(git-diff . "git --no-pager diff --no-index --no-color")
+(git-diff-myers . "git --no-pager diff --myers --no-index --no-color")
+(git-diff-minimal . "git --no-pager diff --minimal --no-index --no-color")
+(git-diff-patience . "git --no-pager diff --patience --no-index 
--no-color")
+(git-diff-histogram . "git --no-pager diff --histogram --no-index 
--no-color")
+(custom . "diff -u"))
+  "An alist containing choices of diff algorithms to be selected
+by setting `vdiff-diff-algorithm'. If you want to use a custom
+command, set `vidff-diff-algorithm' to `custom' and customize the
+`custom' key in this alist."
+  :type '(alist :key-type symbol :value-type string))
+
+(defcustom vdiff-diff-algorithm 'diff-u
+  "Choice of algorithm for generating diffs. The choices are
+`diff-u', `git-diff',`git-diff-myers', `git-diff-minimal',
+`git-diff-patience', `git-diff-histogram' and `custom'. See
+`vdiff-diff-algorithms' for the associated commands."
+  :type '(choice (const :tag "diff -u" diff-u)
+ (const :tag "git diff" git-diff)
+ (const :tag "git diff --myers" git-diff-myers)
+ (const :tag "git diff --minimal" git-diff-minimal)
+ (const :tag "git diff --patience" git-diff-patience)
+ (const :tag "git diff --histogram" git-diff-histogram)
+ (const :tag "custom" custom)))
+
+(defcustom vdiff-diff3-command '("diff3")
+  "diff3 command to use. Specify as a list where the car is the command to use
+and the remaining elements are the arguments to the command."
+  :type '(repeat string))
 
 (defcustom vdiff-disable-folding nil
   "If non-nil, disable folding in vdiff buffers."
@@ -248,6 +262,12 @@ because those are handled differently.")
 
 ;; * Utilities
 
+(defsubst vdiff-diff-command ()
+  (let ((cmd-cons (assoc vdiff-diff-algorithm vdiff-diff-algorithms)))
+(if (stringp (cdr-safe cmd-cons))
+(split-string (cdr cmd-cons) " ")
+  '("diff" "-u"
+
 (defun vdiff--maybe-int (str)
   "Return an int>=0 from STR."
   (let ((num (or (and (numberp str) str)
@@ -482,22 +502,17 @@ POST-REFRESH-FUNCTION is called when the process 
finishes."
(tmp-b (make-temp-file "vdiff-b-"))
(tmp-c (when vdiff-3way-mode
 (make-temp-file "vdiff-c-")))
-   (prgm (if vdiff-3way-mode
- vdiff-diff3-program
-   vdiff-diff-program))
-   (extra-args (if vdiff-3way-mode
- vdiff-diff3-extra-args
-   vdiff-diff-extra-args))
+   (base-cmd (if vdiff-3way-mode
+ vdiff-diff3-command
+   (vdiff-diff-command)))
(ses vdiff--session)
-   (cmd (mapconcat
- #'identity
- (vdiff--non-nil-list
-  prgm
-  (vdiff-session-whitespace-args ses)
-  (vdiff-session-case-args ses)
-  extra-args
-  tmp-a tmp-b tmp-c)
- " "))
+   (cmd (append
+ base-cmd
+ (vdiff-session-whitespace-args ses)
+ (vdiff-session-case-args ses)
+ (list "--" tmp-a tmp-b)
+ (when tmp-c
+   (list tmp-c
(buffers (vdiff-session-buffers ses))
(proc-buf (vdiff-session-process-buffer ses))
(proc (get-buffer-process proc-buf)))
@@ -513,9 +528,11 @@ POST-REFRESH-FUNCTION is called when the process finishes."
 (kill-process proc))
   (with-current-buffer (get-buffer-create proc-buf)
 (erase-buffer))
-  ;; (setq vdiff--last-command cmd)
   (setq proc
- 

[elpa] master 5f7d3fd 22/57: Add Travis badge

2020-11-03 Thread Justin Burkett
branch: master
commit 5f7d3fd09e257b0ee01dc13de93a6a02d209b183
Author: Justin Burkett 
Commit: Justin Burkett 

Add Travis badge
---
 README.org | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 24e1999..713487e 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-[[https://melpa.org/#/vdiff][file:https://melpa.org/packages/vdiff-badge.svg]]
+[[https://melpa.org/#/vdiff][file:https://melpa.org/packages/vdiff-badge.svg]] 
[[https://travis-ci.org/justbur/emacs-vdiff][https://travis-ci.org/justbur/emacs-vdiff.svg?branch=master]]
 
 * vdiff
 



[elpa] master 4cc1ee5 35/57: Allow sending selective regions from additions

2020-11-03 Thread Justin Burkett
branch: master
commit 4cc1ee50c44e8734b9f547b85c13ba7f3cf871e2
Author: Justin Burkett 
Commit: Justin Burkett 

Allow sending selective regions from additions
---
 vdiff.el | 64 +++-
 1 file changed, 43 insertions(+), 21 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 17011fb..7cb38d1 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1315,7 +1315,7 @@ line above. Always search to the end of the current line 
as
 well. This only returns bounds for `interactive'."
   (if (region-active-p)
   (prog1
-  (list (region-beginning) (region-end))
+  (list (region-beginning) (region-end) t)
 (deactivate-mark))
 (list (if (or (= (line-number-at-pos) 1)
   (vdiff--overlay-at-pos
@@ -1326,9 +1326,11 @@ well. This only returns bounds for `interactive'."
   (line-beginning-position)))
   (save-excursion
 (forward-line 1)
-(point)
+(point))
+  nil)))
 
-(defun vdiff-send-changes (beg end &optional receive targets dont-refresh)
+(defun vdiff-send-changes
+(beg end &optional region receive targets dont-refresh)
   "Send changes in this hunk to another vdiff buffer. If the
 region is active, send all changes found in the region. Otherwise
 use the hunk under point or on the immediately preceding line."
@@ -1341,10 +1343,13 @@ use the hunk under point or on the immediately 
preceding line."
 (or targets (vdiff--target-overlays ovr t
  (let ((pos (overlay-start (car target-ovrs
(with-current-buffer (overlay-buffer (car target-ovrs))
- (vdiff-send-changes pos (1+ pos) nil nil t
-((memq (overlay-get ovr 'vdiff-type)
-   '(change addition))
- (vdiff--transmit-change ovr targets))
+ (vdiff-send-changes pos (1+ pos) nil nil nil t
+((eq (overlay-get ovr 'vdiff-type) 'addition)
+ (vdiff--transmit-addition
+  ovr targets (when region beg) (when region end)))
+((eq (overlay-get ovr 'vdiff-type) 'change)
+ (vdiff--transmit-change
+  ovr targets (when region beg) (when region end)))
 ((eq (overlay-get ovr 'vdiff-type) 'subtraction)
  (vdiff--transmit-subtraction ovr targets
 (unless dont-refresh
@@ -1356,7 +1361,7 @@ use the hunk under point or on the immediately preceding 
line."
   (call-interactively 'vdiff-send-changes)
   (call-interactively 'vdiff-next-hunk))
 
-(defun vdiff-receive-changes (beg end)
+(defun vdiff-receive-changes (beg end &optional region)
   "Receive the changes corresponding to this position from
 another vdiff buffer. This is equivalent to jumping to the
 corresponding buffer and sending from there. If the region is
@@ -1364,7 +1369,7 @@ active, receive all corresponding changes found in the
 region. Otherwise use the changes under point or on the
 immediately preceding line."
   (interactive (vdiff--region-or-close-overlay))
-  (vdiff-send-changes beg end t nil t)
+  (vdiff-send-changes beg end nil t nil t)
   (vdiff-refresh #'vdiff--scroll-function))
 
 (defun vdiff-receive-changes-and-step ()
@@ -1373,23 +1378,40 @@ immediately preceding line."
   (call-interactively 'vdiff-receive-changes)
   (call-interactively 'vdiff-next-hunk))
 
-(defun vdiff--transmit-change (ovr &optional targets)
+(defun vdiff--transmit-addition (ovr &optional targets beg end)
   "Send text in OVR to corresponding overlay in other buffer."
   (if (not (overlayp ovr))
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
-   (text (buffer-substring-no-properties
-  (overlay-start ovr)
-  (overlay-end ovr
+   (beg (if (numberp beg)
+(max beg (overlay-start ovr))
+  (overlay-start ovr)))
+   (end (if (numberp end)
+(min end (overlay-end ovr))
+  (overlay-end ovr)))
+   (text (buffer-substring-no-properties beg end)))
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
   (save-excursion
 (goto-char (overlay-start target))
-;; subtractions are one char too big on purpose
-(unless (eq (overlay-get target 'vdiff-type)
-'subtraction)
-  (delete-region (overlay-start target)
- (overlay-end target)))
+(insert text))
+  (delete-overlay target)))
+  (delete-overlay ovr
+
+(defun vdiff--transmit-change (ovr &optional targets beg end)
+  "Send text in OVR to corresponding overlay in other buffer."
+  (if (not (overlayp ovr))
+  (message "No change found")
+(let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
+   (beg (overlay-start ovr))
+   

[elpa] master c803bd6 17/57: Add warnings for obsolete variables

2020-11-03 Thread Justin Burkett
branch: master
commit c803bd61c32ab3d2adf0a157a99a6b8985640f97
Author: Justin Burkett 
Commit: Justin Burkett 

Add warnings for obsolete variables
---
 vdiff.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/vdiff.el b/vdiff.el
index 0e71a38..d8cf976 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -107,6 +107,11 @@ commands."
 and the remaining elements are the arguments to the command."
   :type '(repeat string))
 
+(make-obsolete-variable 'vdiff-diff-program 'vdiff-diff-algorithm "2018-04-17")
+(make-obsolete-variable 'vdiff-diff3-program 'vdiff-diff3-command "2018-04-17")
+(make-obsolete-variable 'vdiff-diff-extra-args "See `vdiff-diff-algorithms'." 
"2018-04-17")
+(make-obsolete-variable 'vdiff-diff3-extra-args 'vdiff-diff3-command 
"2018-04-17")
+
 (defcustom vdiff-disable-folding nil
   "If non-nil, disable folding in vdiff buffers."
   :type 'boolean)



[elpa] master 66ae1ac 03/57: README: Note new option

2020-11-03 Thread Justin Burkett
branch: master
commit 66ae1ac324d9ec7ef87abee38f260734f036cf3d
Author: Justin Burkett 
Commit: Justin Burkett 

README: Note new option
---
 README.org | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.org b/README.org
index 2d30c9e..9e536d9 100644
--- a/README.org
+++ b/README.org
@@ -177,6 +177,9 @@ The current customization options and there defaults are
   ;; break vdiff.
   (setq vdiff-diff-program-args "")
 
+  ;; Don't use folding in vdiff buffers if non-nil.
+  (setq vdiff-disable-folding nil)
+
   ;; Unchanged lines to leave unfolded around a fold
   (setq vdiff-fold-padding 6)
 



[elpa] master 6c3731a 40/57: Fixup vdiff--transmit-change for 3way diffs

2020-11-03 Thread Justin Burkett
branch: master
commit 6c3731a8a4179ecdd773cbd7f7cbaf36c48287c2
Author: Justin Burkett 
Commit: Justin Burkett 

Fixup vdiff--transmit-change for 3way diffs
---
 vdiff.el | 44 +---
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index ec493a9..9ba59c0 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1421,33 +1421,39 @@ immediately preceding line."
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
(beg (vdiff--maybe-beginning-of-line beg))
+   (beg-line (when beg (line-number-at-pos beg)))
(end (vdiff--maybe-end-of-line end))
+   (end-line (when end (line-number-at-pos end)))
+   (from-buffer (vdiff--buffer-p))
(text (buffer-substring-no-properties
   (if beg
   (max beg (overlay-start ovr))
 (overlay-start ovr))
   (if end
- (min end (overlay-end ovr))
-   (overlay-end ovr
-   (target-beg-line
-(when beg
-  (caar (vdiff--translate-line (line-number-at-pos beg)
-   (target-end-line
-(when end
-  (caar (vdiff--translate-line (line-number-at-pos end))
+  (min end (overlay-end ovr))
+(overlay-end ovr)
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
-  (save-excursion
-(if target-beg-line
-(vdiff--move-to-line target-beg-line)
-  (goto-char (overlay-start target)))
-(delete-region (point)
-   (save-excursion
- (if target-end-line
- (vdiff--move-to-line target-end-line)
-   (goto-char (overlay-end target)))
- (point)))
-(insert text))
+  (let* ((target-buffer (vdiff--buffer-p))
+ (target-beg-line
+  (when beg-line
+(car (vdiff--translate-line
+  beg-line from-buffer target-buffer
+ (target-end-line
+  (when end-line
+(car (vdiff--translate-line
+  end-line from-buffer target-buffer)
+(save-excursion
+  (if target-beg-line
+  (vdiff--move-to-line target-beg-line)
+(goto-char (overlay-start target)))
+  (delete-region (point)
+ (save-excursion
+   (if target-end-line
+   (vdiff--move-to-line target-end-line)
+ (goto-char (overlay-end target)))
+   (point)))
+  (insert text)))
   (delete-overlay target)))
   (delete-overlay ovr
 



[elpa] master 773e3eb 28/57: Fix compiler warnings

2020-11-03 Thread Justin Burkett
branch: master
commit 773e3ebde452cec9b37baa0d425ec4b51d9dc563
Author: Justin Burkett 
Commit: Justin Burkett 

Fix compiler warnings
---
 vdiff.el | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index e636a91..57e75ca 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -641,8 +641,7 @@ an addition when compared to other vdiff buffers."
   (not (eobp)))
 (cond ((looking-at-p "+")
;; addition
-   (let ((beg-a (car lines))
- (beg-b (cdr lines)))
+   (let ((beg-b (cdr lines)))
  (while (looking-at-p "+")
(setq lines (vdiff--inc-lines lines)))
  (when vdiff-debug
@@ -653,8 +652,7 @@ an addition when compared to other vdiff buffers."
   res)))
   ((looking-at-p "-")
;; subtraction or change
-   (let ((beg-a (car lines))
- (beg-b (cdr lines)))
+   (let ((beg-a (car lines)))
  (while (looking-at-p "-")
(setq lines (vdiff--inc-lines lines)))
  (if (or (looking-at-p " ") (eobp))



[elpa] master 71b6f40 43/57: Bound target lines in vdiff--transmit-changes

2020-11-03 Thread Justin Burkett
branch: master
commit 71b6f40ade4abde88324149b161d40cdc6c53faa
Author: Justin Burkett 
Commit: Justin Burkett 

Bound target lines in vdiff--transmit-changes
---
 vdiff.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 7e568f7..7a01aec 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1435,14 +1435,18 @@ immediately preceding line."
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
   (let* ((target-buffer (vdiff--buffer-p))
+ (min-line (line-number-at-pos (overlay-start ovr)))
  (target-beg-line
   (when beg-line
-(car (vdiff--translate-line
-  beg-line from-buffer target-buffer
+(max min-line
+ (car (vdiff--translate-line
+   beg-line from-buffer target-buffer)
+ (max-line (line-number-at-pos (overlay-end ovr)))
  (target-end-line
   (when end-line
-(car (vdiff--translate-line
-  end-line from-buffer target-buffer)
+(min max-line
+ (car (vdiff--translate-line
+   end-line from-buffer target-buffer))
 (save-excursion
   (if target-beg-line
   (vdiff--move-to-line target-beg-line)



[elpa] master 02309fc 38/57: Retain buffer identities in line maps

2020-11-03 Thread Justin Burkett
branch: master
commit 02309fc5a212e8f7a507d97bc4b8d4cee90e10d5
Author: Justin Burkett 
Commit: Justin Burkett 

Retain buffer identities in line maps

Allows for the return value of vdiff--translate-line to be more explicit
---
 vdiff.el | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index bb7c7bb..0fa253f 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1543,11 +1543,11 @@ just deleting text in another buffer."
 (setq c-b (nconc c-b (cdr new-b-c
   (setf (vdiff-session-line-maps session)
 (if vdiff-3way-mode
-(list (list 'a a-b a-c)
-  (list 'b b-a b-c)
-  (list 'c c-a c-b))
-  (list (list 'a a-b)
-(list 'b b-a)))
+(list (list 'a (cons 'b a-b) (cons 'c a-c))
+  (list 'b (cons 'a b-a) (cons 'c b-c))
+  (list 'c (cons 'a c-a) (cons 'b c-b)))
+  (list (list 'a (cons 'b a-b))
+(list 'b (cons 'a b-a
 
 (defun vdiff--translate-line (line &optional from-buffer)
   "Translate LINE in buffer A to corresponding line in buffer
@@ -1562,7 +1562,7 @@ B. Go from buffer B to A if B-to-A is non nil."
   (setq last-entry
 (catch 'closest
   (let (prev-entry)
-(dolist (entry map)
+(dolist (entry (cdr map))
   (let ((map-line (car entry)))
 (cond ((< map-line line)
(setq prev-entry entry))
@@ -1575,20 +1575,22 @@ B. Go from buffer B to A if B-to-A is non nil."
 (setq last-entry (list line line))
 (message "Error in line translation %s %s" line from-buffer))
   (if res-1
-  (setq res-2 (cons (+ (- line (car last-entry)) (cadr last-entry))
+  (setq res-2 (list (car map)
+(+ (- line (car last-entry)) (cadr last-entry))
 (nth 2 last-entry)))
-(setq res-1 (cons (+ (- line (car last-entry)) (cadr last-entry))
+(setq res-1 (list (car map)
+  (+ (- line (car last-entry)) (cadr last-entry))
   (nth 2 last-entry)
 (when (called-interactively-p 'interactive)
-  (message "This line: %s; Other line %s; vscroll-state %s; entry %s"
-   line res-1 (cdr res-1) last-entry))
+  (message "This line: %s (%s); Other line %s (%s); vscroll-state %s; 
entry %s"
+   line from-buffer res-1 (car res-1) (cdr res-1) last-entry))
 (cons res-1 res-2)))
 
 (defun vdiff-switch-buffer (line)
   "Jump to the line in another vdiff buffer that corresponds to
 the current one."
   (interactive (list (line-number-at-pos)))
-  (let ((line (caar (vdiff--translate-line line
+  (let ((line (nth 1 (car (vdiff--translate-line line)
 (select-window (car (vdiff--unselected-windows)))
 (when line
   (vdiff--move-to-line line
@@ -1629,18 +1631,16 @@ buffer)."
  (other-win (nth (if buf-c 1 0) (vdiff--unselected-windows)))
  (start-line (line-number-at-pos window-start))
  (start-trans (vdiff--translate-line start-line))
- (start-trans (if buf-c
-  (cdr start-trans)
-(car start-trans)))
+ (start-trans (if buf-c (cddr start-trans) (cdar start-trans)))
  (trans (vdiff--translate-line
  (+ (count-lines window-start (point))
 start-line)))
- (trans (if buf-c (cdr trans) (car trans
+ (trans (if buf-c (cddr trans) (cdar trans
 (when (and start-trans trans)
   (list other-win
 (vdiff--pos-at-line-beginning (car start-trans) other-buf)
 (vdiff--pos-at-line-beginning (car trans) other-buf)
-(cdr start-trans)
+(cadr start-trans)
 
 (defun vdiff--scroll-function (&optional window window-start)
   "Sync scrolling of all vdiff windows."



[elpa] master 52b7e04 04/57: Switch to using unified diff output (diff -u)

2020-11-03 Thread Justin Burkett
branch: master
commit 52b7e042cb2a1efc60ad4f3d8000a74342b87363
Author: Justin Burkett 
Commit: Justin Burkett 

Switch to using unified diff output (diff -u)

Makes it easier to plug in different algorithms from git diff for example.

See #18
---
 vdiff.el | 73 
 1 file changed, 69 insertions(+), 4 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 178d860..8c6e378 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -80,7 +80,12 @@
   "diff3 program to use."
   :type 'string)
 
-(defcustom vdiff-diff-extra-args ""
+(defcustom vdiff-diff-extra-args "-u"
+  "Extra arguments to pass to diff. If this is set wrong, you may
+break vdiff. It is \"-u\" by default."
+  :type 'string)
+
+(defcustom vdiff-diff3-extra-args ""
   "Extra arguments to pass to diff. If this is set wrong, you may
 break vdiff. It is empty by default."
   :type 'string)
@@ -245,7 +250,8 @@ because those are handled differently.")
 
 (defun vdiff--maybe-int (str)
   "Return an int>=0 from STR."
-  (let ((num (and str (string-to-number str
+  (let ((num (or (and (numberp str) str)
+ (and str (string-to-number str)
 (when (and (numberp num)
(>= num 0))
   num)))
@@ -479,6 +485,9 @@ POST-REFRESH-FUNCTION is called when the process finishes."
(prgm (if vdiff-3way-mode
  vdiff-diff3-program
vdiff-diff-program))
+   (extra-args (if vdiff-3way-mode
+ vdiff-diff3-extra-args
+   vdiff-diff-extra-args))
(ses vdiff--session)
(cmd (mapconcat
  #'identity
@@ -486,7 +495,7 @@ POST-REFRESH-FUNCTION is called when the process finishes."
   prgm
   (vdiff-session-whitespace-args ses)
   (vdiff-session-case-args ses)
-  vdiff-diff-extra-args
+  extra-args
   tmp-a tmp-b tmp-c)
  " "))
(buffers (vdiff-session-buffers ses))
@@ -554,6 +563,62 @@ an addition when compared to other vdiff buffers."
res
 (nreverse res)))
 
+(defsubst vdiff--inc-lines (lines)
+  (forward-line)
+  (let ((a (car lines))
+(b (cdr lines)))
+(cond ((looking-at-p " ") (cons (1+ a) (1+ b)))
+  ((looking-at-p "+") (cons a (1+ b)))
+  ((looking-at-p "-") (cons (1+ a) b)
+
+(defun vdiff--parse-diff-u (buf)
+  "Parse diff -u output in BUF and return list of hunks."
+  (let ((header-regexp "^@@ -\\([0-9]+\\),[0-9]+ \\+\\([0-9]+\\),[0-9]+ @@")
+res)
+(with-current-buffer buf
+  (goto-char (point-min))
+  (while (re-search-forward header-regexp nil t)
+(forward-line)
+(let* ((start-line-a (string-to-number (match-string 1)))
+   (start-line-b (string-to-number (match-string 2)))
+   (lines (cons start-line-a start-line-b)))
+  (while (and (not (looking-at-p "@"))
+  (not (eobp)))
+(setq lines (vdiff--inc-lines lines))
+(cond ((looking-at-p "+")
+   ;; addition
+   (let ((beg-a (car lines))
+ (beg-b (cdr lines)))
+ (while (looking-at-p "+")
+   (setq lines (vdiff--inc-lines lines)))
+ (cl-assert (looking-at-p " "))
+ (push
+  (list (vdiff--encode-range t beg-a)
+(vdiff--encode-range nil beg-b (1- (cdr lines
+  res)))
+  ((looking-at-p "-")
+   ;; subtraction or change
+   (let ((beg-a (car lines))
+ (beg-b (cdr lines)))
+ (while (looking-at-p "-")
+   (setq lines (vdiff--inc-lines lines)))
+ (if (looking-at-p " ")
+ ;; subtraction
+ (push
+  (list (vdiff--encode-range nil beg-a (1- (car 
lines)))
+(vdiff--encode-range t beg-b))
+  res)
+   (cl-assert (looking-at-p "+"))
+   (let ((beg-b (cdr lines)))
+ (while (looking-at-p "+")
+   (setq lines (vdiff--inc-lines lines)))
+ (cl-assert (looking-at-p " "))
+ (push
+  (list (vdiff--encode-range nil beg-a (1- (car 
lines)))
+(vdiff--encode-range nil beg-b (1- (cdr 
lines
+  res))
+(nreverse res)))
+
 (defun vdiff--parse-diff3 (buf)
   "Parse diff3 output in BUF and return list of hunks."
   (catch 'final-res
@@ -592,7 +657,7 @@ parsing the diff output and triggering the overlay updates."
   (unless vdiff--inhibit-diff-update
 (l

[elpa] master 0312ac8 06/57: Update copyright years

2020-11-03 Thread Justin Burkett
branch: master
commit 0312ac8ccd456f670d6e6c4b8478c9656463b92a
Author: Justin Burkett 
Commit: Justin Burkett 

Update copyright years
---
 vdiff.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vdiff.el b/vdiff.el
index 700f311..88c954c 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1,6 +1,6 @@
 ;;; vdiff.el --- A diff tool similar to  vimdiff -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017  Free Software Foundation, Inc.
+;; Copyright (C) 2017-2018  Free Software Foundation, Inc.
 
 ;; Author: Justin Burkett 
 ;; Maintainer: Justin Burkett 



[elpa] master 3bfb5de 32/57: Truncate long lines by default

2020-11-03 Thread Justin Burkett
branch: master
commit 3bfb5decd7fcef73759b247b29aeae669fb79499
Author: Justin Burkett 
Commit: Justin Burkett 

Truncate long lines by default

Adds vdiff-truncate-lines to control the behavior.

Fixes #21
---
 vdiff.el | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 84ad0b4..4ac2bc0 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -73,6 +73,10 @@
 `vdiff-mode'."
   :type 'boolean)
 
+(defcustom vdiff-truncate-lines t
+  "If non-nil, use `toggle-truncate-lines' in vdiff buffers."
+  :type 'boolean)
+
 (defcustom vdiff-diff-algorithms
   '((diff . "diff -u")
 (diff-minimal . "diff -u --minimal")
@@ -2184,7 +2188,12 @@ See README for entry points into a vdiff session."))
 (add-hook 'after-change-functions #'vdiff--after-change-function nil t)
 (add-hook 'pre-command-hook #'vdiff--flag-new-command nil t)
 (setf (vdiff-session-window-config vdiff--session)
-  (current-window-configuration
+  (current-window-configuration))
+(when vdiff-lock-scrolling
+  (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t))
+(when vdiff-truncate-lines
+  (let (message-log-max)
+(toggle-truncate-lines 1)
 
 (defun vdiff--buffer-cleanup ()
   (vdiff--remove-all-overlays)
@@ -2202,13 +2211,9 @@ hooks to refresh diff on changes. This will be enabled
 automatically after calling commands like `vdiff-files' or
 `vdiff-buffers'."
   nil " vdiff" 'vdiff-mode-map
-  (cond (vdiff-mode
- (vdiff--buffer-init)
- (when (and (not vdiff--testing-mode)
-vdiff-lock-scrolling)
-  (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t)))
-(t
- (vdiff--buffer-cleanup
+  (if vdiff-mode
+  (vdiff--buffer-init)
+(vdiff--buffer-cleanup)))
 
 (define-minor-mode vdiff-3way-mode
   "Minor mode active in a vdiff session involving three
@@ -2217,13 +,9 @@ adds hooks to refresh diff on changes. This will be 
enabled
 automatically after calling commands like `vdiff-files3' or
 `vdiff-buffers3'."
   nil " vdiff3" 'vdiff-3way-mode-map
-  (cond (vdiff-3way-mode
- (vdiff--buffer-init)
- (when (and (not vdiff--testing-mode)
-vdiff-lock-scrolling)
-   (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t)))
-(t
- (vdiff--buffer-cleanup
+  (if vdiff-3way-mode
+  (vdiff--buffer-init)
+(vdiff--buffer-cleanup)))
 
 (define-minor-mode vdiff-scroll-lock-mode
   "Lock scrolling between vdiff buffers. This minor mode will be



[elpa] master 61d29bb 54/57: Travis -> github workflow

2020-11-03 Thread Justin Burkett
branch: master
commit 61d29bbaba8a312c75e78edae1d0047d7eae4473
Author: Justin Burkett 
Commit: Justin Burkett 

Travis -> github workflow
---
 .github/workflows/test.yml | 30 ++
 .travis.yml| 25 -
 2 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000..7c77b01
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,30 @@
+name: evil-vdiff-test
+on:
+  pull_request:
+  push:
+branches:
+  - master
+
+jobs:
+  build:
+runs-on: ubuntu-latest
+strategy:
+  matrix:
+emacs_version:
+  - 25.1
+  - 25.2
+  - 25.3
+  - 26.1
+  - 26.2
+  - 26.3
+  - snapshot
+steps:
+
+- uses: actions/checkout@v2
+- uses: actions/setup-python@v1
+- uses: purcell/setup-emacs@master
+  with:
+version: ${{ matrix.emacs_version }}
+- uses: conao3/setup-cask@master
+- name: Run tests
+  run: make test
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 03f0d96..000
--- a/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-before_install:
-  - git clone https://github.com/rejeep/evm.git $HOME/.evm
-  - export PATH="$HOME/.evm/bin:$PATH"
-  - export PATH="$HOME/.cask/bin:$PATH"
-  - evm config path /tmp
-  - evm install $EVM_EMACS --use --skip
-  - curl -fsSkL https://raw.github.com/cask/cask/master/go | python
-
-env:
-  - EVM_EMACS=emacs-24.4-travis
-  - EVM_EMACS=emacs-24.5-travis
-  - EVM_EMACS=emacs-25.1-travis
-  - EVM_EMACS=emacs-25.2-travis
-  - EVM_EMACS=emacs-25.3-travis
-  - EVM_EMACS=emacs-26.1-travis
-  - EVM_EMACS=emacs-git-snapshot-travis
-
-matrix:
-  fast_finish: true
-  allow_failures:
-- env: EVM_EMACS=emacs-git-snapshot-travis
-
-script:
-  - emacs --version
-  - make test



[elpa] master updated (3bfaa7a -> 185e803)

2020-11-03 Thread Justin Burkett
justbur pushed a change to branch master.

  from  3bfaa7a   Really fix typo in previous debbugs-gnu change
   new  af74300   Add vdiff-disable-folding user option
   new  41c2d0a   Handle error when no overlay at point
   new  66ae1ac   README: Note new option
   new  52b7e04   Switch to using unified diff output (diff -u)
   new  c1525a8   Fix problems with diff -u parser at beg and end of file
   new  0312ac8   Update copyright years
   new  bc5e1a7   Remove debugging message
   new  fb21cc6   Fix parsing of subtractions in diff -u
   new  eb553fa   Add support for different diff algorithms
   new  b15b020   Add diff --minimal as algorithm and fix case args for git
   new  0bfb259   Add vdiff-debug flag
   new  110d672   Cleanup diff parsing function
   new  835485b   Announce vdiff-diff-algorithm in README
   new  992d07b   Add travis support
   new  8f3fa10   Fix Makefile typo
   new  5667bc6   Ensure input files to diff end in newline
   new  c803bd6   Add warnings for obsolete variables
   new  69eacfe   Fix and simplify final newline detection
   new  45f7019   Add basic send and receive tests
   new  106a69f   Fix previous tests for Travis
   new  f0de403   Add emacs-26.1 for Travis
   new  5f7d3fd   Add Travis badge
   new  68d6ea3   Make name of vdiff-test consistent with prefixes
   new  5b643c7   Add another send/receive test
   new  fd6ec8e   Test that both buffers are correct by default
   new  bd8976e   Add movement and setup tests
   new  348d1a7   Add after-quit arg to vdiff-test-with-buffers
   new  773e3eb   Fix compiler warnings
   new  40ffc92   Warn on bad initialization of vdiff session.
   new  45666cc   README: evil-collection adds vimdiff-like bindings
   new  0e10521   Merge pull request #20 from edkolev/patch-1
   new  3bfb5de   Truncate long lines by default
   new  6878093   Add vdiff-toggle-fold and vdiff-toggle-all-folds
   new  f2a622f   Improve vdiff-toggle-fold
   new  ef899b8   Reset truncate-lines on cleanup
   new  c5e0cb0   Update gitignore
   new  4cc1ee5   Allow sending selective regions from additions
   new  c806fe2   Allow selective sending in change hunks
   new  e3f5370   Handle case where full line is not selected in selective 
send
   new  02309fc   Retain buffer identities in line maps
   new  ccc773b   Add optional to-buffer arg to vdiff--translate line
   new  6c3731a   Fixup vdiff--transmit-change for 3way diffs
   new  45923bb   Fix compiler warnings
   new  745cc02   Add test for selective send
   new  71b6f40   Bound target lines in vdiff--transmit-changes
   new  fe10fb3   Cleanup some of the transmit addition/changes logic
   new  c732247   Reset truncate-lines on cleanup
   new  08437d5   Update gitignore
   new  0efde18   Improve behavior with respect to region selection
   new  a1a82de   Merge pull request #25 from justbur/send-region
   new  09e15fc   Announce selective sending of changes using the region in 
README
   new  90f4b24   Ensure char-before doesn't cause an error
   new  58d530b   Add vdiff-temp-files
   new  61d29bb   Travis -> github workflow
   new  c0541ae   Update readme badges
   new  007e44b   Version 0.2.4
   new  185e803   Merge commit '007e44be19d068fd6b49874b6e9b8df8b1f552bd'


Summary of changes:
 packages/vdiff/.github/workflows/test.yml |  30 ++
 packages/vdiff/.gitignore |   9 +-
 packages/vdiff/Cask   |   7 +
 packages/vdiff/Makefile   |  19 +
 packages/vdiff/README.org |  41 +-
 packages/vdiff/vdiff-test.el  | 210 +
 packages/vdiff/vdiff.el   | 687 +-
 7 files changed, 778 insertions(+), 225 deletions(-)
 create mode 100644 packages/vdiff/.github/workflows/test.yml
 create mode 100644 packages/vdiff/Cask
 create mode 100644 packages/vdiff/Makefile
 create mode 100644 packages/vdiff/vdiff-test.el



[elpa] master 0bfb259 11/57: Add vdiff-debug flag

2020-11-03 Thread Justin Burkett
branch: master
commit 0bfb2592f9cd021224ece3e619e70269b6219860
Author: Justin Burkett 
Commit: Justin Burkett 

Add vdiff-debug flag
---
 vdiff.el | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 3427dc8..01610f6 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -61,6 +61,7 @@
 
 (defvar vdiff-mode)
 (defvar vdiff-3way-mode)
+(defvar vdiff-debug nil)
 
 (defgroup vdiff nil
   "Diff tool that is like vimdiff"
@@ -610,7 +611,8 @@ an addition when compared to other vdiff buffers."
  (beg-b (cdr lines)))
  (while (looking-at-p "+")
(setq lines (vdiff--inc-lines lines)))
- (cl-assert (or (looking-at-p " ") (eobp)))
+ (when vdiff-debug
+   (cl-assert (or (looking-at-p " ") (eobp
  (push
   ;; there's no context lines at the beginning of the file
   (list (cons (if (= beg-a 1) 1 (1+ beg-a)) nil)
@@ -628,11 +630,13 @@ an addition when compared to other vdiff buffers."
   (list (cons beg-a (if (= (car lines) 1) 1 (1- (car 
lines
 (cons (1+ beg-b) nil))
   res)
-   (cl-assert (or (looking-at-p "+") (eobp)))
+   (when vdiff-debug
+ (cl-assert (or (looking-at-p "+") (eobp
(let ((beg-b (cdr lines)))
  (while (looking-at-p "+")
(setq lines (vdiff--inc-lines lines)))
- (cl-assert (or (looking-at-p " ") (eobp)))
+ (when vdiff-debug
+   (cl-assert (or (looking-at-p " ") (eobp
  (push
   (list (cons beg-a (1- (car lines)))
 (cons beg-b (1- (cdr lines



[elpa] master b15b020 10/57: Add diff --minimal as algorithm and fix case args for git

2020-11-03 Thread Justin Burkett
branch: master
commit b15b02078ebbff312f12afbd792a15f0a9eefe19
Author: Justin Burkett 
Commit: Justin Burkett 

Add diff --minimal as algorithm and fix case args for git
---
 vdiff.el | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 0c4e4d3..3427dc8 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -73,7 +73,8 @@
   :type 'boolean)
 
 (defcustom vdiff-diff-algorithms
-  '((diff-u . "diff -u")
+  '((diff . "diff -u")
+(diff-minimal . "diff -u --minimal")
 (git-diff . "git --no-pager diff --no-index --no-color")
 (git-diff-myers . "git --no-pager diff --myers --no-index --no-color")
 (git-diff-minimal . "git --no-pager diff --minimal --no-index --no-color")
@@ -86,11 +87,12 @@ command, set `vidff-diff-algorithm' to `custom' and 
customize the
 `custom' key in this alist."
   :type '(alist :key-type symbol :value-type string))
 
-(defcustom vdiff-diff-algorithm 'diff-u
+(defcustom vdiff-diff-algorithm 'diff
   "Choice of algorithm for generating diffs. The choices are
-`diff-u', `git-diff',`git-diff-myers', `git-diff-minimal',
-`git-diff-patience', `git-diff-histogram' and `custom'. See
-`vdiff-diff-algorithms' for the associated commands."
+`diff', `diff-minimal', `git-diff',`git-diff-myers',
+`git-diff-minimal', `git-diff-patience', `git-diff-histogram' and
+`custom'. See `vdiff-diff-algorithms' for the associated
+commands."
   :type '(choice (const :tag "diff -u" diff-u)
  (const :tag "git diff" git-diff)
  (const :tag "git diff --myers" git-diff-myers)
@@ -509,7 +511,8 @@ POST-REFRESH-FUNCTION is called when the process finishes."
(cmd (append
  base-cmd
  (vdiff-session-whitespace-args ses)
- (vdiff-session-case-args ses)
+ (unless (string= (car base-cmd) "git")
+   (vdiff-session-case-args ses))
  (list "--" tmp-a tmp-b)
  (when tmp-c
(list tmp-c



[elpa] master 106a69f 20/57: Fix previous tests for Travis

2020-11-03 Thread Justin Burkett
branch: master
commit 106a69fcf02b172be988579e65ecb5e80eb26db9
Author: Justin Burkett 
Commit: Justin Burkett 

Fix previous tests for Travis
---
 vdiff-tests.el |  18 +++-
 vdiff.el   | 142 +++--
 2 files changed, 83 insertions(+), 77 deletions(-)

diff --git a/vdiff-tests.el b/vdiff-tests.el
index 52ce1e5..58e6a75 100644
--- a/vdiff-tests.el
+++ b/vdiff-tests.el
@@ -61,12 +61,9 @@
 
 (ert-deftest vdiff-test-transmiting ()
   "Test transmitting changes."
-  (cl-letf ((bufa (get-buffer-create "vdiff-tests-bufa"))
-(bufb (get-buffer-create "vdiff-tests-bufb"))
-;; no need to handle scrolling
-((symbol-function 'vdiff--scroll-function) #'ignore)
-;; don't process asynchronously
-(vdiff--synchronous t))
+  (let ((bufa (get-buffer-create "vdiff-tests-bufa"))
+(bufb (get-buffer-create "vdiff-tests-bufb"))
+(vdiff--testing-mode t))
 (unwind-protect
 (progn
   (with-current-buffer bufa
@@ -116,12 +113,9 @@
 
 (ert-deftest vdiff-test-receiving ()
   "Test receiving changes."
-  (cl-letf ((bufa (get-buffer-create "vdiff-tests-bufa"))
-(bufb (get-buffer-create "vdiff-tests-bufb"))
-;; no need to handle scrolling
-((symbol-function 'vdiff--scroll-function) #'ignore)
-;; don't process asynchronously
-(vdiff--synchronous t))
+  (let ((bufa (get-buffer-create "vdiff-tests-bufa"))
+(bufb (get-buffer-create "vdiff-tests-bufb"))
+(vdiff--testing-mode t))
 (unwind-protect
 (progn
   (with-current-buffer bufa
diff --git a/vdiff.el b/vdiff.el
index 968f891..df044e4 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -241,8 +241,8 @@ because those are handled differently.")
 ("Ignore all whitespace (-w)" . "-w")
 ("Ignore space changes (-b)" . "-b")
 ("Ignore blank lines (-B)" . "-B")))
-(defvar vdiff--synchronous nil
-  "Flag to force synchronous parsing.")
+(defvar vdiff--testing-mode nil
+  "Configure for testing in batch mode.")
 
 ;; Sessions
 (defvar vdiff--temp-session nil
@@ -554,7 +554,7 @@ POST-REFRESH-FUNCTION is called when the process finishes."
 (kill-process proc))
   (with-current-buffer (get-buffer-create proc-buf)
 (erase-buffer))
-  (if vdiff--synchronous
+  (if vdiff--testing-mode
   (progn
 (apply #'call-process (car cmd) nil (list proc-buf) nil (cdr cmd))
 (vdiff--diff-refresh-sync-sentinel
@@ -729,7 +729,7 @@ an addition when compared to other vdiff buffers."
 (defun vdiff--diff-refresh-sync-sentinel
 (buffer session vdiff-3way tmp-a tmp-b &optional tmp-c post-function)
   "This is the sentinel for `vdiff-refresh' when
-`vdiff--synchronous' is non-nil."
+`vdiff--testing-mode' is non-nil."
   (unless vdiff--inhibit-diff-update
 (setf (vdiff-session-diff-data session)
   (funcall (if vdiff-3way
@@ -1585,50 +1585,51 @@ buffer)."
 
 (defun vdiff--scroll-function (&optional window window-start)
   "Sync scrolling of all vdiff windows."
-  (let* ((window (or window (selected-window)))
- (update-window-start (null window-start))
- (window-start (or window-start (progn
-  ;; redisplay updates window-start in
-  ;; the case where the scroll function
-  ;; is called manually
-  (redisplay)
-  (window-start)
-(when (and (eq window (selected-window))
-   (cl-every #'window-live-p (vdiff--all-windows))
-   (vdiff--buffer-p)
-   (not vdiff--in-scroll-hook)
-   vdiff--new-command)
-  (setq vdiff--new-command nil)
-  (let* ((2-scroll-data (vdiff--other-win-scroll-data
- window window-start))
- (2-win (nth 0 2-scroll-data))
- (2-start-pos (nth 1 2-scroll-data))
- (2-pos (nth 2 2-scroll-data))
- (2-scroll (nth 3 2-scroll-data))
- ;; 1 is short for this; 2 is the first other and 3 is the second
- (vdiff--in-scroll-hook t))
-(when (and 2-pos 2-start-pos)
-  (set-window-point 2-win 2-pos)
-  ;; For some reason without this unless the vscroll gets eff'd
-  (unless (= (progn
-   (when update-window-start
- (redisplay))
-   (window-start 2-win))
- 2-start-pos)
-(set-window-start 2-win 2-start-pos))
-  (vdiff--set-vscroll-and-force-update 2-win 2-scroll))
-(when vdiff-3way-mode
-  (let*
-  ((3-scroll-data (vdiff--other-win-scroll-data
-   window window-start t))
-   (3-win (nth 0 3-scroll-data))
-   (3-start-pos (nth 1

[elpa] master bc5e1a7 07/57: Remove debugging message

2020-11-03 Thread Justin Burkett
branch: master
commit bc5e1a78dc159bb06f8b80667c75f4cb37bab201
Author: Justin Burkett 
Commit: Justin Burkett 

Remove debugging message
---
 vdiff.el | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 88c954c..ebab055 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -567,11 +567,9 @@ an addition when compared to other vdiff buffers."
   (forward-line)
   (let ((a (car lines))
 (b (cdr lines)))
-(prog1
-(cond ((or (looking-at-p " ") (eobp)) (cons (1+ a) (1+ b)))
-  ((looking-at-p "+") (cons a (1+ b)))
-  ((looking-at-p "-") (cons (1+ a) b)))
-  (message "a:%s b:%s l:%s" a b (buffer-substring (point) 
(line-end-position))
+(cond ((or (looking-at-p " ") (eobp)) (cons (1+ a) (1+ b)))
+  ((looking-at-p "+") (cons a (1+ b)))
+  ((looking-at-p "-") (cons (1+ a) b)
 
 (defun vdiff--parse-diff-u (buf)
   "Parse diff -u output in BUF and return list of hunks."



[elpa] master ccc773b 39/57: Add optional to-buffer arg to vdiff--translate line

2020-11-03 Thread Justin Burkett
branch: master
commit ccc773b14c6c1b9742a3b3608b27a1e22406ac93
Author: Justin Burkett 
Commit: Justin Burkett 

Add optional to-buffer arg to vdiff--translate line
---
 vdiff.el | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 0fa253f..ec493a9 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1549,7 +1549,7 @@ just deleting text in another buffer."
   (list (list 'a (cons 'b a-b))
 (list 'b (cons 'a b-a
 
-(defun vdiff--translate-line (line &optional from-buffer)
+(defun vdiff--translate-line (line &optional from-buffer to-buffer)
   "Translate LINE in buffer A to corresponding line in buffer
 B. Go from buffer B to A if B-to-A is non nil."
   (interactive (list (line-number-at-pos)))
@@ -1557,7 +1557,7 @@ B. Go from buffer B to A if B-to-A is non nil."
  (maps
   (cdr
(assq from-buffer (vdiff-session-line-maps vdiff--session
- last-entry res-1 res-2)
+ last-entry res-1 res-2 res)
 (dolist (map maps)
   (setq last-entry
 (catch 'closest
@@ -1584,16 +1584,22 @@ B. Go from buffer B to A if B-to-A is non nil."
 (when (called-interactively-p 'interactive)
   (message "This line: %s (%s); Other line %s (%s); vscroll-state %s; 
entry %s"
line from-buffer res-1 (car res-1) (cdr res-1) last-entry))
-(cons res-1 res-2)))
+(setq res (cons res-1 res-2))
+(if to-buffer
+(cdr (assq to-buffer res))
+  res)))
 
 (defun vdiff-switch-buffer (line)
   "Jump to the line in another vdiff buffer that corresponds to
 the current one."
   (interactive (list (line-number-at-pos)))
-  (let ((line (nth 1 (car (vdiff--translate-line line)
+  (let ((from-buffer (vdiff--buffer-p)))
 (select-window (car (vdiff--unselected-windows)))
-(when line
-  (vdiff--move-to-line line
+(let ((target-line
+   (car
+(vdiff--translate-line line from-buffer (vdiff--buffer-p)
+ (when target-line
+   (vdiff--move-to-line target-line)
 
 (defun vdiff-restore-windows ()
   "Restore initial window configuration."
@@ -1649,8 +1655,8 @@ buffer)."
(update-window-start (null window-start))
(window-start (or window-start (progn
 ;; redisplay updates window-start 
in
-;; the case where the scroll 
function
-;; is called manually
+;; the case where the scroll
+;; function is called manually
 (redisplay)
 (window-start)
   (when (and (eq window (selected-window))



[elpa] master c1525a8 05/57: Fix problems with diff -u parser at beg and end of file

2020-11-03 Thread Justin Burkett
branch: master
commit c1525a86618fc89904d399e5cecb3c435fe1211b
Author: Justin Burkett 
Commit: Justin Burkett 

Fix problems with diff -u parser at beg and end of file

Add a test as well.
---
 vdiff-tests.el | 60 ++
 vdiff.el   | 33 +---
 2 files changed, 78 insertions(+), 15 deletions(-)

diff --git a/vdiff-tests.el b/vdiff-tests.el
new file mode 100644
index 000..ad71e73
--- /dev/null
+++ b/vdiff-tests.el
@@ -0,0 +1,60 @@
+;;; vdiff-tests.el --- tests for vdiff.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018  Free Software Foundation, Inc.
+
+;; Author: Justin Burkett 
+;; Maintainer: Justin Burkett 
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Code:
+
+(require 'ert)
+(require 'vdiff)
+
+(ert-deftest vdiff-test-parsing ()
+  ""
+  (with-temp-buffer
+(insert "--- test1.txt 2018-04-13 11:11:41.0 -0400
 test2.txt  2018-04-13 11:11:46.0 -0400
+@@ -1,3 +1,6 @@
++
++
++
+ 1
+ 2
+ 3
+@@ -9,6 +12,8 @@
+ 9
+ 10
+ 11
++11
++11
+ 12
+ 13
+ 14
+@@ -16,7 +21,8 @@
+ 16
+ 17
+ 18
+-19
+-20
++18
++29
+ 21
+ 22
++23
+")
+(should (equal (vdiff--parse-diff-u (current-buffer))
+   '(((1) (1 . 3)) ((12) (15 . 16)) ((19 . 20) (24 . 25)) 
((23) (28 . 28)))
diff --git a/vdiff.el b/vdiff.el
index 8c6e378..700f311 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -567,9 +567,11 @@ an addition when compared to other vdiff buffers."
   (forward-line)
   (let ((a (car lines))
 (b (cdr lines)))
-(cond ((looking-at-p " ") (cons (1+ a) (1+ b)))
-  ((looking-at-p "+") (cons a (1+ b)))
-  ((looking-at-p "-") (cons (1+ a) b)
+(prog1
+(cond ((or (looking-at-p " ") (eobp)) (cons (1+ a) (1+ b)))
+  ((looking-at-p "+") (cons a (1+ b)))
+  ((looking-at-p "-") (cons (1+ a) b)))
+  (message "a:%s b:%s l:%s" a b (buffer-substring (point) 
(line-end-position))
 
 (defun vdiff--parse-diff-u (buf)
   "Parse diff -u output in BUF and return list of hunks."
@@ -584,17 +586,17 @@ an addition when compared to other vdiff buffers."
(lines (cons start-line-a start-line-b)))
   (while (and (not (looking-at-p "@"))
   (not (eobp)))
-(setq lines (vdiff--inc-lines lines))
 (cond ((looking-at-p "+")
;; addition
(let ((beg-a (car lines))
  (beg-b (cdr lines)))
  (while (looking-at-p "+")
(setq lines (vdiff--inc-lines lines)))
- (cl-assert (looking-at-p " "))
+ (cl-assert (or (looking-at-p " ") (eobp)))
  (push
-  (list (vdiff--encode-range t beg-a)
-(vdiff--encode-range nil beg-b (1- (cdr lines
+  ;; there's no context lines at the beginning of the file
+  (list (cons (if (= beg-a 1) 1 (1+ beg-a)) nil)
+(cons beg-b (1- (cdr lines
   res)))
   ((looking-at-p "-")
;; subtraction or change
@@ -602,21 +604,22 @@ an addition when compared to other vdiff buffers."
  (beg-b (cdr lines)))
  (while (looking-at-p "-")
(setq lines (vdiff--inc-lines lines)))
- (if (looking-at-p " ")
+ (if (or (looking-at-p " ") (eobp))
  ;; subtraction
  (push
-  (list (vdiff--encode-range nil beg-a (1- (car 
lines)))
-(vdiff--encode-range t beg-b))
+  (list (cons beg-a (if (= (car lines) 1) 1 (1- (car 
lines
+(cons nil beg-b))
   res)
-   (cl-assert (looking-at-p "+"))
+   (cl-assert (or (looking-at-p "+") (eobp)))
(let ((beg-b (cdr lines)))
  (while (looking-at-p "+")
(setq lines (vdiff--inc-lines lines)))
- (cl-assert (looking-at-p " "))
+ (cl-assert (or (looking-at-p " ") (eobp)))

[elpa] master fb21cc6 08/57: Fix parsing of subtractions in diff -u

2020-11-03 Thread Justin Burkett
branch: master
commit fb21cc64533d1e90cd40367b957eacfce5922327
Author: Justin Burkett 
Commit: Justin Burkett 

Fix parsing of subtractions in diff -u
---
 vdiff.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vdiff.el b/vdiff.el
index ebab055..f9a9a19 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -606,7 +606,7 @@ an addition when compared to other vdiff buffers."
  ;; subtraction
  (push
   (list (cons beg-a (if (= (car lines) 1) 1 (1- (car 
lines
-(cons nil beg-b))
+(cons (1+ beg-b) nil))
   res)
(cl-assert (or (looking-at-p "+") (eobp)))
(let ((beg-b (cdr lines)))



[elpa] master 41c2d0a 02/57: Handle error when no overlay at point

2020-11-03 Thread Justin Burkett
branch: master
commit 41c2d0a157e739725c478aeb77de51f4d83bf569
Author: Justin Burkett 
Commit: Justin Burkett 

Handle error when no overlay at point

* vdiff.el (vdiff--overlay-at-pos): Throw user-error when no overlay is 
found.
---
 vdiff.el | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 6d990f9..178d860 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -371,20 +371,28 @@ one buffer to another. Only applies in 3-way diffs."
   (goto-char (point-min))
   (forward-line (1- n)))
 
-(defun vdiff--overlay-at-pos (&optional pos)
+(defun vdiff--overlay-at-pos (&optional pos noerror)
   "Return first vdiff overlay found at POS which defaults to
-point."
-  (let ((pos (or pos (point
-(catch 'yes
-  (dolist (ovr (overlays-at pos))
-(when (overlay-get ovr 'vdiff-type)
-  (throw 'yes ovr))
+point.
+
+If NOERROR is non-nil, don't signal an error when no overlay is
+found."
+  (let ((pos (or pos (point)))
+ovr)
+(setq ovr
+  (catch 'yes
+(dolist (ovr (overlays-at pos))
+  (when (overlay-get ovr 'vdiff-type)
+(throw 'yes ovr)
+(if (or ovr noerror)
+ovr
+  (user-error "No vdiff overlay found here."
 
 (defun vdiff--hunk-at-point-p ()
   "Non-nil if point is in hunk overlay.
 
 Returns overlay."
-  (let ((ovr (vdiff--overlay-at-pos)))
+  (let ((ovr (vdiff--overlay-at-pos nil t)))
 (and (overlayp ovr)
  (overlay-get ovr 'vdiff-type)
  (not (eq (overlay-get ovr 'vdiff-type) 'fold))
@@ -394,7 +402,7 @@ Returns overlay."
   "Non-nil if point is in fold overlay.
 
 Returns overlay."
-  (let ((ovr (vdiff--overlay-at-pos)))
+  (let ((ovr (vdiff--overlay-at-pos nil t)))
 (and (overlayp ovr)
  (overlay-get ovr 'vdiff-type)
  (eq (overlay-get ovr 'vdiff-type) 'fold)
@@ -411,7 +419,7 @@ Returns overlay."
 (defun vdiff--maybe-exit-overlay (&optional up no-fold)
   "Move point out of any vdiff overlays. Move down unless UP is
 non-nil. Ignore folds if NO-FOLD is non-nil."
-  (let* ((ovr (vdiff--overlay-at-pos))
+  (let* ((ovr (vdiff--overlay-at-pos nil t))
  (type (when ovr (overlay-get ovr 'vdiff-type
 (when (and type
(or (not no-fold)
@@ -1162,7 +1170,7 @@ well. This only returns bounds for `interactive'."
 (deactivate-mark))
 (list (if (or (= (line-number-at-pos) 1)
   (vdiff--overlay-at-pos
-   (line-beginning-position)))
+   (line-beginning-position) t))
   (line-beginning-position)
 (save-excursion
   (forward-line -1)



[elpa] master c5e0cb0 47/57: Update gitignore

2020-11-03 Thread Justin Burkett
branch: master
commit c5e0cb0c44a74616930489327619f23ad26445bd
Author: Justin Burkett 
Commit: Justin Burkett 

Update gitignore
---
 .gitignore | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 82d13b8..e684078 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
-*.elc
-/vdiff-test.el
-/vdiff-test2.el
-/test*
+*.elc
+/vdiff-test.el
+/vdiff-test2.el
+/test*
+.cask/



[elpa] master 68d6ea3 23/57: Make name of vdiff-test consistent with prefixes

2020-11-03 Thread Justin Burkett
branch: master
commit 68d6ea37ae73a8a8a44e8400d826b2115eddb952
Author: Justin Burkett 
Commit: Justin Burkett 

Make name of vdiff-test consistent with prefixes

Introduce macro for setting up testing environment
---
 Makefile   |   2 +-
 vdiff-test.el  | 106 
 vdiff-tests.el | 168 -
 3 files changed, 107 insertions(+), 169 deletions(-)

diff --git a/Makefile b/Makefile
index 4e3a180..6504277 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ ELPA_DIR = \
 
 test: elpa
$(CASK) exec $(EMACS) -Q -batch $(LOADPATH) \
-   -l vdiff-tests.el -f ert-run-tests-batch-and-exit
+   -l vdiff-test.el -f ert-run-tests-batch-and-exit
 
 elpa: $(ELPA_DIR)
 $(ELPA_DIR): Cask
diff --git a/vdiff-test.el b/vdiff-test.el
new file mode 100644
index 000..f885e17
--- /dev/null
+++ b/vdiff-test.el
@@ -0,0 +1,106 @@
+;;; vdiff-test.el --- tests for vdiff.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018  Free Software Foundation, Inc.
+
+;; Author: Justin Burkett 
+;; Maintainer: Justin Burkett 
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Code:
+
+(require 'ert)
+(require 'vdiff)
+
+(defun vdiff-test-buffer-string ()
+  (replace-regexp-in-string "\n" "|" (buffer-string)))
+
+(defmacro vdiff-test-with-buffers (a-string b-string &rest body)
+  `(let ((buffer-a (get-buffer-create "vdiff-tests-buffer-a"))
+ (buffer-b (get-buffer-create "vdiff-tests-buffer-b"))
+ (vdiff--testing-mode t))
+ (unwind-protect
+ (progn
+   (with-current-buffer buffer-a
+ (erase-buffer)
+ (insert ,(replace-regexp-in-string "|" "\n" a-string)))
+   (with-current-buffer buffer-b
+ (erase-buffer)
+ (insert ,(replace-regexp-in-string "|" "\n" b-string)))
+   (vdiff-buffers buffer-a buffer-b nil nil nil t)
+   ,@body)
+   (with-current-buffer buffer-a
+ (vdiff-quit)
+
+(ert-deftest vdiff-test-parsing ()
+  "Test parsing of unified diff format."
+  (with-temp-buffer
+(insert "--- test1.txt 2018-04-13 11:11:41.0 -0400
 test2.txt  2018-04-13 11:11:46.0 -0400
+@@ -1,3 +1,6 @@
++
++
++
+ 1
+ 2
+ 3
+@@ -9,6 +12,8 @@
+ 9
+ 10
+ 11
++11
++11
+ 12
+ 13
+ 14
+@@ -16,7 +21,8 @@
+ 16
+ 17
+ 18
+-19
+-20
++18
++29
+ 21
+ 22
++23
+")
+(should (equal (vdiff--parse-diff-u (current-buffer))
+   '(((1) (1 . 3)) ((12) (15 . 16)) ((19 . 20) (24 . 25)) 
((23) (28 . 28)))
+
+(ert-deftest vdiff-test-transmiting ()
+  "Test transmitting changes."
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (vdiff-send-changes (point-min) (point-max)))
+   (with-current-buffer buffer-b
+ (should (string= (vdiff-test-buffer-string)
+  "1|2|3|4|5|6|7|8|9|10|")
+
+(ert-deftest vdiff-test-receiving ()
+  "Test receiving changes."
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"
+   (with-current-buffer buffer-b
+ (vdiff-receive-changes (point-min) (point-max)))
+   (with-current-buffer buffer-b
+ (should (string= (vdiff-test-buffer-string)
+  "1|2|3|4|5|6|7|8|9|10|")
+
+
+(provide 'vdiff-test)
+;;; vdiff-test.el ends here
diff --git a/vdiff-tests.el b/vdiff-tests.el
deleted file mode 100644
index 58e6a75..000
--- a/vdiff-tests.el
+++ /dev/null
@@ -1,168 +0,0 @@
-;;; vdiff-tests.el --- tests for vdiff.el -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018  Free Software Foundation, Inc.
-
-;; Author: Justin Burkett 
-;; Maintainer: Justin Burkett 
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see .
-
-;;; Code:

[elpa] master 0efde18 49/57: Improve behavior with respect to region selection

2020-11-03 Thread Justin Burkett
branch: master
commit 0efde18364dfe68de129d9bdd29614d4db371f8a
Author: Justin Burkett 
Commit: Justin Burkett 

Improve behavior with respect to region selection

Prefer use-region-p in vdiff--region-or-close-overlay which adds a check 
for the
variable use-empty-active-region.

Make sure transient-mark-mode is enabled for tests. It doesn't seem to be
enabled by default in batch mode.
---
 vdiff-test.el | 4 
 vdiff.el  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/vdiff-test.el b/vdiff-test.el
index d2833c9..c5ea48c 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -32,9 +32,13 @@
  (progn
(with-current-buffer buffer-a
  (erase-buffer)
+ ;; this seems necessary for batch mode
+ (transient-mark-mode 1)
  (insert ,(replace-regexp-in-string "|" "\n" a-string)))
(with-current-buffer buffer-b
  (erase-buffer)
+ ;; this seems necessary for batch mode
+ (transient-mark-mode 1)
  (insert ,(replace-regexp-in-string "|" "\n" b-string)))
(vdiff-buffers buffer-a buffer-b)
,operation
diff --git a/vdiff.el b/vdiff.el
index a6a3130..32b2092 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1314,7 +1314,7 @@ of a \"word\"."
 overlay at point and return it if there is. If this fails check a
 line above. Always search to the end of the current line as
 well. This only returns bounds for `interactive'."
-  (if (region-active-p)
+  (if (use-region-p)
   (prog1
   (list (region-beginning) (region-end) t)
 (deactivate-mark))



[elpa] master 69eacfe 18/57: Fix and simplify final newline detection

2020-11-03 Thread Justin Burkett
branch: master
commit 69eacfee0eb675ce667d46cc82f1ab679cb9b76f
Author: Justin Burkett 
Commit: Justin Burkett 

Fix and simplify final newline detection

Issue warning if no newline is found.
---
 vdiff.el | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index d8cf976..85a3b58 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -529,25 +529,25 @@ POST-REFRESH-FUNCTION is called when the process 
finishes."
   (with-current-buffer (car buffers)
 (write-region nil nil tmp-a nil 'quietly)
 ;; ensure tmp file ends in newline
-(save-excursion
-  (goto-char (point-max))
-  (unless (looking-at-p "\n")
-(write-region "\n" nil tmp-a t 'quietly
+(unless (= (char-before (point-max)) ?\n)
+  (message "vdiff: Warning %s does not end in a newline."
+   (if buffer-file-name buffer-file-name (buffer-name)))
+  (write-region "\n" nil tmp-a t 'quietly)))
   (with-current-buffer (cadr buffers)
 (write-region nil nil tmp-b nil 'quietly)
 ;; ensure tmp file ends in newline
-(save-excursion
-  (goto-char (point-max))
-  (unless (looking-at-p "\n")
-(write-region "\n" nil tmp-b t 'quietly
+(unless (= (char-before (point-max)) ?\n)
+  (message "vdiff: Warning %s does not end in a newline."
+   (if buffer-file-name buffer-file-name (buffer-name)))
+  (write-region "\n" nil tmp-b t 'quietly)))
   (when vdiff-3way-mode
 (with-current-buffer (nth 2 buffers)
   (write-region nil nil tmp-c nil 'quietly)
   ;; ensure tmp file ends in newline
-  (save-excursion
-(goto-char (point-max))
-(unless (looking-at-p "\n")
-  (write-region "\n" nil tmp-c t 'quietly)
+  (unless (= (char-before (point-max)) ?\n)
+(message "vdiff: Warning %s does not end in a newline."
+ (if buffer-file-name buffer-file-name (buffer-name)))
+(write-region "\n" nil tmp-c t 'quietly
   (when proc
 (kill-process proc))
   (with-current-buffer (get-buffer-create proc-buf)



[elpa] master 007e44b 56/57: Version 0.2.4

2020-11-03 Thread Justin Burkett
branch: master
commit 007e44be19d068fd6b49874b6e9b8df8b1f552bd
Author: Justin Burkett 
Commit: Justin Burkett 

Version 0.2.4
---
 vdiff.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vdiff.el b/vdiff.el
index eff7363..c90c1eb 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -5,7 +5,7 @@
 ;; Author: Justin Burkett 
 ;; Maintainer: Justin Burkett 
 ;; URL: https://github.com/justbur/emacs-vdiff
-;; Version: 0.2.3
+;; Version: 0.2.4
 ;; Keywords: diff
 ;; Package-Requires: ((emacs "24.4") (hydra "0.13.0"))
 



[elpa] master fe10fb3 44/57: Cleanup some of the transmit addition/changes logic

2020-11-03 Thread Justin Burkett
branch: master
commit fe10fb38cda249006219b40eb8a16fb592db
Author: Justin Burkett 
Commit: Justin Burkett 

Cleanup some of the transmit addition/changes logic
---
 vdiff.el | 58 --
 1 file changed, 24 insertions(+), 34 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 7a01aec..2c6085d 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1378,35 +1378,30 @@ immediately preceding line."
   (call-interactively 'vdiff-receive-changes)
   (call-interactively 'vdiff-next-hunk))
 
-(defun vdiff--maybe-beginning-of-line (beg)
-  (when (number-or-marker-p beg)
-(save-excursion
-  (goto-char beg)
-  (line-beginning-position
-
-(defun vdiff--maybe-end-of-line (end)
-  (when (number-or-marker-p end)
-(save-excursion
-  (goto-char end)
-  (unless (= (char-before) ?\n)
-(forward-line))
-  (point
+(defun vdiff--maybe-beginning-of-line (beg min)
+  (let ((beg (when (number-or-marker-p beg)
+   (save-excursion
+ (goto-char beg)
+ (line-beginning-position)
+(if (and beg (> beg min)) beg min)))
+
+(defun vdiff--maybe-end-of-line (end max)
+  (let ((end (when (number-or-marker-p end)
+   (save-excursion
+ (goto-char end)
+ (unless (= (char-before) ?\n)
+   (forward-line))
+ (point)
+(if (and end (< end max)) end max)))
 
 (defun vdiff--transmit-addition (ovr &optional targets beg end)
   "Send text in OVR to corresponding overlay in other buffer."
   (if (not (overlayp ovr))
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
-   ;; Expand to full line
-   (beg (vdiff--maybe-beginning-of-line beg))
-   (end (vdiff--maybe-end-of-line end))
-   (text (buffer-substring-no-properties
-  (if beg
-  (max beg (overlay-start ovr))
-(overlay-start ovr))
-  (if end
-  (min end (overlay-end ovr))
-(overlay-end ovr)
+   (beg (vdiff--maybe-beginning-of-line beg (overlay-start ovr)))
+   (end (vdiff--maybe-end-of-line end (overlay-end ovr)))
+   (text (buffer-substring-no-properties beg end)))
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
   (save-excursion
@@ -1420,18 +1415,13 @@ immediately preceding line."
   (if (not (overlayp ovr))
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
-   (beg (vdiff--maybe-beginning-of-line beg))
-   (beg-line (when beg (line-number-at-pos beg)))
-   (end (vdiff--maybe-end-of-line end))
-   (end-line (when end (line-number-at-pos end)))
+   (region (not (null beg)))
+   (beg (vdiff--maybe-beginning-of-line beg (overlay-start ovr)))
+   (beg-line (when region (line-number-at-pos beg)))
+   (end (vdiff--maybe-end-of-line end (overlay-end ovr)))
+   (end-line (when region (line-number-at-pos end)))
(from-buffer (vdiff--buffer-p))
-   (text (buffer-substring-no-properties
-  (if beg
-  (max beg (overlay-start ovr))
-(overlay-start ovr))
-  (if end
-  (min end (overlay-end ovr))
-(overlay-end ovr)
+   (text (buffer-substring-no-properties beg end)))
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
   (let* ((target-buffer (vdiff--buffer-p))



[elpa] master c0541ae 55/57: Update readme badges

2020-11-03 Thread Justin Burkett
branch: master
commit c0541ae9c2cb878be9ab3935da058a72155a14fc
Author: Justin Burkett 
Commit: Justin Burkett 

Update readme badges
---
 README.org | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 724b5e8..9fe6523 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-[[https://melpa.org/#/vdiff][file:https://melpa.org/packages/vdiff-badge.svg]] 
[[https://travis-ci.org/justbur/emacs-vdiff][https://travis-ci.org/justbur/emacs-vdiff.svg?branch=master]]
+[[https://melpa.org/#/vdiff][file:https://melpa.org/packages/vdiff-badge.svg]] 
[[evil-vdiff-test][https://github.com/justbur/emacs-vdiff/workflows/evil-vdiff-test/badge.svg]]
 
 * vdiff
 



[elpa] master 45923bb 41/57: Fix compiler warnings

2020-11-03 Thread Justin Burkett
branch: master
commit 45923bba71a26f4bc6f72837185797cf772f6821
Author: Justin Burkett 
Commit: Justin Burkett 

Fix compiler warnings
---
 vdiff.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 9ba59c0..7e568f7 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1361,7 +1361,7 @@ use the hunk under point or on the immediately preceding 
line."
   (call-interactively 'vdiff-send-changes)
   (call-interactively 'vdiff-next-hunk))
 
-(defun vdiff-receive-changes (beg end &optional region)
+(defun vdiff-receive-changes (beg end &optional _)
   "Receive the changes corresponding to this position from
 another vdiff buffer. This is equivalent to jumping to the
 corresponding buffer and sending from there. If the region is
@@ -1766,7 +1766,7 @@ buffer)."
   (dolist (other-fold (overlay-get ovr 'vdiff-other-folds))
 (vdiff--set-closed-fold-props other-fold)))
 
-(defun vdiff-open-fold (beg end &optional region)
+(defun vdiff-open-fold (beg end &optional _)
   "Open folds between BEG and END, as well as corresponding ones
 in other vdiff buffer. If called interactively, either open fold
 at point or on prior line. If the region is active open all folds
@@ -1777,7 +1777,7 @@ in the region."
   (vdiff--open-fold ovr)))
   (vdiff--scroll-function))
 
-(defun vdiff-close-fold (beg end &optional region)
+(defun vdiff-close-fold (beg end &optional _)
   "Close folds between BEG and END, as well as corresponding ones
 in other vdiff buffer. If called interactively, either close fold
 at point or on prior line. If the region is active close all
@@ -1788,7 +1788,7 @@ folds in the region."
   (vdiff--close-fold ovr)))
   (vdiff--scroll-function))
 
-(defun vdiff-toggle-fold (beg end &optional region)
+(defun vdiff-toggle-fold (beg end &optional _)
   "Toggles folds between BEG and END, as well as corresponding
 ones in other vdiff buffer. If called interactively, either
 toggle fold at point or on prior line. If the region is active



[elpa] master 5b643c7 24/57: Add another send/receive test

2020-11-03 Thread Justin Burkett
branch: master
commit 5b643c7839a2130591228862eb130f72e06f2c87
Author: Justin Burkett 
Commit: Justin Burkett 

Add another send/receive test
---
 vdiff-test.el | 23 +++
 vdiff.el  | 13 +
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/vdiff-test.el b/vdiff-test.el
index f885e17..9bb4a41 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -81,6 +81,18 @@
 
 (ert-deftest vdiff-test-transmiting ()
   "Test transmitting changes."
+  ;; Test sending first change
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (call-interactively 'vdiff-next-hunk)
+ (call-interactively 'vdiff-send-changes))
+   (with-current-buffer buffer-b
+ (should (string= (vdiff-test-buffer-string)
+  "1|2|3|4|5|6|8|8|9|10|"
+  ;; Test sending everything
   (vdiff-test-with-buffers
"1|2|3|4|5|6|7|8|9|10|"
"1|2|4|4|5|6|8|8|9|10|"
@@ -92,6 +104,17 @@
 
 (ert-deftest vdiff-test-receiving ()
   "Test receiving changes."
+  ;; Test receiving first change
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|4|4|5|6|8|8|9|10|"
+   (with-current-buffer buffer-b
+ (goto-char (point-min))
+ (call-interactively 'vdiff-next-hunk)
+ (call-interactively 'vdiff-receive-changes)
+ (should (string= (vdiff-test-buffer-string)
+  "1|2|3|4|5|6|8|8|9|10|"
+  ;; Test receiving everything
   (vdiff-test-with-buffers
"1|2|3|4|5|6|7|8|9|10|"
"1|2|4|4|5|6|8|8|9|10|"
diff --git a/vdiff.el b/vdiff.el
index df044e4..e636a91 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1760,33 +1760,38 @@ with non-nil USE-FOLDS."
  (next-overlay-change pnt)))
 pnt))
 
+(defun vdiff--recenter ()
+  "Wrapped version of `recenter'."
+  (unless vdiff--testing-mode
+(recenter)))
+
 (defun vdiff-next-hunk (arg)
   "Jump to next change in this buffer."
   (interactive "p")
   (let ((count (or arg 1)))
 (goto-char (vdiff--nth-hunk count))
-(recenter)))
+(vdiff--recenter)))
 
 (defun vdiff-previous-hunk (arg)
   "Jump to previous change in this buffer."
   (interactive "p")
   (let ((count (or (- arg) -1)))
 (goto-char (vdiff--nth-hunk count))
-(recenter)))
+(vdiff--recenter)))
 
 (defun vdiff-next-fold (arg)
   "Jump to next fold in this buffer."
   (interactive "p")
   (let ((count (or arg 1)))
 (goto-char (vdiff--nth-hunk count t))
-(recenter)))
+(vdiff--recenter)))
 
 (defun vdiff-previous-fold (arg)
   "Jump to previous fold in this buffer."
   (interactive "p")
   (let ((count (or (- arg) -1)))
 (goto-char (vdiff--nth-hunk count t))
-(recenter)))
+(vdiff--recenter)))
 
 ;; * Session
 



[elpa] master 835485b 13/57: Announce vdiff-diff-algorithm in README

2020-11-03 Thread Justin Burkett
branch: master
commit 835485b7f1ce93df19ac90becea363e137669866
Author: Justin Burkett 
Commit: Justin Burkett 

Announce vdiff-diff-algorithm in README

Addresses #18
---
 README.org | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index 9e536d9..24e1999 100644
--- a/README.org
+++ b/README.org
@@ -36,6 +36,8 @@ A tool like vimdiff for Emacs
Contributions and suggestions are very welcome.
 
 ** Recent (Significant) Changes
+   - [2018-04-17] Add option to use various git diff algorithms. See
+ =vdiff-diff-algorithm= for options.
- [2017-05-17] Split =vdiff-magit.el= into 
[[https://github.com/justbur/emacs-vdiff-magit][separate repository]]. 
- [2017-02-01] Added magit integration functions in =vdiff-magit.el=.
- [2016-07-25] Added three-way diff support. See =vdiff-buffers3= and 
=vdiff-files3=.
@@ -164,18 +166,20 @@ map. Bind =vdiff-hydra/body= directly to customize this 
key binding.
 
 ** Further customization

-The current customization options and there defaults are
+The current customization options and their defaults are

 #+BEGIN_SRC emacs-lisp
   ;; Whether to lock scrolling by default when starting vdiff
   (setq vdiff-lock-scrolling t)
 
-  ;; external diff program/command to use
-  (setq vdiff-diff-program "diff")
+  ;; diff program/algorithm to use. Allows choice of diff or git diff along 
with
+  ;; the various algorithms provided by these commands. See
+  ;; `vdiff-diff-algorithms' for the associated command line arguments.
+  (setq vdiff-diff-algorithm 'diff)
 
-  ;; Extra arguments to pass to diff. If this is set wrong, you may
-  ;; break vdiff.
-  (setq vdiff-diff-program-args "")
+  ;; diff3 command to use. Specify as a list where the car is the command to 
use
+  ;; and the remaining elements are the arguments to the command.
+  (setq vdiff-diff3-command '("diff3"))
 
   ;; Don't use folding in vdiff buffers if non-nil.
   (setq vdiff-disable-folding nil)



[elpa] master 185e803 57/57: Merge commit '007e44be19d068fd6b49874b6e9b8df8b1f552bd'

2020-11-03 Thread Justin Burkett
branch: master
commit 185e803a97d28e4932fbba9520d6f74fd70dcc87
Merge: 3bfaa7a 007e44b
Author: Justin Burkett 
Commit: Justin Burkett 

Merge commit '007e44be19d068fd6b49874b6e9b8df8b1f552bd'
---
 packages/vdiff/.github/workflows/test.yml |  30 ++
 packages/vdiff/.gitignore |   9 +-
 packages/vdiff/Cask   |   7 +
 packages/vdiff/Makefile   |  19 +
 packages/vdiff/README.org |  41 +-
 packages/vdiff/vdiff-test.el  | 210 +
 packages/vdiff/vdiff.el   | 687 +-
 7 files changed, 778 insertions(+), 225 deletions(-)

diff --git a/packages/vdiff/.github/workflows/test.yml 
b/packages/vdiff/.github/workflows/test.yml
new file mode 100644
index 000..7c77b01
--- /dev/null
+++ b/packages/vdiff/.github/workflows/test.yml
@@ -0,0 +1,30 @@
+name: evil-vdiff-test
+on:
+  pull_request:
+  push:
+branches:
+  - master
+
+jobs:
+  build:
+runs-on: ubuntu-latest
+strategy:
+  matrix:
+emacs_version:
+  - 25.1
+  - 25.2
+  - 25.3
+  - 26.1
+  - 26.2
+  - 26.3
+  - snapshot
+steps:
+
+- uses: actions/checkout@v2
+- uses: actions/setup-python@v1
+- uses: purcell/setup-emacs@master
+  with:
+version: ${{ matrix.emacs_version }}
+- uses: conao3/setup-cask@master
+- name: Run tests
+  run: make test
diff --git a/packages/vdiff/.gitignore b/packages/vdiff/.gitignore
index 82d13b8..e684078 100644
--- a/packages/vdiff/.gitignore
+++ b/packages/vdiff/.gitignore
@@ -1,4 +1,5 @@
-*.elc
-/vdiff-test.el
-/vdiff-test2.el
-/test*
+*.elc
+/vdiff-test.el
+/vdiff-test2.el
+/test*
+.cask/
diff --git a/packages/vdiff/Cask b/packages/vdiff/Cask
new file mode 100644
index 000..f3d27cf
--- /dev/null
+++ b/packages/vdiff/Cask
@@ -0,0 +1,7 @@
+(source gnu)
+
+(package-file "vdiff.el")
+
+(development
+ (depends-on "ert")
+ (depends-on "hydra"))
diff --git a/packages/vdiff/Makefile b/packages/vdiff/Makefile
new file mode 100644
index 000..6504277
--- /dev/null
+++ b/packages/vdiff/Makefile
@@ -0,0 +1,19 @@
+.PHONY : test
+
+EMACS ?= emacs
+CASK ?= cask
+
+LOADPATH = -L .
+
+ELPA_DIR = \
+   .cask/$(shell $(EMACS) -Q --batch --eval '(princ emacs-version)')/elpa
+
+test: elpa
+   $(CASK) exec $(EMACS) -Q -batch $(LOADPATH) \
+   -l vdiff-test.el -f ert-run-tests-batch-and-exit
+
+elpa: $(ELPA_DIR)
+$(ELPA_DIR): Cask
+   $(CASK) install
+   mkdir -p $(ELPA_DIR)
+   touch $@
diff --git a/packages/vdiff/README.org b/packages/vdiff/README.org
index 2d30c9e..9fe6523 100644
--- a/packages/vdiff/README.org
+++ b/packages/vdiff/README.org
@@ -1,4 +1,4 @@
-[[https://melpa.org/#/vdiff][file:https://melpa.org/packages/vdiff-badge.svg]]
+[[https://melpa.org/#/vdiff][file:https://melpa.org/packages/vdiff-badge.svg]] 
[[evil-vdiff-test][https://github.com/justbur/emacs-vdiff/workflows/evil-vdiff-test/badge.svg]]
 
 * vdiff
 
@@ -36,6 +36,12 @@ A tool like vimdiff for Emacs
Contributions and suggestions are very welcome.
 
 ** Recent (Significant) Changes
+   - [2019-02-26] If the region is active when changes are sent to other
+ buffers, only lines in the intersection of the region and any hunks are
+ sent. This allows sending individual lines, similar to how individual 
lines
+ can be staged in magit.
+   - [2018-04-17] Add option to use various git diff algorithms. See
+ =vdiff-diff-algorithm= for options.
- [2017-05-17] Split =vdiff-magit.el= into 
[[https://github.com/justbur/emacs-vdiff-magit][separate repository]]. 
- [2017-02-01] Added magit integration functions in =vdiff-magit.el=.
- [2016-07-25] Added three-way diff support. See =vdiff-buffers3= and 
=vdiff-files3=.
@@ -137,21 +143,7 @@ prefix in normal state.
 (evil-define-key 'normal vdiff-mode-map "," vdiff-mode-prefix-map)
 #+END_SRC
 
-To match vimdiff bindings some more work is required. The way the =d= command
-for evil is set up makes it difficult to bind =do= and =dp= as they exist in
-vimdiff. Here is a sample set of bindings that avoids this problem (thanks to
-@edkolev for these).
-
-#+BEGIN_SRC emacs-lisp
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "]c" 'vdiff-next-hunk)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "[c" 'vdiff-previous-hunk)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zc" 'vdiff-close-fold)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zM" 'vdiff-close-all-folds)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zo" 'vdiff-open-fold)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zR" 'vdiff-open-all-folds)
-  (evil-define-minor-mode-key 'motion 'vdiff-mode "go" 'vdiff-receive-changes)
-  (evil-define-minor-mode-key 'motion 'vdiff-mode "gp" 'vdiff-send-changes)
-#+END_SRC
+vimdiff-like binding are provided by 
[[https://github.com/emacs-evil/evil-collection][evil-collection]]'s 
[[https://github.com/emacs-evil/evil-co

[elpa] master 6878093 33/57: Add vdiff-toggle-fold and vdiff-toggle-all-folds

2020-11-03 Thread Justin Burkett
branch: master
commit 687809375f60ece916765003b48b419519551667
Author: Justin Burkett 
Commit: Justin Burkett 

Add vdiff-toggle-fold and vdiff-toggle-all-folds

Fixes #22
---
 vdiff.el | 40 +---
 1 file changed, 33 insertions(+), 7 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 4ac2bc0..d528d15 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1684,6 +1684,19 @@ buffer)."
   (overlay-put ovr 'intangible t)
   (overlay-put ovr 'display (overlay-get ovr 'vdiff-fold-text)))
 
+(defun vdiff--open-fold (ovr)
+  "Opens fold overlay OVR."
+  (vdiff--set-open-fold-props ovr)
+  (dolist (other-fold (overlay-get ovr 'vdiff-other-folds))
+(vdiff--set-open-fold-props other-fold)))
+
+(defun vdiff--close-fold (ovr)
+  "Closes fold overlay OVR."
+  (setf (vdiff-session-all-folds-open vdiff--session) nil)
+  (vdiff--set-closed-fold-props ovr)
+  (dolist (other-fold (overlay-get ovr 'vdiff-other-folds))
+(vdiff--set-closed-fold-props other-fold)))
+
 (defun vdiff-open-fold (beg end)
   "Open folds between BEG and END, as well as corresponding ones
 in other vdiff buffer. If called interactively, either open fold
@@ -1692,9 +1705,7 @@ in the region."
   (interactive (vdiff--region-or-close-overlay))
   (dolist (ovr (overlays-in beg end))
 (when (eq (overlay-get ovr 'vdiff-type) 'fold)
-  (vdiff--set-open-fold-props ovr)
-  (dolist (other-fold (overlay-get ovr 'vdiff-other-folds))
-(vdiff--set-open-fold-props other-fold
+  (vdiff--open-fold ovr)))
   (vdiff--scroll-function))
 
 (defun vdiff-close-fold (beg end)
@@ -1705,12 +1716,21 @@ folds in the region."
   (interactive (vdiff--region-or-close-overlay))
   (dolist (ovr (overlays-in beg end))
 (when (eq (overlay-get ovr 'vdiff-type) 'fold)
-  (setf (vdiff-session-all-folds-open vdiff--session) nil)
-  (vdiff--set-closed-fold-props ovr)
-  (dolist (other-fold (overlay-get ovr 'vdiff-other-folds))
-(vdiff--set-closed-fold-props other-fold
+  (vdiff--close-fold ovr)))
   (vdiff--scroll-function))
 
+(defun vdiff-toggle-fold (beg end)
+  "Toggles folds between BEG and END, as well as corresponding
+ones in other vdiff buffer. If called interactively, either
+toggle fold at point or on prior line. If the region is active
+toggle all folds in region."
+  (interactive (vdiff--region-or-close-overlay))
+  (dolist (ovr (overlays-in beg end))
+(when (eq (overlay-get ovr 'vdiff-type) 'fold)
+  (if (overlay-get ovr 'vdiff-fold-open)
+  (vdiff--close-fold ovr)
+(vdiff--open-fold ovr)
+
 (defun vdiff-open-all-folds ()
   "Open all folds in both buffers"
   (interactive)
@@ -1736,6 +1756,12 @@ folds in the region."
   (dolist (other-fold (overlay-get ovr 'vdiff-other-folds))
 (vdiff--set-closed-fold-props other-fold)
 
+(defun vdiff-toggle-all-folds ()
+  "Toggle all folds in both buffers"
+  (interactive)
+  (save-excursion
+(vdiff-toggle-fold (point-min) (point-max
+
 ;; * Movement
 
 (defun vdiff--nth-hunk (&optional n use-folds)



[elpa] master 58d530b 53/57: Add vdiff-temp-files

2020-11-03 Thread Justin Burkett
branch: master
commit 58d530bc30293663761067f17c61660280bfe1ef
Author: Justin Burkett 
Commit: Justin Burkett 

Add vdiff-temp-files

Fixes #26
---
 vdiff.el | 12 
 1 file changed, 12 insertions(+)

diff --git a/vdiff.el b/vdiff.el
index 29c02a4..eff7363 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1930,6 +1930,18 @@ arguments."
  (find-file-noselect file-b)
  rotate on-quit))
 
+(defun vdiff-temp-files ()
+  "Start a vidff session for two new temp files.
+
+This might be useful if you want to paste compare text pasted
+from another source."
+  (interactive)
+  (let ((file-a (make-temp-file "vdiff-"))
+(file-b (make-temp-file "vdiff-")))
+(write-region "\n" nil file-a)
+(write-region "\n" nil file-b)
+(vdiff-files file-a file-b)))
+
 (defcustom vdiff-2way-layout-function 'vdiff-2way-layout-function-default
   "Function to layout windows in 2way diffs.
 



[elpa] master c806fe2 36/57: Allow selective sending in change hunks

2020-11-03 Thread Justin Burkett
branch: master
commit c806fe20ce92f1743faf9b1e040937bfb22720f3
Author: Justin Burkett 
Commit: Justin Burkett 

Allow selective sending in change hunks
---
 vdiff.el | 30 --
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 7cb38d1..07bdc69 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1403,15 +1403,33 @@ immediately preceding line."
   (if (not (overlayp ovr))
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
-   (beg (overlay-start ovr))
-   (end (overlay-end ovr))
-   (text (buffer-substring-no-properties beg end)))
+   (beg (and (numberp beg) beg))
+   (end (and (numberp end) end))
+   (this-beg (if beg
+ (max beg (overlay-start ovr))
+   (overlay-start ovr)))
+   (this-end (if end
+ (min end (overlay-end ovr))
+   (overlay-end ovr)))
+   (text (buffer-substring-no-properties this-beg this-end))
+   (target-beg-line
+(when beg
+  (caar (vdiff--translate-line (line-number-at-pos beg)
+   (target-end-line
+(when end
+  (caar (vdiff--translate-line (line-number-at-pos end))
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
   (save-excursion
-(goto-char (overlay-start target))
-(delete-region (overlay-start target)
-   (overlay-end target))
+(if target-beg-line
+(vdiff--move-to-line target-beg-line)
+  (goto-char (overlay-start target)))
+(delete-region (point)
+   (save-excursion
+ (if target-end-line
+ (vdiff--move-to-line target-end-line)
+   (goto-char (overlay-end target)))
+ (point)))
 (insert text))
   (delete-overlay target)))
   (delete-overlay ovr



[elpa] master 09e15fc 51/57: Announce selective sending of changes using the region in README

2020-11-03 Thread Justin Burkett
branch: master
commit 09e15fc932bfd2febe1d4a65780a532394562b07
Author: Justin Burkett 
Commit: Justin Burkett 

Announce selective sending of changes using the region in README
---
 README.org | 4 
 1 file changed, 4 insertions(+)

diff --git a/README.org b/README.org
index 1389023..724b5e8 100644
--- a/README.org
+++ b/README.org
@@ -36,6 +36,10 @@ A tool like vimdiff for Emacs
Contributions and suggestions are very welcome.
 
 ** Recent (Significant) Changes
+   - [2019-02-26] If the region is active when changes are sent to other
+ buffers, only lines in the intersection of the region and any hunks are
+ sent. This allows sending individual lines, similar to how individual 
lines
+ can be staged in magit.
- [2018-04-17] Add option to use various git diff algorithms. See
  =vdiff-diff-algorithm= for options.
- [2017-05-17] Split =vdiff-magit.el= into 
[[https://github.com/justbur/emacs-vdiff-magit][separate repository]]. 



[elpa] master e3f5370 37/57: Handle case where full line is not selected in selective send

2020-11-03 Thread Justin Burkett
branch: master
commit e3f5370d7b32dabf44f5ceb2d169e75feb17043b
Author: Justin Burkett 
Commit: Justin Burkett 

Handle case where full line is not selected in selective send
---
 vdiff.el | 47 ---
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 07bdc69..bb7c7bb 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1378,18 +1378,35 @@ immediately preceding line."
   (call-interactively 'vdiff-receive-changes)
   (call-interactively 'vdiff-next-hunk))
 
+(defun vdiff--maybe-beginning-of-line (beg)
+  (when (number-or-marker-p beg)
+(save-excursion
+  (goto-char beg)
+  (line-beginning-position
+
+(defun vdiff--maybe-end-of-line (end)
+  (when (number-or-marker-p end)
+(save-excursion
+  (goto-char end)
+  (unless (= (char-before) ?\n)
+(forward-line))
+  (point
+
 (defun vdiff--transmit-addition (ovr &optional targets beg end)
   "Send text in OVR to corresponding overlay in other buffer."
   (if (not (overlayp ovr))
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
-   (beg (if (numberp beg)
-(max beg (overlay-start ovr))
-  (overlay-start ovr)))
-   (end (if (numberp end)
-(min end (overlay-end ovr))
-  (overlay-end ovr)))
-   (text (buffer-substring-no-properties beg end)))
+   ;; Expand to full line
+   (beg (vdiff--maybe-beginning-of-line beg))
+   (end (vdiff--maybe-end-of-line end))
+   (text (buffer-substring-no-properties
+  (if beg
+  (max beg (overlay-start ovr))
+(overlay-start ovr))
+  (if end
+  (min end (overlay-end ovr))
+(overlay-end ovr)
   (dolist (target target-ovrs)
 (with-current-buffer (overlay-buffer target)
   (save-excursion
@@ -1403,15 +1420,15 @@ immediately preceding line."
   (if (not (overlayp ovr))
   (message "No change found")
 (let* ((target-ovrs (or targets (vdiff--target-overlays ovr)))
-   (beg (and (numberp beg) beg))
-   (end (and (numberp end) end))
-   (this-beg (if beg
- (max beg (overlay-start ovr))
-   (overlay-start ovr)))
-   (this-end (if end
+   (beg (vdiff--maybe-beginning-of-line beg))
+   (end (vdiff--maybe-end-of-line end))
+   (text (buffer-substring-no-properties
+  (if beg
+  (max beg (overlay-start ovr))
+(overlay-start ovr))
+  (if end
  (min end (overlay-end ovr))
-   (overlay-end ovr)))
-   (text (buffer-substring-no-properties this-beg this-end))
+   (overlay-end ovr
(target-beg-line
 (when beg
   (caar (vdiff--translate-line (line-number-at-pos beg)



[elpa] master fd6ec8e 25/57: Test that both buffers are correct by default

2020-11-03 Thread Justin Burkett
branch: master
commit fd6ec8e00bdad86e3ead4116da1ce2617346e333
Author: Justin Burkett 
Commit: Justin Burkett 

Test that both buffers are correct by default
---
 vdiff-test.el | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/vdiff-test.el b/vdiff-test.el
index 9bb4a41..fa03a3f 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -23,10 +23,8 @@
 (require 'ert)
 (require 'vdiff)
 
-(defun vdiff-test-buffer-string ()
-  (replace-regexp-in-string "\n" "|" (buffer-string)))
-
-(defmacro vdiff-test-with-buffers (a-string b-string &rest body)
+(defmacro vdiff-test-with-buffers
+(a-string b-string operation final-a-string final-b-string)
   `(let ((buffer-a (get-buffer-create "vdiff-tests-buffer-a"))
  (buffer-b (get-buffer-create "vdiff-tests-buffer-b"))
  (vdiff--testing-mode t))
@@ -39,7 +37,13 @@
  (erase-buffer)
  (insert ,(replace-regexp-in-string "|" "\n" b-string)))
(vdiff-buffers buffer-a buffer-b nil nil nil t)
-   ,@body)
+   ,operation
+   (with-current-buffer buffer-a
+ (should (string= (buffer-string)
+  ,(replace-regexp-in-string "|" "\n" 
final-a-string
+   (with-current-buffer buffer-b
+ (should (string= (buffer-string)
+  ,(replace-regexp-in-string "|" "\n" 
final-b-string)
(with-current-buffer buffer-a
  (vdiff-quit)
 
@@ -89,18 +93,16 @@
  (goto-char (point-min))
  (call-interactively 'vdiff-next-hunk)
  (call-interactively 'vdiff-send-changes))
-   (with-current-buffer buffer-b
- (should (string= (vdiff-test-buffer-string)
-  "1|2|3|4|5|6|8|8|9|10|"
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|3|4|5|6|8|8|9|10|")
   ;; Test sending everything
   (vdiff-test-with-buffers
"1|2|3|4|5|6|7|8|9|10|"
"1|2|4|4|5|6|8|8|9|10|"
(with-current-buffer buffer-a
  (vdiff-send-changes (point-min) (point-max)))
-   (with-current-buffer buffer-b
- (should (string= (vdiff-test-buffer-string)
-  "1|2|3|4|5|6|7|8|9|10|")
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|3|4|5|6|7|8|9|10|"))
 
 (ert-deftest vdiff-test-receiving ()
   "Test receiving changes."
@@ -111,18 +113,17 @@
(with-current-buffer buffer-b
  (goto-char (point-min))
  (call-interactively 'vdiff-next-hunk)
- (call-interactively 'vdiff-receive-changes)
- (should (string= (vdiff-test-buffer-string)
-  "1|2|3|4|5|6|8|8|9|10|"
+ (call-interactively 'vdiff-receive-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|3|4|5|6|8|8|9|10|")
   ;; Test receiving everything
   (vdiff-test-with-buffers
"1|2|3|4|5|6|7|8|9|10|"
"1|2|4|4|5|6|8|8|9|10|"
(with-current-buffer buffer-b
  (vdiff-receive-changes (point-min) (point-max)))
-   (with-current-buffer buffer-b
- (should (string= (vdiff-test-buffer-string)
-  "1|2|3|4|5|6|7|8|9|10|")
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|3|4|5|6|7|8|9|10|"))
 
 
 (provide 'vdiff-test)



[elpa] master 90f4b24 52/57: Ensure char-before doesn't cause an error

2020-11-03 Thread Justin Burkett
branch: master
commit 90f4b242e1a402dddafccff09e8d161b12416f13
Author: Justin Burkett 
Commit: Justin Burkett 

Ensure char-before doesn't cause an error

It won't return a number when at the beginning of a buffer.
---
 vdiff.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 32b2092..29c02a4 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -536,14 +536,16 @@ POST-REFRESH-FUNCTION is called when the process 
finishes."
   (with-current-buffer (car buffers)
 (write-region nil nil tmp-a nil 'quietly)
 ;; ensure tmp file ends in newline
-(unless (= (char-before (point-max)) ?\n)
+(when (or (= (point-min) (point-max))
+  (/= (char-before (point-max)) ?\n))
   (message "vdiff: Warning %s does not end in a newline."
(if buffer-file-name buffer-file-name (buffer-name)))
   (write-region "\n" nil tmp-a t 'quietly)))
   (with-current-buffer (cadr buffers)
 (write-region nil nil tmp-b nil 'quietly)
 ;; ensure tmp file ends in newline
-(unless (= (char-before (point-max)) ?\n)
+(when (or (= (point-min) (point-max))
+  (/= (char-before (point-max)) ?\n))
   (message "vdiff: Warning %s does not end in a newline."
(if buffer-file-name buffer-file-name (buffer-name)))
   (write-region "\n" nil tmp-b t 'quietly)))
@@ -551,7 +553,8 @@ POST-REFRESH-FUNCTION is called when the process finishes."
 (with-current-buffer (nth 2 buffers)
   (write-region nil nil tmp-c nil 'quietly)
   ;; ensure tmp file ends in newline
-  (unless (= (char-before (point-max)) ?\n)
+  (when (or (= (point-min) (point-max))
+(/= (char-before (point-max)) ?\n))
 (message "vdiff: Warning %s does not end in a newline."
  (if buffer-file-name buffer-file-name (buffer-name)))
 (write-region "\n" nil tmp-c t 'quietly
@@ -1390,7 +1393,8 @@ immediately preceding line."
   (let ((end (when (number-or-marker-p end)
(save-excursion
  (goto-char end)
- (unless (= (char-before) ?\n)
+ (when (and (char-before)
+(/= (char-before) ?\n))
(forward-line))
  (point)
 (if (and end (< end max)) end max)))



[elpa] master 0e10521 31/57: Merge pull request #20 from edkolev/patch-1

2020-11-03 Thread Justin Burkett
branch: master
commit 0e105218f167541421018bb61567f975f4ac16b8
Merge: 40ffc92 45666cc
Author: Justin Burkett 
Commit: GitHub 

Merge pull request #20 from edkolev/patch-1

README: evil-collection adds vimdiff-like bindings
---
 README.org | 16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/README.org b/README.org
index 713487e..1389023 100644
--- a/README.org
+++ b/README.org
@@ -139,21 +139,7 @@ prefix in normal state.
 (evil-define-key 'normal vdiff-mode-map "," vdiff-mode-prefix-map)
 #+END_SRC
 
-To match vimdiff bindings some more work is required. The way the =d= command
-for evil is set up makes it difficult to bind =do= and =dp= as they exist in
-vimdiff. Here is a sample set of bindings that avoids this problem (thanks to
-@edkolev for these).
-
-#+BEGIN_SRC emacs-lisp
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "]c" 'vdiff-next-hunk)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "[c" 'vdiff-previous-hunk)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zc" 'vdiff-close-fold)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zM" 'vdiff-close-all-folds)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zo" 'vdiff-open-fold)
-  (evil-define-minor-mode-key 'normal 'vdiff-mode "zR" 'vdiff-open-all-folds)
-  (evil-define-minor-mode-key 'motion 'vdiff-mode "go" 'vdiff-receive-changes)
-  (evil-define-minor-mode-key 'motion 'vdiff-mode "gp" 'vdiff-send-changes)
-#+END_SRC
+vimdiff-like binding are provided by 
[[https://github.com/emacs-evil/evil-collection][evil-collection]]'s 
[[https://github.com/emacs-evil/evil-collection/blob/master/evil-collection-vdiff.el][evil-collection-vdiff.el]]
 
 ** Hydra
 



[elpa] master 08437d5 48/57: Update gitignore

2020-11-03 Thread Justin Burkett
branch: master
commit 08437d5b5ba29e3be9fa08eb202b5d7e3f790ca0
Author: Justin Burkett 
Commit: Justin Burkett 

Update gitignore
---
 .gitignore | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 82d13b8..e684078 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
-*.elc
-/vdiff-test.el
-/vdiff-test2.el
-/test*
+*.elc
+/vdiff-test.el
+/vdiff-test2.el
+/test*
+.cask/



[elpa] master ef899b8 46/57: Reset truncate-lines on cleanup

2020-11-03 Thread Justin Burkett
branch: master
commit ef899b82c4df6276306f1a92d6fc5530a82690b4
Author: Justin Burkett 
Commit: Justin Burkett 

Reset truncate-lines on cleanup

See #21
---
 vdiff.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 17011fb..226c3ab 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -231,6 +231,7 @@ because those are handled differently.")
 (defvar vdiff--inhibit-window-switch nil)
 (defvar vdiff--inhibit-diff-update nil)
 (defvar vdiff--in-scroll-hook nil)
+(defvar vdiff--cleanup-hook nil)
 ;; (defvar vdiff--in-post-command-hook nil)
 (defvar vdiff--setting-vscroll nil)
 (defvar vdiff--after-change-timer nil)
@@ -2218,8 +2219,10 @@ See README for entry points into a vdiff session."))
   (current-window-configuration))
 (when vdiff-lock-scrolling
   (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t))
-(when vdiff-truncate-lines
+(when (and vdiff-truncate-lines (null truncate-lines))
   (let (message-log-max)
+(add-hook 'vdiff--cleanup-hook
+  (lambda () (toggle-truncate-lines 0)) nil t)
 (toggle-truncate-lines 1)
 
 (defun vdiff--buffer-cleanup ()
@@ -2229,7 +2232,8 @@ See README for entry points into a vdiff session."))
 (remove-hook 'after-save-hook #'vdiff-refresh t)
 (remove-hook 'after-change-functions #'vdiff--after-change-function t)
 (remove-hook 'pre-command-hook #'vdiff--flag-new-command t))
-  (remove-hook 'window-scroll-functions #'vdiff--scroll-function t))
+  (remove-hook 'window-scroll-functions #'vdiff--scroll-function t)
+  (run-hooks 'vdiff--cleanup-hook))
 
 (define-minor-mode vdiff-mode
   "Minor mode active in a vdiff session involving two



[elpa] master a1a82de 50/57: Merge pull request #25 from justbur/send-region

2020-11-03 Thread Justin Burkett
branch: master
commit a1a82dec623a241b0e9ed19fd65da6e7073d59ac
Merge: c5e0cb0 0efde18
Author: Justin Burkett 
Commit: GitHub 

Merge pull request #25 from justbur/send-region

Send region
---
 vdiff-test.el |  54 +
 vdiff.el  | 153 +-
 2 files changed, 162 insertions(+), 45 deletions(-)

diff --git a/vdiff-test.el b/vdiff-test.el
index b026319..c5ea48c 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -32,9 +32,13 @@
  (progn
(with-current-buffer buffer-a
  (erase-buffer)
+ ;; this seems necessary for batch mode
+ (transient-mark-mode 1)
  (insert ,(replace-regexp-in-string "|" "\n" a-string)))
(with-current-buffer buffer-b
  (erase-buffer)
+ ;; this seems necessary for batch mode
+ (transient-mark-mode 1)
  (insert ,(replace-regexp-in-string "|" "\n" b-string)))
(vdiff-buffers buffer-a buffer-b)
,operation
@@ -152,5 +156,55 @@
"1|2|3|4|5|6|7|8|9|10|"))
 
 
+(ert-deftest vdiff-test-selective-transmiting ()
+  "Test transmitting changes when region is active."
+  ;; Test sending first line of first change
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (forward-line)
+ (set-mark (point))
+ (forward-line)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|x|x|5|6|8|8|9|10|")
+  ;; Test sending second line of first change
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (forward-line 2)
+ (set-mark (point))
+ (forward-line)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|3|x|5|6|8|8|9|10|")
+  ;; Test sending first line of first change when region begins before
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (set-mark (point))
+ (forward-line 2)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|x|x|5|6|8|8|9|10|")
+  ;; Test sending last two lines of first change when region ends after
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (forward-line 2)
+ (set-mark (point))
+ (forward-line 3)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|3|4|5|6|8|8|9|10|"))
+
 (provide 'vdiff-test)
 ;;; vdiff-test.el ends here
diff --git a/vdiff.el b/vdiff.el
index 226c3ab..32b2092 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -1314,9 +1314,9 @@ of a \"word\"."
 overlay at point and return it if there is. If this fails check a
 line above. Always search to the end of the current line as
 well. This only returns bounds for `interactive'."
-  (if (region-active-p)
+  (if (use-region-p)
   (prog1
-  (list (region-beginning) (region-end))
+  (list (region-beginning) (region-end) t)
 (deactivate-mark))
 (list (if (or (= (line-number-at-pos) 1)
   (vdiff--overlay-at-pos
@@ -1327,9 +1327,11 @@ well. This only returns bounds for `interactive'."
   (line-beginning-position)))
   (save-excursion
 (forward-line 1)
-(point)
+(point))
+  nil)))
 
-(defun vdiff-send-changes (beg end &optional receive targets dont-refresh)
+(defun vdiff-send-changes
+(beg end &optional region receive targets dont-refresh)
   "Send changes in this hunk to another vdiff buffer. If the
 region is active, send all changes found in the region. Otherwise
 use the hunk under point or on the immediately preceding line."
@@ -1342,10 +1344,13 @@ use the hunk under point or on the immediately 
preceding line."
 (or targets (vdiff--target-overlays ovr t
  (let ((pos (overlay-start (car target-ovrs
(with-current-buffer (overlay-buffer (car target-ovrs))
- (vdiff-send-changes pos (1+ pos) nil nil t
-((memq (overlay-get ovr 'vdiff-type)
-   '(change addition))
- (vdiff--transmit-change ovr targets))
+ (vdiff-send-changes pos (1+ pos) nil nil nil t
+((eq (overlay-get ovr 'vdiff-type) 'addition)
+ (vdiff--transmit-addition
+  ovr targets (when region beg) (when region end)))
+((eq (overlay-get ovr 'vdiff-type) 'change)
+ (vdiff--transmit-change
+  ovr targets (when region beg) (when region end)))
 ((eq (overlay-get ovr 'vdiff-type) 'subtraction)
  (vdiff--transmit-subtraction ovr targets
 (unless d

[elpa] master 745cc02 42/57: Add test for selective send

2020-11-03 Thread Justin Burkett
branch: master
commit 745cc02d5786ebe451591d774c699773e8128ade
Author: Justin Burkett 
Commit: Justin Burkett 

Add test for selective send
---
 vdiff-test.el | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/vdiff-test.el b/vdiff-test.el
index b026319..d2833c9 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -152,5 +152,55 @@
"1|2|3|4|5|6|7|8|9|10|"))
 
 
+(ert-deftest vdiff-test-selective-transmiting ()
+  "Test transmitting changes when region is active."
+  ;; Test sending first line of first change
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (forward-line)
+ (set-mark (point))
+ (forward-line)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|x|x|5|6|8|8|9|10|")
+  ;; Test sending second line of first change
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (forward-line 2)
+ (set-mark (point))
+ (forward-line)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|3|x|5|6|8|8|9|10|")
+  ;; Test sending first line of first change when region begins before
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (set-mark (point))
+ (forward-line 2)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|2|x|x|5|6|8|8|9|10|")
+  ;; Test sending last two lines of first change when region ends after
+  (vdiff-test-with-buffers
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|x|x|5|6|8|8|9|10|"
+   (with-current-buffer buffer-a
+ (goto-char (point-min))
+ (forward-line 2)
+ (set-mark (point))
+ (forward-line 3)
+ (call-interactively 'vdiff-send-changes))
+   "1|2|3|4|5|6|7|8|9|10|"
+   "1|x|3|4|5|6|8|8|9|10|"))
+
 (provide 'vdiff-test)
 ;;; vdiff-test.el ends here



[elpa] master c732247 45/57: Reset truncate-lines on cleanup

2020-11-03 Thread Justin Burkett
branch: master
commit c732247f19c56caa32e679633a0d7ae158aab56c
Author: Justin Burkett 
Commit: Justin Burkett 

Reset truncate-lines on cleanup

See #21
---
 vdiff.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 2c6085d..a6a3130 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -231,6 +231,7 @@ because those are handled differently.")
 (defvar vdiff--inhibit-window-switch nil)
 (defvar vdiff--inhibit-diff-update nil)
 (defvar vdiff--in-scroll-hook nil)
+(defvar vdiff--cleanup-hook nil)
 ;; (defvar vdiff--in-post-command-hook nil)
 (defvar vdiff--setting-vscroll nil)
 (defvar vdiff--after-change-timer nil)
@@ -2281,8 +2282,10 @@ See README for entry points into a vdiff session."))
   (current-window-configuration))
 (when vdiff-lock-scrolling
   (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t))
-(when vdiff-truncate-lines
+(when (and vdiff-truncate-lines (null truncate-lines))
   (let (message-log-max)
+(add-hook 'vdiff--cleanup-hook
+  (lambda () (toggle-truncate-lines 0)) nil t)
 (toggle-truncate-lines 1)
 
 (defun vdiff--buffer-cleanup ()
@@ -2292,7 +2295,8 @@ See README for entry points into a vdiff session."))
 (remove-hook 'after-save-hook #'vdiff-refresh t)
 (remove-hook 'after-change-functions #'vdiff--after-change-function t)
 (remove-hook 'pre-command-hook #'vdiff--flag-new-command t))
-  (remove-hook 'window-scroll-functions #'vdiff--scroll-function t))
+  (remove-hook 'window-scroll-functions #'vdiff--scroll-function t)
+  (run-hooks 'vdiff--cleanup-hook))
 
 (define-minor-mode vdiff-mode
   "Minor mode active in a vdiff session involving two