diff options
| author | Thien-Thi Nguyen | 2007-09-11 07:00:04 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2007-09-11 07:00:04 +0000 |
| commit | 7fb6ce6ef14a83c1aa62d2a4cb974bfddf9d20e0 (patch) | |
| tree | 047f4503e17ed925e9ecb90c728ea9ed7b465360 | |
| parent | 33ce5f113d09beeed039b9fac265ef974224c342 (diff) | |
| download | emacs-7fb6ce6ef14a83c1aa62d2a4cb974bfddf9d20e0.tar.gz emacs-7fb6ce6ef14a83c1aa62d2a4cb974bfddf9d20e0.zip | |
(diff-sanity-check-hunk): Also accept single-line hunks.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/diff-mode.el | 22 |
2 files changed, 18 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2fc8aee532d..df168fae3af 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-09-10 Chris Moore <dooglus@gmail.com> | ||
| 2 | |||
| 3 | * diff-mode.el (diff-sanity-check-hunk): | ||
| 4 | Also accept single-line hunks. | ||
| 5 | |||
| 1 | 2007-09-10 Chong Yidong <cyd@stupidchicken.com> | 6 | 2007-09-10 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * startup.el (startup-screen-inhibit-startup-screen) | 8 | * startup.el (startup-screen-inhibit-startup-screen) |
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 68f7995a494..d4244126f23 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -1217,26 +1217,30 @@ Only works for unified diffs." | |||
| 1217 | 1217 | ||
| 1218 | ;; A context diff. | 1218 | ;; A context diff. |
| 1219 | ((eq (char-after) ?*) | 1219 | ((eq (char-after) ?*) |
| 1220 | (if (not (looking-at "\\*\\{15\\}\\(?: .*\\)?\n\\*\\*\\* \\([0-9]+\\),\\([0-9]+\\) \\*\\*\\*\\*")) | 1220 | (if (not (looking-at "\\*\\{15\\}\\(?: .*\\)?\n\\*\\*\\* \\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? \\*\\*\\*\\*")) |
| 1221 | (error "Unrecognized context diff first hunk header format") | 1221 | (error "Unrecognized context diff first hunk header format") |
| 1222 | (forward-line 2) | 1222 | (forward-line 2) |
| 1223 | (diff-sanity-check-context-hunk-half | 1223 | (diff-sanity-check-context-hunk-half |
| 1224 | (1+ (- (string-to-number (match-string 2)) | 1224 | (if (match-string 2) |
| 1225 | (string-to-number (match-string 1))))) | 1225 | (1+ (- (string-to-number (match-string 2)) |
| 1226 | (if (not (looking-at "--- \\([0-9]+\\),\\([0-9]+\\) ----$")) | 1226 | (string-to-number (match-string 1)))) |
| 1227 | 1)) | ||
| 1228 | (if (not (looking-at "--- \\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? ----$")) | ||
| 1227 | (error "Unrecognized context diff second hunk header format") | 1229 | (error "Unrecognized context diff second hunk header format") |
| 1228 | (forward-line) | 1230 | (forward-line) |
| 1229 | (diff-sanity-check-context-hunk-half | 1231 | (diff-sanity-check-context-hunk-half |
| 1230 | (1+ (- (string-to-number (match-string 2)) | 1232 | (if (match-string 2) |
| 1231 | (string-to-number (match-string 1)))))))) | 1233 | (1+ (- (string-to-number (match-string 2)) |
| 1234 | (string-to-number (match-string 1)))) | ||
| 1235 | 1))))) | ||
| 1232 | 1236 | ||
| 1233 | ;; A unified diff. | 1237 | ;; A unified diff. |
| 1234 | ((eq (char-after) ?@) | 1238 | ((eq (char-after) ?@) |
| 1235 | (if (not (looking-at | 1239 | (if (not (looking-at |
| 1236 | "@@ -[0-9]+,\\([0-9]+\\) \\+[0-9]+,\\([0-9]+\\) @@")) | 1240 | "@@ -[0-9]+\\(?:,\\([0-9]+\\)\\)? \\+[0-9]+\\(?:,\\([0-9]+\\)\\)? @@")) |
| 1237 | (error "Unrecognized unified diff hunk header format") | 1241 | (error "Unrecognized unified diff hunk header format") |
| 1238 | (let ((before (string-to-number (match-string 1))) | 1242 | (let ((before (if (match-string 1) (string-to-number (match-string 1)) 1)) |
| 1239 | (after (string-to-number (match-string 2)))) | 1243 | (after (if (match-string 2) (string-to-number (match-string 2)) 1))) |
| 1240 | (forward-line) | 1244 | (forward-line) |
| 1241 | (while | 1245 | (while |
| 1242 | (case (char-after) | 1246 | (case (char-after) |