aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab2011-05-16 14:29:35 +0200
committerAndreas Schwab2011-05-16 14:29:35 +0200
commit165fd2df8cc5cfc292d8f2b81c7ff259bf7b9561 (patch)
tree3893758c73ac664ccf2a8c9fcbe42e88de71d95f
parent7affc353121049970fe7d49796f7a84e0c434061 (diff)
downloademacs-165fd2df8cc5cfc292d8f2b81c7ff259bf7b9561.tar.gz
emacs-165fd2df8cc5cfc292d8f2b81c7ff259bf7b9561.zip
Fix last change
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/diff-mode.el82
2 files changed, 46 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f56b1c04b18..c07682f8a7b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,10 @@
12011-05-16 Andreas Schwab <schwab@linux-m68k.org>
2
3 * diff-mode.el (diff-fixup-modifs): Fix last change.
4
12011-05-15 Chong Yidong <cyd@stupidchicken.com> 52011-05-15 Chong Yidong <cyd@stupidchicken.com>
2 6
3 * vc/diff-mode.el (diff-fixup-modifs): Locate correct position for 7 * diff-mode.el (diff-fixup-modifs): Locate correct position for
4 hunk-end tags (Bug#8672). 8 hunk-end tags (Bug#8672).
5 9
62011-05-13 Juanma Barranquero <lekktu@gmail.com> 102011-05-13 Juanma Barranquero <lekktu@gmail.com>
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index a3c4ca617ed..b37c0802033 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -1116,47 +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 3)) 1139 (goto-char (match-end 3))
1140 (insert "," new2)) 1140 (insert "," new2))
1141 (if old1 1141 (if old1
1142 (unless (string= new1 old1) (replace-match new1 t t nil 2)) 1142 (unless (string= new1 old1) (replace-match new1 t t nil 2))
1143 (goto-char (match-end 1)) 1143 (goto-char (match-end 1))
1144 (insert "," new1)))) 1144 (insert "," new1))))
1145 ((looking-at diff-context-mid-hunk-header-re) 1145 ((looking-at diff-context-mid-hunk-header-re)
1146 (when (> (+ space bang plus) 0) 1146 (when (> (+ space bang plus) 0)
1147 (let* ((old1 (match-string 1)) 1147 (let* ((old1 (match-string 1))
1148 (old2 (match-string 2)) 1148 (old2 (match-string 2))
1149 (new (number-to-string 1149 (new (number-to-string
1150 (+ space bang plus -1 (string-to-number old1))))) 1150 (+ space bang plus -1 (string-to-number old1)))))
1151 (unless (string= new old2) (replace-match new t t nil 2))))) 1151 (unless (string= new old2) (replace-match new t t nil 2)))))
1152 ((looking-at "\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]*\\) \\*\\*\\*\\*$") 1152 ((looking-at "\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]*\\) \\*\\*\\*\\*$")
1153 (when (> (+ space bang minus) 0) 1153 (when (> (+ space bang minus) 0)
1154 (let* ((old (match-string 1)) 1154 (let* ((old (match-string 1))
1155 (new (format 1155 (new (format
1156 (concat "%0" (number-to-string (length old)) "d") 1156 (concat "%0" (number-to-string (length old)) "d")
1157 (+ space bang minus -1 (string-to-number old))))) 1157 (+ space bang minus -1 (string-to-number old)))))
1158 (unless (string= new old) (replace-match new t t nil 2)))))) 1158 (unless (string= new old) (replace-match new t t nil 2))))))
1159 (setq space 0 plus 0 minus 0 bang 0))))))) 1159 (setq space 0 plus 0 minus 0 bang 0)))))))
1160 1160
1161;;;; 1161;;;;
1162;;;; Hooks 1162;;;; Hooks