emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110677: * lisp/vc/diff-mode.el (diff


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110677: * lisp/vc/diff-mode.el (diff-end-of-hunk): Also skip potential "no LF at eol".
Date: Fri, 26 Oct 2012 11:51:42 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110677
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12584
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2012-10-26 11:51:42 -0400
message:
  * lisp/vc/diff-mode.el (diff-end-of-hunk): Also skip potential "no LF at eol".
  (diff-refine-hunk): Similarly, handle the "no LF at eol".
modified:
  lisp/ChangeLog
  lisp/vc/diff-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-10-26 09:11:24 +0000
+++ b/lisp/ChangeLog    2012-10-26 15:51:42 +0000
@@ -1,3 +1,8 @@
+2012-10-26  Stefan Monnier  <address@hidden>
+
+       * vc/diff-mode.el (diff-end-of-hunk): Also skip potential "no LF at 
eol".
+       (diff-refine-hunk): Similarly, handle the "no LF at eol" (bug#12584).
+
 2012-10-26  Martin Rudalics  <address@hidden>
 
        * mouse.el (mouse-drag-line): Move last form into preceding when
@@ -8,7 +13,7 @@
 2012-10-25  David Engster  <address@hidden>
 
        * emacs-lisp/eieio.el (eieio-update-lisp-imenu-expression):
-       Removed.  This feature is already integrated in imenu.
+       Remove.  This feature is already integrated in imenu.
 
        * emacs-lisp/eieio-opt.el: Remove require for `button' since it is
        always loaded.  Require `speedbar' unconditionally.

=== modified file 'lisp/vc/diff-mode.el'
--- a/lisp/vc/diff-mode.el      2012-10-23 18:40:23 +0000
+++ b/lisp/vc/diff-mode.el      2012-10-26 15:51:42 +0000
@@ -478,11 +478,13 @@
         (let* ((nold (string-to-number (or (match-string 2) "1")))
                (nnew (string-to-number (or (match-string 4) "1")))
                (endold
-        (save-excursion
-          (re-search-forward (if diff-valid-unified-empty-line
-                                 "^[- \n]" "^[- ]")
+                (save-excursion
+                  (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,8 +1976,13 @@
       (goto-char beg)
       (pcase style
         (`unified
-         (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+"
-                                   end t)
+         (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)
                                 nil 'diff-refine-preproc props-r props-a)))


reply via email to

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