diff options
| author | Chong Yidong | 2011-05-15 10:12:51 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-05-15 10:12:51 -0400 |
| commit | 2d11b7b37c33bae14369d57bf8a2b3b45e13b1e3 (patch) | |
| tree | dafd2e9d9be17713280ffab2f15905c987c00dfc | |
| parent | ce1539b46ddb8b45aadf70888f6e42e39d944865 (diff) | |
| download | emacs-2d11b7b37c33bae14369d57bf8a2b3b45e13b1e3.tar.gz emacs-2d11b7b37c33bae14369d57bf8a2b3b45e13b1e3.zip | |
Backport fix for Bug#8672 from trunk
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/diff-mode.el | 80 |
2 files changed, 46 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b1c7fd1f082..f56b1c04b18 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-05-15 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * vc/diff-mode.el (diff-fixup-modifs): Locate correct position for | ||
| 4 | hunk-end tags (Bug#8672). | ||
| 5 | |||
| 1 | 2011-05-13 Juanma Barranquero <lekktu@gmail.com> | 6 | 2011-05-13 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * progmodes/python.el (python-font-lock-keywords): | 8 | * progmodes/python.el (python-font-lock-keywords): |
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index b02c5d911d8..a3c4ca617ed 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -1116,45 +1116,47 @@ else cover the whole buffer." | |||
| 1116 | (save-excursion | 1116 | (save-excursion |
| 1117 | (goto-char end) (diff-end-of-hunk nil 'donttrustheader) | 1117 | (goto-char end) (diff-end-of-hunk nil 'donttrustheader) |
| 1118 | (let ((plus 0) (minus 0) (space 0) (bang 0)) | 1118 | (let ((plus 0) (minus 0) (space 0) (bang 0)) |
| 1119 | (while (and (= (forward-line -1) 0) (<= start (point))) | 1119 | while (and (= (forward-line -1) 0) (<= start (point))) |
| 1120 | (if (not (looking-at | 1120 | (if (not (looking-at |
| 1121 | (concat diff-hunk-header-re-unified | 1121 | (concat diff-hunk-header-re-unified |
| 1122 | "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$" | 1122 | "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$" |
| 1123 | "\\|--- .+\n\\+\\+\\+ "))) | 1123 | "\\|--- .+\n\\+\\+\\+ "))) |
| 1124 | (case (char-after) | 1124 | (case (char-after) |
| 1125 | (?\s (incf space)) | 1125 | (?\s (incf space)) |
| 1126 | (?+ (incf plus)) | 1126 | (?+ (incf plus)) |
| 1127 | (?- (incf minus)) | 1127 | (?- (incf minus)) |
| 1128 | (?! (incf bang)) | 1128 | (?! (incf bang)) |
| 1129 | ((?\\ ?#) nil) | 1129 | ((?\\ ?#) nil) |
| 1130 | (t (setq space 0 plus 0 minus 0 bang 0))) | 1130 | (t (setq space 0 plus 0 minus 0 bang 0))) |
| 1131 | (cond | 1131 | (cond |
| 1132 | ((looking-at diff-hunk-header-re-unified) | 1132 | ((looking-at diff-hunk-header-re-unified) |
| 1133 | (let* ((old1 (match-string 2)) | 1133 | (let* ((old1 (match-string 2)) |
| 1134 | (old2 (match-string 4)) | 1134 | (old2 (match-string 4)) |
| 1135 | (new1 (number-to-string (+ space minus))) | 1135 | (new1 (number-to-string (+ space minus))) |
| 1136 | (new2 (number-to-string (+ space plus)))) | 1136 | (new2 (number-to-string (+ space plus)))) |
| 1137 | (if old2 | 1137 | (if old2 |
| 1138 | (unless (string= new2 old2) (replace-match new2 t t nil 4)) | 1138 | (unless (string= new2 old2) (replace-match new2 t t nil 4)) |
| 1139 | (goto-char (match-end 4)) (insert "," new2)) | 1139 | (goto-char (match-end 3)) |
| 1140 | (if old1 | 1140 | (insert "," new2)) |
| 1141 | (unless (string= new1 old1) (replace-match new1 t t nil 2)) | 1141 | (if old1 |
| 1142 | (goto-char (match-end 2)) (insert "," new1)))) | 1142 | (unless (string= new1 old1) (replace-match new1 t t nil 2)) |
| 1143 | ((looking-at diff-context-mid-hunk-header-re) | 1143 | (goto-char (match-end 1)) |
| 1144 | (when (> (+ space bang plus) 0) | 1144 | (insert "," new1)))) |
| 1145 | (let* ((old1 (match-string 1)) | 1145 | ((looking-at diff-context-mid-hunk-header-re) |
| 1146 | (old2 (match-string 2)) | 1146 | (when (> (+ space bang plus) 0) |
| 1147 | (new (number-to-string | 1147 | (let* ((old1 (match-string 1)) |
| 1148 | (+ space bang plus -1 (string-to-number old1))))) | 1148 | (old2 (match-string 2)) |
| 1149 | (unless (string= new old2) (replace-match new t t nil 2))))) | 1149 | (new (number-to-string |
| 1150 | ((looking-at "\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]*\\) \\*\\*\\*\\*$") | 1150 | (+ space bang plus -1 (string-to-number old1))))) |
| 1151 | (when (> (+ space bang minus) 0) | 1151 | (unless (string= new old2) (replace-match new t t nil 2))))) |
| 1152 | (let* ((old (match-string 1)) | 1152 | ((looking-at "\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]*\\) \\*\\*\\*\\*$") |
| 1153 | (new (format | 1153 | (when (> (+ space bang minus) 0) |
| 1154 | (concat "%0" (number-to-string (length old)) "d") | 1154 | (let* ((old (match-string 1)) |
| 1155 | (+ space bang minus -1 (string-to-number old))))) | 1155 | (new (format |
| 1156 | (unless (string= new old) (replace-match new t t nil 2)))))) | 1156 | (concat "%0" (number-to-string (length old)) "d") |
| 1157 | (setq space 0 plus 0 minus 0 bang 0))))))) | 1157 | (+ space bang minus -1 (string-to-number old))))) |
| 1158 | (unless (string= new old) (replace-match new t t nil 2)))))) | ||
| 1159 | (setq space 0 plus 0 minus 0 bang 0))))))) | ||
| 1158 | 1160 | ||
| 1159 | ;;;; | 1161 | ;;;; |
| 1160 | ;;;; Hooks | 1162 | ;;;; Hooks |