From: Stefan Monnier Date: Tue, 7 Dec 2010 19:48:15 +0000 (-0500) Subject: * diff-mode.el (diff-refine-hunk): Make it work when the hunk contains X-Git-Tag: emacs-pretest-23.2.91~14 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b1816a74de23a28f4ab3f39d7bcedb81cc13fd13;p=emacs.git * diff-mode.el (diff-refine-hunk): Make it work when the hunk contains empty lines without a leading space. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e16bcdaabcc..94f0bc96277 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-12-07 Stefan Monnier + + * diff-mode.el (diff-refine-hunk): Make it work when the hunk contains + empty lines without a leading space. + 2010-12-06 Leo * dired-aux.el (dired-do-redisplay): Postphone diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 907bf7d5b83..017d1b21b5a 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -1827,10 +1827,13 @@ For use in `add-log-current-defun-function'." (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)