From: Dima Kogan <dima@secretsauce.net>
To: 9597@debbugs.gnu.org
Subject: bug#9597: update
Date: Sun, 25 Dec 2016 15:40:54 -0800 [thread overview]
Message-ID: <87bmvzefw9.fsf@secretsauce.net> (raw)
In-Reply-To: <m21uv5pekj.fsf@pluto.luannocracy.com>
[-- Attachment #1: Type: text/plain, Size: 205 bytes --]
Hi. This is still an outstanding bug. Can we please revisit this? I'm
attaching a version of Juri Linkov's patch that applies cleanly to the
latest master. This patch solves the issue. Do we not like it?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-git-diffs.patch --]
[-- Type: text/x-diff, Size: 2237 bytes --]
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 75fd420..d1a5156 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -437,6 +437,9 @@ diff-valid-unified-empty-line
(defconst diff-hunk-header-re
(concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$"))
(defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1)))
+
+(defconst diff-separator-re "^--+ ?$")
+
(defvar diff-narrowed-to nil)
(defun diff-hunk-style (&optional style)
@@ -1604,15 +1607,20 @@ diff-sanity-check-hunk
(pcase (char-after)
(?\s (cl-decf before) (cl-decf after) t)
(?-
- (if (and (looking-at diff-file-header-re)
- (zerop before) (zerop after))
- ;; No need to query: this is a case where two patches
- ;; are concatenated and only counting the lines will
- ;; give the right result. Let's just add an empty
- ;; line so that our code which doesn't count lines
- ;; will not get confused.
- (progn (save-excursion (insert "\n")) nil)
- (cl-decf before) t))
+ (cond
+ ((and (looking-at diff-separator-re)
+ (zerop before) (zerop after))
+ nil)
+ ((and (looking-at diff-file-header-re)
+ (zerop before) (zerop after))
+ ;; No need to query: this is a case where two patches
+ ;; are concatenated and only counting the lines will
+ ;; give the right result. Let's just add an empty
+ ;; line so that our code which doesn't count lines
+ ;; will not get confused.
+ (save-excursion (insert "\n")) nil)
+ (t
+ (cl-decf before) t)))
(?+ (cl-decf after) t)
(_
(cond
next prev parent reply other threads:[~2016-12-25 23:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-24 19:41 bug#9597: 23.3; [diff-mode] Can't quite cope with git patches Dave Abrahams
2011-09-25 13:29 ` Juri Linkov
2011-09-26 2:08 ` Stefan Monnier
2011-09-27 0:03 ` Juri Linkov
2016-12-25 23:40 ` Dima Kogan [this message]
2016-12-27 21:16 ` bug#9597: update Juri Linkov
2016-12-27 23:56 ` Dima Kogan
2017-01-25 22:16 ` Dima Kogan
2017-01-27 9:53 ` Eli Zaretskii
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=87bmvzefw9.fsf@secretsauce.net \
--to=dima@secretsauce.net \
--cc=9597@debbugs.gnu.org \
/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).