branch: master commit 5667bc6204086f129292122e6b1b08e9a93906a1 Author: Justin Burkett <jus...@burkett.cc> Commit: Justin Burkett <jus...@burkett.cc>
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)