emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#12584: closed (refine diff-hunk broken for unified


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#12584: closed (refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text)
Date: Fri, 26 Oct 2012 15:55:02 +0000

Your message dated Fri, 26 Oct 2012 11:51:48 -0400
with message-id <address@hidden>
and subject line Re: bug#12584: refine diff-hunk broken for unified diff with 
"\ No newline at end of file" meta text
has caused the debbugs.gnu.org bug report #12584,
regarding refine diff-hunk broken for unified diff with "\ No newline at end of 
file" meta text
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
12584: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12584
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text Date: Sat, 6 Oct 2012 23:09:56 +0800
Here is refine working with "diff -c"

http://puu.sh/1bXRG

Here is refein not working with "diff -u" because of the
aforementioned meta text

http://puu.sh/1bXPJ


-- 
Le



--- End Message ---
--- Begin Message --- Subject: Re: bug#12584: refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text Date: Fri, 26 Oct 2012 11:51:48 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)
> Here is refine working with "diff -c"
> http://puu.sh/1bXRG
> Here is refein not working with "diff -u" because of the
> aforementioned meta text
> http://puu.sh/1bXPJ

Thank you.  I've installed the patch below which should fix this problem.


        Stefan


=== modified file 'lisp/vc/diff-mode.el'
--- lisp/vc/diff-mode.el        2012-10-23 18:40:23 +0000
+++ lisp/vc/diff-mode.el        2012-10-26 15:50:33 +0000
@@ -482,7 +482,9 @@
           (re-search-forward (if diff-valid-unified-empty-line
                                  "^[- \n]" "^[- ]")
                                      nil t nold)
-                  (line-beginning-position 2)))
+                  (line-beginning-position
+                   ;; Skip potential "\ No newline at end of file".
+                   (if (looking-at ".*\n\\\\") 3 2))))
                (endnew
                 ;; The hunk may end with a bunch of "+" lines, so the `end' is
                 ;; then further than computed above.
@@ -490,7 +492,9 @@
                   (re-search-forward (if diff-valid-unified-empty-line
                                          "^[+ \n]" "^[+ ]")
                                      nil t nnew)
-                  (line-beginning-position 2))))
+                  (line-beginning-position
+                   ;; Skip potential "\ No newline at end of file".
+                   (if (looking-at ".*\n\\\\") 3 2)))))
           (setq end (max endold endnew)))))
     ;; We may have a first evaluation of `end' thanks to the hunk header.
     (unless end
@@ -1972,7 +1976,12 @@
       (goto-char beg)
       (pcase style
         (`unified
-         (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+"
+         (while (re-search-forward
+                 (eval-when-compile
+                   (let ((no-LF-at-eol-re "\\(?:\\\\.*\n\\)?"))
+                     (concat "^\\(?:-.*\n\\)+" no-LF-at-eol-re
+                             "\\(\\)"
+                             "\\(?:\\+.*\n\\)+" no-LF-at-eol-re)))
                                    end t)
            (smerge-refine-subst (match-beginning 0) (match-end 1)
                                 (match-end 1) (match-end 0)



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]