From: Juri Linkov Date: Thu, 20 May 2021 18:23:01 +0000 (+0300) Subject: * lisp/vc/diff-mode.el (diff-hunk-text): Handle better "\ No newline at end". X-Git-Tag: emacs-28.0.90~2376 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9be9d1f94ed6506f5b9659dfb40e5b5d8cdb3310;p=emacs.git * lisp/vc/diff-mode.el (diff-hunk-text): Handle better "\ No newline at end". --- diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 2c72c45f4b2..4118a2ea06c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -1771,7 +1771,14 @@ char-offset in TEXT." (goto-char (point-min)) (while (not (eobp)) (if (memq (char-after) kill-chars) - (delete-region (point) (progn (forward-line 1) (point))) + (delete-region + ;; Check for "\ No newline at end of file" + (if (and (eq (char-after) ?\\) + (save-excursion + (forward-line 1) (eobp))) + (1- (point)) + (point)) + (progn (forward-line 1) (point))) (delete-char num-pfx-chars) (forward-line 1)))))