From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#25105: [Emacs-diffs] master 2c8a7e5: Improve diff-mode navigation/manipulation Date: Tue, 06 Dec 2016 23:29:04 -0800 Message-ID: <874m2gfb9b.fsf__12924.6916076683$1481095821$gmane$org@secretsauce.net> References: <874m2q1oca.fsf@gmail.com> <878trtoluv.fsf@udel.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1481095821 11116 195.159.176.226 (7 Dec 2016 07:30:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Dec 2016 07:30:21 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 26.0.50.1 Cc: 25105@debbugs.gnu.org, Tino Calancha , emacs-devel@gnu.org To: Mark Oteiza Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 07 08:30:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEWg6-0000qX-2k for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Dec 2016 08:30:10 +0100 Original-Received: from localhost ([::1]:36787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEWg8-0004dc-C4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Dec 2016 02:30:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEWg0-0004cU-C9 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:30:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEWfy-0000hJ-OX for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:30:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43377) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cEWfy-0000gg-Kd for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cEWfy-0001qr-Bm for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Dec 2016 07:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25105 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25105-submit@debbugs.gnu.org id=B25105.14810957497032 (code B ref 25105); Wed, 07 Dec 2016 07:30:02 +0000 Original-Received: (at 25105) by debbugs.gnu.org; 7 Dec 2016 07:29:09 +0000 Original-Received: from localhost ([127.0.0.1]:58776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEWf6-0001pM-OL for submit@debbugs.gnu.org; Wed, 07 Dec 2016 02:29:08 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45589) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEWf4-0001pE-LW for 25105@debbugs.gnu.org; Wed, 07 Dec 2016 02:29:07 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 21A9B208EF; Wed, 7 Dec 2016 02:29:06 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 07 Dec 2016 02:29:06 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=fMunbGB+qZeZnHylsiZK7wGTIGA=; b=n2GSPd Bj/hrpvmABqVXH+p8+NnfjGAZPtLTPXjPo1l/mz1T5CakoO7lNbagBDc4RMQ72Ol HGcZVD8YUZT8tsFfTT6+lCdAWshz2Oq8tUE1UUAVBqIw8V0yPh2wyN4w8YN/ER/0 envnqGkqQbPSfVckbzJeqL9xpFPGk3DiJeVr0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=fMunbGB+qZeZnH ylsiZK7wGTIGA=; b=hK3hPLE0cyb26x6u2qWVVe5a/KJ6XcRNnZac1P+SN/pFJ6 G8+keKpaynEWl1InwzoQFJoASFrGgRvFZirn8HpcyJu7Ez442MTCi2zPZvfNciOX zzdgt4IUcUqDicMJOeBX19TIzS7Bl7+OyK1AQELZiv1BDi1QLf4BKbptHO8Mk= X-ME-Sender: X-Sasl-enc: NNyrNK0+xJB+VU9U1VEyHT5FKfC37U+C5pB+gMqzr1rl 1481095745 Original-Received: from scrawny (50-1-153-216.dsl.dynamic.fusionbroadband.com [50.1.153.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8DA497EC40; Wed, 7 Dec 2016 02:29:05 -0500 (EST) Original-Received: from dima by scrawny with local (Exim 4.87) (envelope-from ) id 1cEWf2-0007Gk-7P; Tue, 06 Dec 2016 23:29:04 -0800 In-reply-to: <878trtoluv.fsf@udel.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:126585 Archived-At: --=-=-= Content-Type: text/plain Mark Oteiza 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=diff-mode-handle-initial-junk.patch 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 --=-=-=--