GNU bug report logs -
#37395
Diff-mode doesn't take into account patch-separators as produced by git-format-patch
Previous Next
Reported by: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Date: Thu, 12 Sep 2019 21:34:02 UTC
Severity: normal
Tags: fixed
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 37395 <at> debbugs.gnu.org (full text, mbox):
* lisp/vc/diff-mode.el (diff-goto-line-before-patch-separator): an
inline function to check if prev. line was git-format-patch separator,
in which case go there.
(diff-end-of-hunk): make use of (diff-goto-line-before-patch-separator)
---
lisp/vc/diff-mode.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 19f9c802d4..a3e4923fb4 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -511,6 +511,14 @@ diff-hunk-style
(goto-char (match-end 0)))
style)
+(defsubst diff-goto-line-before-patch-separator ()
+ "Go to prev. line, then if it has patch separator as produced
+by git-format-patch, stay there. Otherwise go back."
+ (previous-line)
+ (when (not (looking-at "-- "))
+ (next-line))
+ (point))
+
(defun diff-end-of-hunk (&optional style donttrustheader)
"Advance to the end of the current hunk, and return its position."
(let (end)
@@ -561,7 +569,8 @@ diff-end-of-hunk
(goto-char (or end (point-max)))
(while (eq ?\n (char-before (1- (point))))
(forward-char -1)
- (setq end (point)))))
+ (setq end (point))))
+ (setq end (diff-goto-line-before-patch-separator)))
;; The return value is used by easy-mmode-define-navigation.
(goto-char (or end (point-max)))))
--
2.23.0
This bug report was last modified 5 years and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.