Subject: Re: bug#12894: 24.2.50; Auto refine all hunks in a diff

From: Stefan Monnier <[email-masked]>
Date: Thu, 15 Nov 2012 09:44:19 -0500

tags 12894 notabug
thanks

> ;; enable Diff Auto Refine mode (highlight the changes with better
> ;; granularity)
> (defun my/diff-refine-all-hunks ()
>   (interactive)
>   (condition-case nil
>       (save-excursion
>         (goto-char (point-min))
>         (while (not (eobp))
>           (diff-hunk-next)))
>     (error nil)))

The fact that my/diff-refine-all-hunks does not call diff-refine-hunk is
a good indication that your code is at least brittle, since it relies on
some side-effect of diff-hunk-next.

What you're seeing is that diff-hunk-next's use of diff-refine-hunk is
only meant for interactive use, so all it does is schedule
diff-refine-hunk to be run "at the end of the current command".

        Stefan