aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-05-08 16:07:32 +0000
committerStefan Monnier2007-05-08 16:07:32 +0000
commit44a07c5a3c7b037fa066f77b27400bdb506e8df7 (patch)
treec541b91f9afcd32e63f66d31a3c646f083913389
parent5d08a786062aac9a4e33a7ed9f40eeb3e9eda799 (diff)
downloademacs-44a07c5a3c7b037fa066f77b27400bdb506e8df7.tar.gz
emacs-44a07c5a3c7b037fa066f77b27400bdb506e8df7.zip
(diff-apply-hunk, diff-test-hunk): Don't do by default
the exact opposite of diff-goto-source.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/diff-mode.el18
2 files changed, 15 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2d8fc893de9..f89d2562d99 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12007-05-08 Stefan Monnier <monnier@iro.umontreal.ca> 12007-05-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * diff-mode.el (diff-apply-hunk, diff-test-hunk): Don't do by default
4 the exact opposite of diff-goto-source.
5
3 * emacs-lisp/advice.el (ad-special-forms): Remove. 6 * emacs-lisp/advice.el (ad-special-forms): Remove.
4 (ad-special-form-p): Use subr-arity. 7 (ad-special-form-p): Use subr-arity.
5 8
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index 3cd2fb37dbb..87fade841ca 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -72,7 +72,7 @@
72 :group 'diff-mode) 72 :group 'diff-mode)
73 73
74(defcustom diff-jump-to-old-file nil 74(defcustom diff-jump-to-old-file nil
75 "*Non-nil means `diff-goto-source' jumps to the old file. 75 "Non-nil means `diff-goto-source' jumps to the old file.
76Else, it jumps to the new file." 76Else, it jumps to the new file."
77 :type 'boolean 77 :type 'boolean
78 :group 'diff-mode) 78 :group 'diff-mode)
@@ -1276,7 +1276,7 @@ Whitespace differences are ignored."
1276 (if (> (- (car forw) orig) (- orig (car back))) back forw) 1276 (if (> (- (car forw) orig) (- orig (car back))) back forw)
1277 (or back forw)))) 1277 (or back forw))))
1278 1278
1279(defsubst diff-xor (a b) (if a (not b) b)) 1279(defsubst diff-xor (a b) (if a (if (not b) a) b))
1280 1280
1281(defun diff-find-source-location (&optional other-file reverse) 1281(defun diff-find-source-location (&optional other-file reverse)
1282 "Find out (BUF LINE-OFFSET POS SRC DST SWITCHED). 1282 "Find out (BUF LINE-OFFSET POS SRC DST SWITCHED).
@@ -1358,8 +1358,15 @@ the value of this variable when given an appropriate prefix argument).
1358With a prefix argument, REVERSE the hunk." 1358With a prefix argument, REVERSE the hunk."
1359 (interactive "P") 1359 (interactive "P")
1360 (destructuring-bind (buf line-offset pos old new &optional switched) 1360 (destructuring-bind (buf line-offset pos old new &optional switched)
1361 ;; If REVERSE go to the new file, otherwise go to the old. 1361 ;; Sometimes we'd like to have the following behavior: if REVERSE go
1362 (diff-find-source-location (not reverse) reverse) 1362 ;; to the new file, otherwise go to the old. But that means that by
1363 ;; default we use the old file, which is the opposite of the default
1364 ;; for diff-goto-source, and is thus confusing. Also when you don't
1365 ;; know about it it's pretty surprising.
1366 ;; TODO: make it possible to ask explicitly for this behavior.
1367 ;;
1368 ;; This is duplicated in diff-test-hunk.
1369 (diff-find-source-location nil reverse)
1363 (cond 1370 (cond
1364 ((null line-offset) 1371 ((null line-offset)
1365 (error "Can't find the text to patch")) 1372 (error "Can't find the text to patch"))
@@ -1403,8 +1410,7 @@ With a prefix argument, REVERSE the hunk."
1403With a prefix argument, try to REVERSE the hunk." 1410With a prefix argument, try to REVERSE the hunk."
1404 (interactive "P") 1411 (interactive "P")
1405 (destructuring-bind (buf line-offset pos src dst &optional switched) 1412 (destructuring-bind (buf line-offset pos src dst &optional switched)
1406 ;; If REVERSE go to the new file, otherwise go to the old. 1413 (diff-find-source-location nil reverse)
1407 (diff-find-source-location (not reverse) reverse)
1408 (set-window-point (display-buffer buf) (+ (car pos) (cdr src))) 1414 (set-window-point (display-buffer buf) (+ (car pos) (cdr src)))
1409 (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) 1415 (diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))
1410 1416