all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* diff-goto-source fails if "-p" is in diff-switches
@ 2007-02-07 14:12 Per Cederqvist
  2007-02-08  9:49 ` Per Cederqvist
  0 siblings, 1 reply; 2+ messages in thread
From: Per Cederqvist @ 2007-02-07 14:12 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

Revision 1.94 of diff-mode.el (committed 2007-01-11) introduced a
regression.  Now, the diff-goto-source function fails with either of
the error messages below if "-p" is present in diff-switches:

    Unrecognized context diff first hunk header format
    Unrecognized unified diff hunk header format

The enclosed patch makes diff-sanity-check-hunk less picky on the
format, so that diff-goto-sources starts working again even if
diff-switches is set to "-p" or "-up".

One way to reproduce the problem is to check out the Emacs source code
from CVS, edit emacs/src/abbrev.c, inserting a character in the
syms_of_abbrev function, saving the buffer, do M-x set-variable RET
diff-switches RET "-up" RET, do M-x vc-diff, move the cursor down to
the character you inserted, and press C-c C-c.  Instead of jumping to
the same place in the source buffer, you will get the second error
message reported above.

    /ceder


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Teach diff-sanity-check-hunk to accept output from diff -u --]
[-- Type: text/x-patch, Size: 1805 bytes --]

Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.10655
diff -u -r1.10655 ChangeLog
--- lisp/ChangeLog	7 Feb 2007 13:40:09 -0000	1.10655
+++ lisp/ChangeLog	7 Feb 2007 13:52:04 -0000
@@ -1,3 +1,8 @@
+2007-02-07  Per Cederqvist  <ceder@lysator.liu.se>
+
+	* diff-mode.el (diff-sanity-check-hunk): Don't reject the hunk
+	just because the diff was produced using "-p" (--show-c-function).
+
 2007-02-07  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
 	* ps-print.ps: The ps-print commands without face printing should not
Index: lisp/diff-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/diff-mode.el,v
retrieving revision 1.94
diff -u -r1.94 diff-mode.el
--- lisp/diff-mode.el	11 Jan 2007 16:52:59 -0000	1.94
+++ lisp/diff-mode.el	7 Feb 2007 13:52:04 -0000
@@ -1115,7 +1115,7 @@
 
        ;; A context diff.
        ((eq (char-after) ?*)
-        (if (not (looking-at "\\*\\{15\\}\n\\*\\*\\* \\([0-9]+\\),\\([0-9]+\\) \\*\\*\\*\\*$"))
+        (if (not (looking-at "\\*\\{15\\}.*\n\\*\\*\\* \\([0-9]+\\),\\([0-9]+\\) \\*\\*\\*\\*$"))
             (error "Unrecognized context diff first hunk header format")
           (forward-line 2)
           (diff-sanity-check-context-hunk-half
@@ -1131,7 +1131,7 @@
        ;; A unified diff.
        ((eq (char-after) ?@)
         (if (not (looking-at
-                  "@@ -[0-9]+,\\([0-9]+\\) \\+[0-9]+,\\([0-9]+\\) @@$"))
+                  "@@ -[0-9]+,\\([0-9]+\\) \\+[0-9]+,\\([0-9]+\\) @@"))
             (error "Unrecognized unified diff hunk header format")
           (let ((before (string-to-number (match-string 1)))
                 (after (string-to-number (match-string 2))))

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-08  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-07 14:12 diff-goto-source fails if "-p" is in diff-switches Per Cederqvist
2007-02-08  9:49 ` Per Cederqvist

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.