changeset 111919:99a401ad0d45

* diff-mode.el (diff-refine-hunk): Make it work when the hunk contains empty lines without a leading space.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 07 Dec 2010 14:48:15 -0500
parents e71e87e08d5f
children b20a03371655
files lisp/ChangeLog lisp/diff-mode.el
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Dec 07 14:44:38 2010 -0500
+++ b/lisp/ChangeLog	Tue Dec 07 14:48:15 2010 -0500
@@ -1,3 +1,8 @@
+2010-12-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* diff-mode.el (diff-refine-hunk): Make it work when the hunk contains
+	empty lines without a leading space.
+
 2010-12-06  Leo <sdl.web@gmail.com>
 
 	* dired-aux.el (dired-do-redisplay): Postphone
--- a/lisp/diff-mode.el	Tue Dec 07 14:44:38 2010 -0500
+++ b/lisp/diff-mode.el	Tue Dec 07 14:48:15 2010 -0500
@@ -1827,10 +1827,13 @@
   (eval-and-compile (require 'smerge-mode))
   (save-excursion
     (diff-beginning-of-hunk 'try-harder)
-    (let* ((style (diff-hunk-style))    ;Skips the hunk header as well.
+    (let* ((start (point))
+           (style (diff-hunk-style))    ;Skips the hunk header as well.
            (beg (point))
            (props '((diff-mode . fine) (face diff-refine-change)))
-           (end (progn (diff-end-of-hunk) (point))))
+           ;; Be careful to go back to `start' so diff-end-of-hunk gets
+           ;; to read the hunk header's line info.
+           (end (progn (goto-char start) (diff-end-of-hunk) (point))))
 
       (remove-overlays beg end 'diff-mode 'fine)