Subject: Re: bug#3033: 23.0.92; Try to auto fix whitespace loss? (y/n)

From: martin rudalics <[email-masked]>
Date: Mon, 20 Apr 2009 09:58:19 +0200

> I have used edebug and error-on-quit to trace the culprit and find a
 > reproducible recipe. It turns out it has nothing to do with whitespace.
 >
 > 1. emacs -q
 > 2. M-x which-func-mode
 > 3. C-x C-f emacs-gnus-ticked-doc.patch
 >
[...]
 > In my experience, I have found which-func-mode to be intrusive and
 > unreliable. So I guess I will have to disable it to avoid further
 > trouble.

Looks to me like a bug in `diff-sanity-check-hunk' which fails to make
the hunk well-formed.  However, I think `diff-find-source-location'
shouldn't do any sanity checks in the first place when called with a
non-nil NOPROMPT argument.  So could you try whether the attached patch
solves your problem?

Thanks, martin.
*** diff-mode.el.~1.157.~	2009-01-13 15:55:57.000000000 +0100
--- diff-mode.el	2009-04-20 09:39:22.515625000 +0200
***************
*** 1575,1581 ****
             ;; the user may disagree on what constitutes the hunk
             ;; (e.g. because an empty line truncates the hunk mid-course),
             ;; leading to potentially nasty surprises for the user.
!            (_ (diff-sanity-check-hunk))
  	   (hunk (buffer-substring
                    (point) (save-excursion (diff-end-of-hunk) (point))))
  	   (old (diff-hunk-text hunk reverse char-offset))
--- 1575,1581 ----
             ;; the user may disagree on what constitutes the hunk
             ;; (e.g. because an empty line truncates the hunk mid-course),
             ;; leading to potentially nasty surprises for the user.
!            (_ (unless noprompt (diff-sanity-check-hunk)))
  	   (hunk (buffer-substring
                    (point) (save-excursion (diff-end-of-hunk) (point))))
  	   (old (diff-hunk-text hunk reverse char-offset))