unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dima Kogan <dima@secretsauce.net>
To: Mark Oteiza <mvoteiza@udel.edu>
Cc: 25105@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>,
	emacs-devel@gnu.org
Subject: bug#25105: [Emacs-diffs] master 2c8a7e5: Improve diff-mode navigation/manipulation
Date: Tue, 06 Dec 2016 23:29:04 -0800	[thread overview]
Message-ID: <874m2gfb9b.fsf__12924.6916076683$1481095821$gmane$org@secretsauce.net> (raw)
In-Reply-To: <878trtoluv.fsf@udel.edu>

[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]

Mark Oteiza <mvoteiza@udel.edu> writes:

> Fixing C-c C-a to DTRT is great, thanks, but I don't think the
> off-by-one navigation changes to "n" and "p" (diff-hunk-next,
> diff-hunk-prev) make sense. While it may have made fixing the issues
> mentioned in the commit message easier, the changes to what "n" and "p"
> do at the beginning and end of a diff are not documented, and I didn't
> see any discussion of it in the associated bug.
>
> I contend that the new behavior is inconsistent with the behavior of
> other outline/thing-with-headers type things in Emacs.  outline-mode,
> org-mode, and rst-mode are the first ones that come to mind.

Can you give a specific example of interaction in any of these modes
that is analogous to the off-by-one behavior you're referring to? The
fundamental question is what hunk diff-mode should think the point is
looking at, when it is in some non-diff message above the first hunk.
The answer I chose for the new navigation logic is "first hunk". You
could also choose "invalid hunk, not a hunk at all", which would imply
that C-c C-a and M-ret and such shouldn't work there. Better suggestions
welcome.


> It's also not clear how the introduced oddity with auto-refine is going
> to be resolved, unless a way is found to autorefine the first hunk
> without there being any user interaction.  Then opening a diff has
> inconsistent auto-refining from the start.

I don't use auto-refinement, so didn't notice the breakage. Will look at
it in a bit.

In the meantime, I'm attaching a patch to address the 2nd point in the
bug report (25105). This serves to treat the junk before the first hunk
(i.e. commit message from 'git format-patch') as a file header. Looks
reasonable?



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: diff-mode-handle-initial-junk.patch --]
[-- Type: text/x-diff, Size: 544 bytes --]

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 5b48c8d..41476bd 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -768,7 +768,7 @@ diff-beginning-of-file-and-junk
         (setq prevfile nextfile))
     (if (and previndex (numberp prevfile) (< previndex prevfile))
         (setq prevfile previndex))
-    (if (and (numberp prevfile) (<= prevfile start))
+    (if (numberp prevfile)
           (progn
             (goto-char prevfile)
             ;; Now skip backward over the leading junk we may have before the

       reply	other threads:[~2016-12-07  7:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <874m2q1oca.fsf@gmail.com>
     [not found] ` <878trtoluv.fsf@udel.edu>
2016-12-07  7:29   ` Dima Kogan [this message]
     [not found]   ` <874m2gfb9b.fsf@secretsauce.net>
2017-01-06  2:58     ` bug#25105: [Emacs-diffs] master 2c8a7e5: Improve diff-mode navigation/manipulation Mark Oteiza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='874m2gfb9b.fsf__12924.6916076683$1481095821$gmane$org@secretsauce.net' \
    --to=dima@secretsauce.net \
    --cc=25105@debbugs.gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mvoteiza@udel.edu \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).