Subject: Re: bug#25400: M-p in diff-mode jumps too far

From: Stefan Monnier <[email-masked]>
Date: Sun, 08 Jan 2017 23:34:52 -0500

>> In a buffer with more than one hunk, if I'm in the middle of hunk number
>> N, diff-hunk-prev (usually bound to M-p) jumps to the header of hunk
>> number N-1 rather than to the header of hunk N.
>> 
>> This is contrary to the usual behavior of Emacs's navigation commands.

> Implemented in 2c8a7e5 (bug#17544). Apparently it was intended.

> https://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00222.html

> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25105

Maybe it's OK to change the behavior of `diff-hunk-prev` this way when
called from Elisp (I still find it odd, but it might work better for
the callers), but it's clearly not a good idea for M-p to behave
this way.

As pointed out elsewhere, it's particularly obnoxious from EOB (in which
case, you're not really "within N" but you're virtually on "the header
of the non-existent hunk N+1", so going to the header of N-1 is really
wrong).

I also dislike the fact that M-n doesn't let me get to EOB.

        Stefan