1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

(diff-file-header-re): Tighten up regexp a tiny bit.

(diff-fixup-modifs): Catch unified-diff file-headers.
This commit is contained in:
Stefan Monnier 2004-09-29 17:42:50 +00:00
parent 0e9e9a2cc4
commit bd9d7d76f0
2 changed files with 19 additions and 13 deletions

View file

@ -301,7 +301,7 @@ when editing big diffs)."
;;;;
(defconst diff-hunk-header-re "^\\(@@ -[0-9,]+ \\+[0-9,]+ @@.*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")
(defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+\\|\\*\\*\\* .+\n---\\|[^-+!<>0-9@* ]\\).+\n" (substring diff-hunk-header-re 1)))
(defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* ]\\).+\n" (substring diff-hunk-header-re 1)))
(defvar diff-narrowed-to nil)
(defun diff-end-of-hunk (&optional style)
@ -798,9 +798,12 @@ else cover the whole bufer."
(goto-char end) (diff-end-of-hunk)
(let ((plus 0) (minus 0) (space 0) (bang 0))
(while (and (= (forward-line -1) 0) (<= start (point)))
(if (not (looking-at "\\(@@ -[0-9,]+ \\+[0-9,]+ @@.*\\|[-*][-*][-*] .+ [-*][-*][-*][-*]\\)$"))
(if (not (looking-at
(concat "@@ -[0-9,]+ \\+[0-9,]+ @@"
"\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$"
"\\|--- .+\n\\+\\+\\+ ")))
(case (char-after)
(?\ (incf space))
(?\s (incf space))
(?+ (incf plus))
(?- (incf minus))
(?! (incf bang))